Improve the connection of RTdunio PWM(stm32f401-st-nucleo) (#6192)

* Improve the connection of RTdunio PWM

* Update bsp/stm32/stm32f401-st-nucleo/applications/arduino_pinout/README.md
This commit is contained in:
liYang~ 2022-07-27 11:44:13 +08:00 committed by GitHub
parent 48d43678ed
commit a79b34ef8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 9 deletions

View File

@ -32,8 +32,8 @@ Hardware Drivers Config --->
| 7 (D7) | PA8 | 是 | |
| 8 (D8) | PA9 | 是 | |
| 9 (D9) | PC7 | 是 | PWM定时器3发生 |
| 10 (D10) | PB6 | 是 | |
| 11 (D11) | PA7 | 是 | |
| 10 (D10) | PB6 | 是 | PWM定时器4发生 |
| 11 (D11) | PA7 | 是 | PWM定时器1发生 |
| 12 (D12) | PA6 | 是 | |
| 13 (D13) | PA5 | 是 | |
| 14 (D14) | PB9 | 是 | I2C1-SDA被RT-Thread的I2C设备框架i2c1总线接管不可当做普通IO |
@ -53,6 +53,7 @@ Hardware Drivers Config --->
> 1. 驱动舵机和analogWrite函数要选择不同定时器发生的PWM信号引脚由于STM32的定时器4个通道需要保持相同的频率如果采用相同的定时器发生的PWM分别驱动舵机和analogWrite可能会导致舵机失效。
> 2. USART2是Nucleo板的默认串口理论应对接到了Arduino引脚编号的D0和D1但是其实际用于串口通信因此不允许当做普通IO来使用和操作。如果需要将D0、D1与STM32 USART2的引脚相连需要手动焊接锡桥SB62、SB63。
> 3. Nucleo板的Arduino接口中AVDD即AREF默认是与VDD相连的如果需要扩展板提供外部参考电压需要将SB57锡桥挑开。
> 4. D11引脚是PWM反相位引脚(也就是常说的互补输出引脚CHxN)。但是这里不用考虑到占空比互补问题CHx-20%CHxN-80%),直接正常使用即可。
> 参考资料
>

View File

@ -1,11 +1,12 @@
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
* Copyright (c) 2006-2022, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2022-04-19 Meco Man first version
* 2022-07-26 liYony Perfect PWM (docking of complementary outputs)
*/
#include <Arduino.h>
#include <board.h>
@ -23,15 +24,15 @@ const pin_map_t pin_map_table[]=
{D0}, /* RX */
{D1}, /* TX */
{D2, GET_PIN(A,10)},
{D3, GET_PIN(B,3), "pwm2", 2}, /* PWM */
{D3, GET_PIN(B,3), "pwm2", 2}, /* PWM2-CH2 */
{D4, GET_PIN(B,5)},
{D5, GET_PIN(B,4), "pwm3", 1}, /* PWM */
{D6, GET_PIN(B,10), "pwm2", 3}, /* PWM */
{D5, GET_PIN(B,4), "pwm3", 1}, /* PWM3-CH1 */
{D6, GET_PIN(B,10), "pwm2", 3}, /* PWM2-CH3 */
{D7, GET_PIN(A,8)},
{D8, GET_PIN(A,9)},
{D9, GET_PIN(C,7), "pwm3", 2}, /* PWM */
{D10, GET_PIN(B,6)},
{D11, GET_PIN(A,7)},
{D9, GET_PIN(C,7), "pwm3", 2}, /* PWM3-CH2 */
{D10, GET_PIN(B,6), "pwm4", 1}, /* PWM4-CH1 */
{D11, GET_PIN(A,7), "pwm1", -1}, /* PWM1-CH1N */
{D12, GET_PIN(A,6)},
{D13, GET_PIN(A,5)},
{D14}, /* I2C1-SDA */