Skip to content

Commit

Permalink
boards: nucleo_h743zi: add pwm support
Browse files Browse the repository at this point in the history
Enables PWM support using the built-in red LED. Tested with:

- samples/basic/blink_led
- samples/basic/fade_led

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
  • Loading branch information
gmarull authored and carlescufi committed Apr 4, 2020
1 parent 4194360 commit cf2131d
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 4 deletions.
4 changes: 4 additions & 0 deletions boards/arm/nucleo_h743zi/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,8 @@ config I2C_1
default y
depends on I2C

config PWM_STM32_12
default y
depends on PWM

endif # BOARD_NUCLEO_H743ZI
2 changes: 2 additions & 0 deletions boards/arm/nucleo_h743zi/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ features:
+-----------+------------+-------------------------------------+
| I2C | on-chip | i2c |
+-----------+------------+-------------------------------------+
| PWM | on-chip | pwm |
+-----------+------------+-------------------------------------+

Other hardware features are not yet supported on this Zephyr port.

Expand Down
20 changes: 16 additions & 4 deletions boards/arm/nucleo_h743zi/nucleo_h743zi.dts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,13 @@
gpios = <&gpiob 7 GPIO_ACTIVE_HIGH>;
label = "User LD2";
};
red_led: led_2 {
gpios = <&gpiob 14 GPIO_ACTIVE_HIGH>;
label = "User LD3";
};

pwmleds {
compatible = "pwm-leds";

red_pwm_led: red_pwm_led {
pwms = <&{/soc/timers@40001800/pwm} 1 4>;
};
};

Expand All @@ -47,7 +51,7 @@
aliases {
led0 = &green_led;
led1 = &blue_led;
led2 = &red_led;
pwm-led0 = &red_pwm_led;
sw0 = &user_button;
};
};
Expand All @@ -65,3 +69,11 @@
status = "okay";
clock-frequency = <I2C_BITRATE_FAST>;
};

&timers12 {
status = "okay";

pwm {
status = "okay";
};
};
1 change: 1 addition & 0 deletions boards/arm/nucleo_h743zi/nucleo_h743zi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ supported:
- gpio
- counter
- i2c
- pwm
3 changes: 3 additions & 0 deletions boards/arm/nucleo_h743zi/pinmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ static const struct pin_config pinconf[] = {
{ STM32_PIN_PB8, STM32H7_PINMUX_FUNC_PB8_I2C1_SCL },
{ STM32_PIN_PB9, STM32H7_PINMUX_FUNC_PB9_I2C1_SDA },
#endif /* CONFIG_I2C_1 */
#ifdef CONFIG_PWM_STM32_12
{ STM32_PIN_PB14, STM32H7_PINMUX_FUNC_PB14_PWM12_CH1 }
#endif /* CONFIG_PWM_STM32_12 */
};

static int pinmux_stm32_init(struct device *port)
Expand Down
5 changes: 5 additions & 0 deletions samples/basic/blink_led/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ Nucleo_L496ZG
No special board setup is necessary because there are three on-board LEDs (red,
green, blue) connected to the Nucleo's PWM.

Nucleo_H743ZI
=============
No special board setup is necessary because the on-board red LED is connected
to PWM output 12 (channel 1).

Hexiwear K64
============
No special board setup is necessary because there is an on-board RGB LED
Expand Down
5 changes: 5 additions & 0 deletions samples/basic/fade_led/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ Nucleo_L496ZG
No special board setup is necessary because there are three on-board LEDs (red,
green, blue) connected to the Nucleo's PWM.

Nucleo_H743ZI
=============
No special board setup is necessary because the on-board red LED is connected
to PWM output 12 (channel 1).

Hexiwear K64
============
No special board setup is necessary because there is an on-board RGB LED
Expand Down

0 comments on commit cf2131d

Please sign in to comment.