Skip to content

Commit

Permalink
boards: st: nucleo_g431kb: add pwm
Browse files Browse the repository at this point in the history
Add support for pwm to run the bliky_pwm sample.

Signed-off-by: Klaus Nagel <[email protected]>
  • Loading branch information
nagelkl committed Sep 6, 2024
1 parent 02c5627 commit 1930a1e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
5 changes: 4 additions & 1 deletion boards/st/nucleo_g431kb/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ The Zephyr nucleo_g431kb board configuration supports the following hardware fea
+-----------+------------+-------------------------------------+
| GPIO | on-chip | gpio |
+-----------+------------+-------------------------------------+
| PWM | on-chip | pwm |
+-----------+------------+-------------------------------------+

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

Expand All @@ -74,6 +76,7 @@ Default Zephyr Peripheral Mapping:
- LPUART_1_TX : PA2
- LPUART_1_RX : PA3
- LD2 : PB8
- PWM_4_CH_3 : PB8

System Clock
------------
Expand Down Expand Up @@ -136,7 +139,7 @@ You should see the following message on the console:

.. code-block:: console
$ Hello World! arm
$ Hello World! nucleo_g431kb/stm32g431xx
Debugging
Expand Down
22 changes: 22 additions & 0 deletions boards/st/nucleo_g431kb/nucleo_g431kb.dts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,18 @@

};

pwmleds {
compatible = "pwm-leds";

green_pwm_led: green_pwm_led {
pwms = <&pwm4 3 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
};
};


aliases {
led0 = &green_led;
pwm-led0 = &green_pwm_led;
watchdog0 = &iwdg;
};
};
Expand Down Expand Up @@ -69,6 +79,18 @@
status = "okay";
};

&timers4 {
st,prescaler = <10000>;
status = "okay";

pwm4: pwm {
status = "okay";
pinctrl-0 = <&tim4_ch3_pb8>;
pinctrl-names = "default";
};
};


&flash0 {

partitions {
Expand Down

0 comments on commit 1930a1e

Please sign in to comment.