boards: arm: gd32f403z_eval: enable pwm support
Enable timer0 and its pwm node. The board does not directly have any LED connected to a PWM output. However, following the official "TIMER_Breath_LED" example, user can bridge PA8 (TIMER0_CH0) to PF0 (LED2) to run quick samples such as samples/basic/blinky_pwm. Note that a prescaler value of 256 has been chosen so that basic PWM samples (blinky_pwm and fade_led) can be run. This value may be overriden in specific samples if needed. Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
This commit is contained in:
parent
4d7e099215
commit
0ec7af9c17
4 changed files with 31 additions and 0 deletions
|
@ -66,6 +66,8 @@ The board configuration supports the following hardware features:
|
||||||
| NVIC | on-chip | nested vectored |
|
| NVIC | on-chip | nested vectored |
|
||||||
| | | interrupt controller |
|
| | | interrupt controller |
|
||||||
+-----------+------------+-----------------------+
|
+-----------+------------+-----------------------+
|
||||||
|
| PWM | on-chip | PWM |
|
||||||
|
+-----------+------------+-----------------------+
|
||||||
| SYSTICK | on-chip | system clock |
|
| SYSTICK | on-chip | system clock |
|
||||||
+-----------+------------+-----------------------+
|
+-----------+------------+-----------------------+
|
||||||
| UART | on-chip | serial port-polling |
|
| UART | on-chip | serial port-polling |
|
||||||
|
|
|
@ -11,4 +11,10 @@
|
||||||
pinmux = <USART0_TX_PA9_NORMP>, <USART0_RX_PA10_NORMP>;
|
pinmux = <USART0_TX_PA9_NORMP>, <USART0_RX_PA10_NORMP>;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
pwm0_default: pwm0_default {
|
||||||
|
group1 {
|
||||||
|
pinmux = <TIMER0_CH0_PA8_OUT_NORMP>;
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -59,10 +59,20 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
pwmleds {
|
||||||
|
compatible = "pwm-leds";
|
||||||
|
|
||||||
|
/* NOTE: bridge TIMER0_CH0 (PA8) and LED2 (PF0) */
|
||||||
|
pwm_led: pwm_led {
|
||||||
|
pwms = <&pwm0 0 PWM_POLARITY_NORMAL>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
aliases {
|
aliases {
|
||||||
led0 = &led2;
|
led0 = &led2;
|
||||||
led1 = &led3;
|
led1 = &led3;
|
||||||
sw0 = &user_key1;
|
sw0 = &user_key1;
|
||||||
|
pwm-led0 = &pwm_led;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -84,3 +94,14 @@
|
||||||
pinctrl-0 = <&usart0_default>;
|
pinctrl-0 = <&usart0_default>;
|
||||||
pinctrl-names = "default";
|
pinctrl-names = "default";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
&timer0 {
|
||||||
|
status = "okay";
|
||||||
|
prescaler = <256>;
|
||||||
|
|
||||||
|
pwm0: pwm {
|
||||||
|
status = "okay";
|
||||||
|
pinctrl-0 = <&pwm0_default>;
|
||||||
|
pinctrl-names = "default";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
|
@ -11,3 +11,5 @@ toolchain:
|
||||||
- zephyr
|
- zephyr
|
||||||
- gnuarmemb
|
- gnuarmemb
|
||||||
- xtools
|
- xtools
|
||||||
|
supported:
|
||||||
|
- pwm
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue