boards: nucleo_h743zi: add pwm support

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>
This commit is contained in:
Gerard Marull-Paretas 2020-03-07 18:00:29 +01:00 committed by Carles Cufí
parent 4194360cb5
commit cf2131d7f9
7 changed files with 36 additions and 4 deletions

View file

@ -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

View file

@ -109,6 +109,8 @@ features:
+-----------+------------+-------------------------------------+
| I2C | on-chip | i2c |
+-----------+------------+-------------------------------------+
| PWM | on-chip | pwm |
+-----------+------------+-------------------------------------+
Other hardware features are not yet supported on this Zephyr port.

View file

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

View file

@ -15,3 +15,4 @@ supported:
- gpio
- counter
- i2c
- pwm

View file

@ -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)

View file

@ -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

View file

@ -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