Skip to content

Commit dbd57d4

Browse files
NeilChen93kartben
authored andcommitted
boards: frdm_mcxc444: Add pwm support
Support pwm for NXP frdm_mcxc444 board. Test it using samples/basic/blinky_pwm. Signed-off-by: Neil Chen <[email protected]>
1 parent 189d303 commit dbd57d4

File tree

4 files changed

+43
-0
lines changed

4 files changed

+43
-0
lines changed

boards/nxp/frdm_mcxc444/doc/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ The ``frdm_mcxc444`` board target supports the following hardware features:
6161
+-----------+------------+-------------------------------------+
6262
| PIT | on-chip | counter |
6363
+-----------+------------+-------------------------------------+
64+
| PWM | on-chip | pwm |
65+
+-----------+------------+-------------------------------------+
6466
| RTC | on-chip | counter |
6567
+-----------+------------+-------------------------------------+
6668
| USB | on-chip | USB device |

boards/nxp/frdm_mcxc444/frdm_mcxc444-pinctrl.dtsi

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,13 @@
3333
slew-rate = "slow";
3434
};
3535
};
36+
pinmux_tpm0: pinmux_tpm0 {
37+
group0 {
38+
pinmux = <TPM0_CH2_PTE29>,
39+
<TPM0_CH4_PTE31>,
40+
<TPM0_CH5_PTD5>;
41+
drive-strength = "low";
42+
slew-rate = "slow";
43+
};
44+
};
3645
};

boards/nxp/frdm_mcxc444/frdm_mcxc444.dts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,16 @@
1818
led0 = &red_led;
1919
led1 = &green_led;
2020
led2 = &blue_led;
21+
pwm-led0 = &red_pwm_led;
22+
pwm-led1 = &green_pwm_led;
23+
pwm-led2 = &blue_pwm_led;
24+
red-pwm-led = &red_pwm_led;
25+
green-pwm-led = &green_pwm_led;
26+
blue-pwm-led = &blue_pwm_led;
2127
sw0 = &user_button_2;
2228
sw1 = &user_button_3;
2329
accel0 = &fxls8974;
30+
pwm-0 = &tpm0;
2431
};
2532

2633
chosen {
@@ -46,6 +53,23 @@
4653
};
4754
};
4855

56+
pwmleds {
57+
compatible = "pwm-leds";
58+
status = "disabled";
59+
red_pwm_led: pwm_led_0 {
60+
pwms = <&tpm0 4 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
61+
label = "PWM Red LED";
62+
};
63+
green_pwm_led: pwm_led_1 {
64+
pwms = <&tpm0 5 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
65+
label = "PWM Green LED";
66+
};
67+
blue_pwm_led: pwm_led_2 {
68+
pwms = <&tpm0 2 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
69+
label = "PWM Blue LED";
70+
};
71+
};
72+
4973
gpio_keys {
5074
compatible = "gpio-keys";
5175
user_button_2: button_2 {
@@ -142,6 +166,13 @@ i2c0: &i2c0 {
142166
status = "okay";
143167
};
144168

169+
&tpm0 {
170+
status = "okay";
171+
pinctrl-0 = <&pinmux_tpm0>;
172+
pinctrl-names = "default";
173+
clocks = <&sim KINETIS_SIM_OSCERCLK 0x103C 24>;
174+
};
175+
145176
zephyr_udc0: &usb {
146177
status = "okay";
147178
num-bidir-endpoints = <8>;

boards/nxp/frdm_mcxc444/frdm_mcxc444.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ supported:
2020
- gpio
2121
- i2c
2222
- uart
23+
- pwm
2324
- usb_device
2425
- usbd
2526
testing:

0 commit comments

Comments
 (0)