Skip to content

Commit fd5189e

Browse files
FRASTMcarlescufi
authored andcommitted
samples: drivers: pwm led running on stm32 boards
On the stm32l073rz nucleo and stm32f091rc nucleo boards, the DTS pwm-leds node is disabled, because the output pin might conflict with SPI1. It is necessary to enable the node in the overlay to compile and run the sample. Signed-off-by: Francois Ramu <[email protected]>
1 parent 012836a commit fd5189e

File tree

2 files changed

+8
-46
lines changed

2 files changed

+8
-46
lines changed

samples/drivers/led_pwm/boards/nucleo_f091rc.overlay

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,11 @@
44
* Copyright (c) 2022 STMicroelectronics
55
*/
66

7-
#include <zephyr/dt-bindings/pwm/pwm.h>
8-
9-
10-
/ {
11-
pwmleds {
12-
compatible = "pwm-leds";
13-
14-
green_pwm_led: green_pwm_led {
15-
pwms = <&pwm2 1 4 PWM_POLARITY_NORMAL>;
16-
};
17-
};
18-
19-
aliases {
20-
pwm-led0 = &green_pwm_led;
21-
};
7+
&pwmleds {
8+
/* NOTE: enable here because it is disabled by default */
9+
status = "okay";
2210
};
2311

24-
&timers2 {
25-
st,prescaler = <10000>;
12+
&pwm2 {
2613
status = "okay";
27-
28-
pwm2: pwm {
29-
status = "okay";
30-
pinctrl-0 = <&tim2_ch1_pa5>; /* might conflict with SPI1 */
31-
pinctrl-names = "default";
32-
};
3314
};

samples/drivers/led_pwm/boards/nucleo_l073rz.overlay

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,11 @@
44
* Copyright (c) 2022 STMicroelectronics
55
*/
66

7-
#include <zephyr/dt-bindings/pwm/pwm.h>
8-
9-
10-
/ {
11-
pwmleds {
12-
compatible = "pwm-leds";
13-
14-
green_pwm_led: green_pwm_led {
15-
pwms = <&pwm2 1 4 PWM_POLARITY_NORMAL>;
16-
};
17-
};
18-
19-
aliases {
20-
pwm-led0 = &green_pwm_led;
21-
};
7+
&pwmleds {
8+
/* NOTE: enable here because it is disabled by default */
9+
status = "okay";
2210
};
2311

24-
&timers2 {
25-
st,prescaler = <10000>;
12+
&pwm2 {
2613
status = "okay";
27-
28-
pwm2: pwm {
29-
status = "okay";
30-
pinctrl-0 = <&tim2_ch1_pa5>; /* might conflict with SPI1 */
31-
pinctrl-names = "default";
32-
};
3314
};

0 commit comments

Comments
 (0)