diff --git a/boards/arm/nucleo_g071rb/doc/index.rst b/boards/arm/nucleo_g071rb/doc/index.rst index 5bf6acfc236..b0bc8ea947c 100644 --- a/boards/arm/nucleo_g071rb/doc/index.rst +++ b/boards/arm/nucleo_g071rb/doc/index.rst @@ -98,6 +98,8 @@ The Zephyr nucleo_g071rb board configuration supports the following hardware fea +-----------+------------+-------------------------------------+ | WATCHDOG | on-chip | independent watchdog | +-----------+------------+-------------------------------------+ +| PWM | on-chip | pwm | ++-----------+------------+-------------------------------------+ Other hardware features are not yet supported in this Zephyr port. @@ -119,6 +121,7 @@ Default Zephyr Peripheral Mapping: - UART_2 TX/RX : PA2/PA3 (ST-Link Virtual Port Com) - USER_PB : PC13 - LD4 : PA5 +- PWM : PA6 For mode details please refer to `STM32 Nucleo-64 board User Manual`_. diff --git a/boards/arm/nucleo_g071rb/nucleo_g071rb.dts b/boards/arm/nucleo_g071rb/nucleo_g071rb.dts index add420d9592..98bfe0d4823 100644 --- a/boards/arm/nucleo_g071rb/nucleo_g071rb.dts +++ b/boards/arm/nucleo_g071rb/nucleo_g071rb.dts @@ -50,3 +50,10 @@ &iwdg { status = "okay"; }; + +&timers3 { + status = "okay"; + pwm3: pwm { + status = "okay"; + }; +}; diff --git a/boards/arm/nucleo_g071rb/nucleo_g071rb.yaml b/boards/arm/nucleo_g071rb/nucleo_g071rb.yaml index 67ed6be3622..2f690dae313 100644 --- a/boards/arm/nucleo_g071rb/nucleo_g071rb.yaml +++ b/boards/arm/nucleo_g071rb/nucleo_g071rb.yaml @@ -13,3 +13,4 @@ supported: - uart - gpio - watchdog + - pwm diff --git a/boards/arm/nucleo_g071rb/pinmux.c b/boards/arm/nucleo_g071rb/pinmux.c index 4f45c5ebe75..647da76e722 100644 --- a/boards/arm/nucleo_g071rb/pinmux.c +++ b/boards/arm/nucleo_g071rb/pinmux.c @@ -19,6 +19,9 @@ static const struct pin_config pinconf[] = { {STM32_PIN_PA2, STM32G0_PINMUX_FUNC_PA2_USART2_TX}, {STM32_PIN_PA3, STM32G0_PINMUX_FUNC_PA3_USART2_RX}, #endif +#if DT_NODE_HAS_STATUS(DT_NODELABEL(pwm3), okay) && CONFIG_SERIAL + {STM32_PIN_PA6, STM32G0_PINMUX_FUNC_PA6_PWM3_CH1}, +#endif }; static int pinmux_stm32_init(struct device *port) diff --git a/drivers/pinmux/stm32/pinmux_stm32g0.h b/drivers/pinmux/stm32/pinmux_stm32g0.h index 21374d39ab0..c7e17598fac 100644 --- a/drivers/pinmux/stm32/pinmux_stm32g0.h +++ b/drivers/pinmux/stm32/pinmux_stm32g0.h @@ -28,4 +28,7 @@ #define STM32G0_PINMUX_FUNC_PA7_TIM3_CH2 \ (STM32_PINMUX_ALT_FUNC_1 | STM32_PUSHPULL_NOPULL) +#define STM32G0_PINMUX_FUNC_PA6_PWM3_CH1 \ + (STM32_PINMUX_ALT_FUNC_1 | STM32_PUSHPULL_NOPULL) + #endif /* ZEPHYR_DRIVERS_PINMUX_STM32_PINMUX_STM32G0_H_ */