未验证 提交 ed1bcfbd 编写于 作者: mysterywolf's avatar mysterywolf 提交者: GitHub

[rtduino][BSPs] translate readme to English (#6496)

上级 8b0610fc
......@@ -57,7 +57,7 @@ RT-Thread online packages --->
## 2 Arduino引脚排布
该BSP遵照Arduino UNO板的引脚排列方式 ,并额外扩展了一些LED和按键
该BSP遵照Arduino UNO板的引脚排列方式,并额外扩展了一些LED和按键,更多引脚布局相关信息参见 [pins_arduino.c](pins_arduino.c)[pins_arduino.h](pins_arduino.h)
| Arduino引脚编号 | ES32引脚编号 | 备注 |
| --------------- | ------------ | ---------------- |
......
# STM32F072 Nucleo开发板的Arduino生态兼容说明
# The Arduino Compatible for STM32F072 Nucleo Board
## 1 RTduino - RT-Thread的Arduino生态兼容层
**English** | [中文](README_zh.md)
STM32F072 Nucleo开发板已经完整适配了[RTduino软件包](https://github.com/RTduino/RTduino),即RT-Thread的Arduino生态兼容层。用户可以按照Arduino的编程习惯来操作该BSP,并且可以使用大量Arduino社区丰富的库,是对RT-Thread生态的极大增强。更多信息,请参见[RTduino软件包说明文档](https://github.com/RTduino/RTduino)
## 1 RTduino - Arduino Ecosystem Compatibility Layer for RT-Thread
### 1.1 如何开启针对本BSP的Arduino生态兼容层
STM32F072 Nucleo board has support [RTduino](https://github.com/RTduino/RTduino). Users can use Arduino APIs, third party libraries and programming method to program on the board.
Env 工具下敲入 menuconfig 命令,或者 RT-Thread Studio IDE 下选择 RT-Thread Settings:
### 1.1 How to Enable RTduino
Please go to the [RTduino repository](https://github.com/RTduino/RTduino) to see the details.
```Kconfig
Hardware Drivers Config --->
......@@ -14,61 +16,58 @@ Hardware Drivers Config --->
[*] Compatible with Arduino Ecosystem (RTduino)
```
## 2 Arduino引脚排布
## 2 Arduino Pinout
![nucleo-f072-pinout](nucleo-f072-pinout.png)
该BSP遵照Arduino UNO板的引脚排列方式。详见 `pins_arduino.c`
| Arduino引脚编号 | STM32引脚编号 | 5V容忍 | 备注 |
| ----------- | --------- | ---- | -------------------------------------- |
| 0 (D0) | PA3 | 否 | Serial-Rx,默认被RT-Thread的UART设备框架uart2接管 |
| 1 (D1) | PA2 | 否 | Serial-tx,默认被RT-Thread的UART设备框架uart2接管 |
| 2 (D2) | PA10 | 是 | |
| 3 (D3) | PB3 | 是 | PWM(定时器2发生) |
| 4 (D4) | PB5 | 是 | |
| 5 (D5) | PB4 | 是 | PWM(定时器3发生) |
| 6 (D6) | PB10 | 是 | PWM(定时器2发生) |
| 7 (D7) | PA8 | 是 | |
| 8 (D8) | PA9 | 是 | |
| 9 (D9) | PC7 | 是 | PWM(定时器3发生) |
| 10 (D10) | PB6 | 是 | PWM(定时器16发生) |
| 11 (D11) | PA7 | 否 | PWM(定时器17发生) |
| 12 (D12) | PA6 | 否 | |
| 13 (D13) | PA5 | 否 | |
| 14 (D14) | PB9 | 是 | 默认为I2C1-SDA,被RT-Thread的I2C设备框架i2c1总线接管 |
| 15 (D15) | PB8 | 是 | 默认为I2C1-SCL,被RT-Thread的I2C设备框架i2c1总线接管 |
| 16 (D16) | PC13 | 否 | Nucleo板载用户按键(左侧蓝色) |
| A0 | PA0 | 否 | ADC |
| A1 | PA1 | 否 | ADC |
| A2 | PA4 | 否 | ADC |
| A3 | PB0 | 否 | ADC |
| A4 | PC1 | 否 | ADC |
| A5 | PC0 | 否 | ADC |
| A6 | -- | | 芯片内部参考电压 ADC |
| A7 | -- | | 芯片内部温度 ADC |
> 注意:
This board complies with Arduino UNO pins layout. For more details, please take a look at: [pins_arduino.c](pins_arduino.c) and [pins_arduino.h](pins_arduino.h).
| Arduino Pin | STM32 Pin | 5V Tolerate | Note |
| --------------------- | --------- | ----------- | --------------------------------------------------------------------------------------------- |
| 0 (D0) | PA3 | No | Serial-Rx. Token over by RT-Thread UART device by default |
| 1 (D1) | PA2 | No | Serial-Tx. Token over by RT-Thread UART device by default |
| 2 (D2) | PA10 | Yes | |
| 3 (D3) | PB3 | Yes | PWM2-CH2. Token over by RT-Thread PWM device by default |
| 4 (D4) | PB5 | Yes | |
| 5 (D5) | PB4 | Yes | PWM3-CH1. Token over by RT-Thread PWM device by default |
| 6 (D6) | PB10 | Yes | PWM2-CH3. Token over by RT-Thread PWM device by default |
| 7 (D7) | PA8 | Yes | |
| 8 (D8) | PA9 | Yes | |
| 9 (D9) | PC7 | Yes | PWM3-CH2. Token over by RT-Thread PWM device by default |
| 10 (D10) | PB6 | Yes | PWM16-CHN1. Token over by RT-Thread PWM device by default |
| 11 (D11) | PA7 | No | PWM17-CH1. Token over by RT-Thread PWM device by default |
| 12 (D12) | PA6 | No | |
| 13 (D13, LED_BUILTIN) | PA5 | No | USER LED |
| 14 (D14) | PB9 | Yes | I2C1-SDA. Token over by RT-Thread I2C device by default |
| 15 (D15) | PB8 | Yes | I2C1-SCL. Token over by RT-Thread I2C device by default |
| 16 (D16) | PC13 | No | USER Button |
| A0 | PA0 | No | ADC1-CH0. Token over by RT-Thread ADC device by default |
| A1 | PA1 | No | ADC1-CH1. Token over by RT-Thread ADC device by default |
| A2 | PA4 | No | ADC1-CH4. Token over by RT-Thread ADC device by default |
| A3 | PB0 | No | ADC1-CH8. Token over by RT-Thread ADC device by default |
| A4 | PC1 | No | ADC1-CH11. Token over by RT-Thread ADC device by default |
| A5 | PC0 | No | ADC1-CH10. Token over by RT-Thread ADC device by default |
| A6 | -- | | On-chip internal voltage sensor. ADC1-CH17. Token over by RT-Thread ADC device by default |
| A7 | -- | | On-chip internal temperature sensor. ADC1-CH16. Token over by RT-Thread ADC device by default |
> Notice:
>
> 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. D10引脚是PWM反相位引脚(也就是常说的互补输出引脚CHxN)。但是这里不用考虑到占空比互补问题(CHx-20%,CHxN-80%),直接正常使用即可。
> 1. Don't use a same hardware timer to drive PWM (analogRead) and servos at same time, because hardware timer can only generate a same frequency for 4 PWM channels. Otherwise, it could cause a failure when drive servos.
> 参考资料
> References
>
> 【1】[STM32 Nucleo-64板官方手册](https://www.st.com/resource/en/user_manual/um1724-stm32-nucleo64-boards-mb1136-stmicroelectronics.pdf)
> 1. [STM32 Nucleo-64 user manual](https://www.st.com/resource/en/user_manual/um1724-stm32-nucleo64-boards-mb1136-stmicroelectronics.pdf)
## 3 通信
## 3 Communication
### 3.1 I2C总线
### 3.1 I2C Bus
STM32F072 Nucleo板的I2C总线是板上丝印的 `SCL/D15``SDA/D14` 引脚,这两个引脚默认是被RT-Thread I2C设备框架接管的,直接引用`#include <Wire.h>`(Arduino官方I2C头文件)即可使用。
I2C bus is `SCL/D15` and `SDA/D14` pins. Users can directly include the `#include <Wire.h>`, which is the Arduino official I2C header file, to use the I2C bus.
### 3.2 SPI总线
### 3.2 SPI Bus
目前本BSP不支持使用Arduino的SPI功能。
This board doesn't support Arduino SPI header file and functions.
### 3.3 串口
### 3.3 Serial
本BSP通过 `Serial.` 方法调用 `uart2` 串口设备。详见[例程](https://github.com/RTduino/RTduino/blob/master/examples/Basic/helloworld.cpp)
This board supports to use `Serial.` method to operate `uart2` device. See [example](https://github.com/RTduino/RTduino/blob/master/examples/Basic/helloworld.cpp).
# STM32F072 Nucleo开发板的Arduino生态兼容说明
[English](README.md) | **中文**
## 1 RTduino - RT-Thread的Arduino生态兼容层
STM32F072 Nucleo开发板已经完整适配了[RTduino软件包](https://github.com/RTduino/RTduino),即RT-Thread的Arduino生态兼容层。用户可以按照Arduino的编程习惯来操作该BSP,并且可以使用大量Arduino社区丰富的库,是对RT-Thread生态的极大增强。更多信息,请参见[RTduino软件包说明文档](https://github.com/RTduino/RTduino)
### 1.1 如何开启针对本BSP的Arduino生态兼容层
Env 工具下敲入 menuconfig 命令,或者 RT-Thread Studio IDE 下选择 RT-Thread Settings:
```Kconfig
Hardware Drivers Config --->
Onboard Peripheral Drivers --->
[*] Compatible with Arduino Ecosystem (RTduino)
```
## 2 Arduino引脚排布
![nucleo-f072-pinout](nucleo-f072-pinout.png)
该BSP遵照Arduino UNO板的引脚排列方式,详见 [pins_arduino.c](pins_arduino.c)[pins_arduino.h](pins_arduino.h)
| Arduino引脚编号 | STM32引脚编号 | 5V容忍 | 备注 |
| --------------------- | --------- | ---- | --------------------------------------------- |
| 0 (D0) | PA3 | 否 | Serial-Rx,默认被RT-Thread的UART设备框架uart2接管 |
| 1 (D1) | PA2 | 否 | Serial-Tx,默认被RT-Thread的UART设备框架uart2接管 |
| 2 (D2) | PA10 | 是 | |
| 3 (D3) | PB3 | 是 | PWM2-CH2,默认被RT-Thread的PWM设备框架pwm2接管 |
| 4 (D4) | PB5 | 是 | |
| 5 (D5) | PB4 | 是 | PWM3-CH1,默认被RT-Thread的PWM设备框架pwm3接管 |
| 6 (D6) | PB10 | 是 | PWM2-CH3,默认被RT-Thread的PWM设备框架pwm2接管 |
| 7 (D7) | PA8 | 是 | |
| 8 (D8) | PA9 | 是 | |
| 9 (D9) | PC7 | 是 | PWM3-CH2,默认被RT-Thread的PWM设备框架pwm3接管 |
| 10 (D10) | PB6 | 是 | PWM16-CHN1,默认被RT-Thread的PWM设备框架pwm16接管 |
| 11 (D11) | PA7 | 否 | PWM17-CH1,默认被RT-Thread的PWM设备框架pwm17接管 |
| 12 (D12) | PA6 | 否 | |
| 13 (D13, LED_BUILTIN) | PA5 | 否 | 板载用户LED |
| 14 (D14) | PB9 | 是 | I2C1-SDA,被RT-Thread的I2C设备框架i2c1总线接管 |
| 15 (D15) | PB8 | 是 | I2C1-SCL,被RT-Thread的I2C设备框架i2c1总线接管 |
| 16 (D16) | PC13 | 否 | 用户按键(左侧蓝色) |
| A0 | PA0 | 否 | ADC1-CH0,默认被RT-Thread的ADC设备框架adc1接管 |
| A1 | PA1 | 否 | ADC1-CH1,默认被RT-Thread的ADC设备框架adc1接管 |
| A2 | PA4 | 否 | ADC1-CH4,默认被RT-Thread的ADC设备框架adc1接管 |
| A3 | PB0 | 否 | ADC1-CH8,默认被RT-Thread的ADC设备框架adc1接管 |
| A4 | PC1 | 否 | ADC1-CH11,默认被RT-Thread的ADC设备框架adc1接管 |
| A5 | PC0 | 否 | ADC1-CH10,默认被RT-Thread的ADC设备框架adc1接管 |
| A6 | -- | | 芯片内部参考电压 ADC1-CH17,默认被RT-Thread的ADC设备框架adc1接管 |
| A7 | -- | | 芯片内部温度 ADC1-CH16,默认被RT-Thread的ADC设备框架adc1接管 |
> 注意:
>
> 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. D10引脚是PWM反相位引脚(互补输出引脚),但是这里**不用**考虑到占空比互补问题(CHx-20%,CHxN-80%),直接正常使用即可。
> 参考资料
>
> 1. [STM32 Nucleo-64板用户手册](https://www.st.com/resource/en/user_manual/um1724-stm32-nucleo64-boards-mb1136-stmicroelectronics.pdf)
## 3 通信
### 3.1 I2C总线
STM32F072 Nucleo板的I2C总线是板上丝印的 `SCL/D15``SDA/D14` 引脚,这两个引脚默认是被RT-Thread I2C设备框架接管的,直接引用`#include <Wire.h>`(Arduino官方I2C头文件)即可使用。
### 3.2 SPI总线
目前本BSP不支持使用Arduino的SPI功能。
### 3.3 串口
本BSP通过 `Serial.` 方法调用 `uart2` 串口设备。详见[例程](https://github.com/RTduino/RTduino/blob/master/examples/Basic/helloworld.cpp)
# The Arduino Compatible of STM32 Blue Pill Board
# The Arduino Compatible for STM32F103 Blue Pill Board
**English** | [中文](README_zh.md)
## 1 RTduino - Arduino Ecosystem Compatibility Layer for RT-Thread
STM32 Blue Pill board has support [RTduino](https://github.com/RTduino/RTduino). Users can use Arduino APIs, third party libraries and programming method to program on Blue Pill board.
STM32 Blue Pill board has support [RTduino](https://github.com/RTduino/RTduino). Users can use Arduino APIs, third party libraries and programming method to program on the board.
### 1.1 How to Enable RTduino
......@@ -18,9 +18,11 @@ Hardware Drivers Config --->
## 2 Arduino Pinout
For more information, please see [pins_arduino.c](pins_arduino.c) and [pins_arduino.h](pins_arduino.h).
![blue-pill-f103-pinout](blue-pill-f103-pinout.jpg)
| Arduino Pin | STM32 Pin | 5V Tolerate | 备注 |
| Arduino Pin | STM32 Pin | 5V Tolerate | Note |
| ------------------- | --------- | ----------- | ----------------------------------------------------------------------------------------------------------- |
| 0 (D0) | PB7 | Yes | |
| 1 (D1) | PB6 | Yes | |
......@@ -30,7 +32,7 @@ Hardware Drivers Config --->
| 5 (D5) | PA15 | Yes | PWM2-CH1. Token over by RT-Thread PWM device by default |
| 6 (D6) | PA8 | Yes | |
| 7 (D7, SS) | PB12 | Yes | SPI chip select by default |
| 8 (D8, LED_BUILTIN) | PC13 | No | Build-in LED |
| 8 (D8, LED_BUILTIN) | PC13 | No | USER LED |
| 9 (D9) | PC14 | No | |
| 10 (D10) | PC15 | No | |
| 11 (D11) | PA0 | No | |
......@@ -40,12 +42,12 @@ Hardware Drivers Config --->
| 15 (D15) | PB8 | Yes | I2C-SCL. Token over by RT-Thread I2C device by default |
| 16 (D16) | PA12 | Yes | USB-DP. Token over by [TinyUSB](https://github.com/RT-Thread-packages/tinyusb) software package by default. |
| 17 (D17) | PA11 | Yes | USB-DM. Token over by [TinyUSB](https://github.com/RT-Thread-packages/tinyusb) software package by default. |
| 18 (D18) | PA10 | Yes | Serial-Rx. Token over by RT-Thread UART device by default |
| 19 (D19) | PA9 | Yes | Serial-Tx. Token over by RT-Thread UART device by default |
| 20 (D20) | PA2 | No | Serial2-Tx. Token over by RT-Thread UART device by default |
| 21 (D21) | PA3 | No | Serial2-Rx. Token over by RT-Thread UART device by default |
| 22 (D22) | PB10 | Yes | Serial3-Tx. Token over by RT-Thread UART device by default |
| 23 (D23) | PB11 | Yes | Serial3-Rx. Token over by RT-Thread UART device by default |
| 18 (D18) | PA10 | Yes | Serial-Rx. Token over by RT-Thread UART device by default |
| 19 (D19) | PA9 | Yes | Serial-Tx. Token over by RT-Thread UART device by default |
| 20 (D20) | PA2 | No | Serial2-Tx. Token over by RT-Thread UART device by default |
| 21 (D21) | PA3 | No | Serial2-Rx. Token over by RT-Thread UART device by default |
| 22 (D22) | PB10 | Yes | Serial3-Tx. Token over by RT-Thread UART device by default |
| 23 (D23) | PB11 | Yes | Serial3-Rx. Token over by RT-Thread UART device by default |
| 24 (D24) | PB15 | Yes | SPI-MOSI. Token over by RT-Thread SPI device by default |
| 25 (D25) | PB14 | Yes | SPI-MISO. Token over by RT-Thread SPI device by default |
| 26 (D26) | PB13 | Yes | SPI-SCK. Token over by RT-Thread SPI device by default |
......@@ -57,10 +59,9 @@ Hardware Drivers Config --->
| 32 (A5) | -- | | ADC of chip internal reference voltage. Token over by RT-Thread ADC device by default |
| 33 (A6) | -- | | ADC of chip internal temperature. Token over by RT-Thread ADC device by default |
> Note:
> Notice:
>
> 1. If you drive the servo and call the analogWrite function at the same time, you need to select the PWM signal pins generated by different timers. Since the 4 channels of the STM32 timer need to maintain the same frequency, if the PWM generated by the same timer is used to drive the servo and analogWrite respectively , it may cause the servo to fail.
> 2. More information about Arduino pinout, please see [pins_arduino.c](pins_arduino.c) and [pins_arduino.h](pins_arduino.h)
> 1. Don't use a same hardware timer to drive PWM (analogRead) and servos at same time, because hardware timer can only generate a same frequency for 4 PWM channels. Otherwise, it could cause a failure when drive servos.
## 3 Communication
......@@ -72,10 +73,17 @@ I2C bus is `D14` and `D15` pins. Users can directly include the `#include <Wire.
SPI bus is `D24`, `D25` and `D26` pins. Users can directly include the `#include <SPI.h>`, which is the Arduino official SPI header file, to use the SPI bus. In addition, chip select pin (SS) also is used, which is `D7` by default.
### 3.3 USB
### 3.3 Serial
This board supports to use `Serial.` method to operate `uart1` device; use `Serial2.` method to use `uart2` device; use `Serial3.` method to use `uart3` device. See [example](https://github.com/RTduino/RTduino/blob/master/examples/Basic/helloworld.cpp).
This board supports USB virtual COM by default. See [example](https://github.com/RTduino/RTduino/tree/master/examples/USBSerial).
### 3.4 USB Virtual Serial
### 3.4 Serial
This board supports USB virtual serial. See [example](https://github.com/RTduino/RTduino/tree/master/examples/USBSerial). You may enable it if is needed.
This board supports to use `Serail.` method to use `uart1` device; use `Serial2.` method to use `uart2` device; use `Serial3.` method to use `uart3` device. See [example](https://github.com/RTduino/RTduino/blob/master/examples/Basic/helloworld.cpp).
```Kconfig
RT-Thread online packages --->
Arduino libraries --->
[*] RTduino: Arduino Ecological Compatibility Layer
[*] Enable USB Serial
```
......@@ -18,6 +18,8 @@ Hardware Drivers Config --->
## 2 Arduino引脚排布
更多引脚布局相关信息参见 [pins_arduino.c](pins_arduino.c)[pins_arduino.h](pins_arduino.h)
![blue-pill-f103-pinout](blue-pill-f103-pinout.jpg)
| Arduino引脚编号 | STM32引脚编号 | 5V容忍 | 备注 |
......@@ -30,7 +32,7 @@ Hardware Drivers Config --->
| 5 (D5) | PA15 | 是 | PWM2-CH1,默认被RT-Thread的PWM设备框架pwm2接管 |
| 6 (D6) | PA8 | 是 | |
| 7 (D7, SS) | PB12 | 是 | SPI片选默认引脚 |
| 8 (D8, LED_BUILTIN) | PC13 | 否 | 板载LED |
| 8 (D8, LED_BUILTIN) | PC13 | 否 | 板载用户LED |
| 9 (D9) | PC14 | 否 | |
| 10 (D10) | PC15 | 否 | |
| 11 (D11) | PA0 | 否 | |
......@@ -40,12 +42,12 @@ Hardware Drivers Config --->
| 15 (D15) | PB8 | 是 | I2C-SCL,默认被RT-Thread的I2C设备框架i2c1总线接管 |
| 16 (D16) | PA12 | 是 | USB-DP,默认被 [TinyUSB软件包](https://github.com/RT-Thread-packages/tinyusb) 接管 |
| 17 (D17) | PA11 | 是 | USB-DM,默认被 [TinyUSB软件包](https://github.com/RT-Thread-packages/tinyusb) 接管 |
| 18 (D18) | PA10 | 是 | Serial-Rx,默认被RT-Thread的UART设备框架uart1接管 |
| 19 (D19) | PA9 | 是 | Serial-Tx,默认被RT-Thread的UART设备框架uart1接管 |
| 20 (D20) | PA2 | 否 | Serial2-Tx,默认被RT-Thread的UART设备框架uart2接管 |
| 21 (D21) | PA3 | 否 | Serial2-Rx,默认被RT-Thread的UART设备框架uart2接管 |
| 22 (D22) | PB10 | 是 | Serial3-Tx,默认被RT-Thread的UART设备框架uart3接管 |
| 23 (D23) | PB11 | 是 | Serial3-Rx,默认被RT-Thread的UART设备框架uart3接管 |
| 18 (D18) | PA10 | 是 | Serial-Rx,默认被RT-Thread的UART设备框架uart1接管 |
| 19 (D19) | PA9 | 是 | Serial-Tx,默认被RT-Thread的UART设备框架uart1接管 |
| 20 (D20) | PA2 | 否 | Serial2-Tx,默认被RT-Thread的UART设备框架uart2接管 |
| 21 (D21) | PA3 | 否 | Serial2-Rx,默认被RT-Thread的UART设备框架uart2接管 |
| 22 (D22) | PB10 | 是 | Serial3-Tx,默认被RT-Thread的UART设备框架uart3接管 |
| 23 (D23) | PB11 | 是 | Serial3-Rx,默认被RT-Thread的UART设备框架uart3接管 |
| 24 (D24) | PB15 | 是 | SPI-MOSI,默认被RT-Thread的SPI设备框架spi2接管 |
| 25 (D25) | PB14 | 是 | SPI-MISO,默认被RT-Thread的SPI设备框架spi2接管 |
| 26 (D26) | PB13 | 是 | SPI-SCK ,默认被RT-Thread的SPI设备框架spi2接管 |
......@@ -60,7 +62,6 @@ Hardware Drivers Config --->
> 注意:
>
> 1. 如果同时驱动舵机和调度analogWrite函数要选择不同定时器发生的PWM信号引脚,由于STM32的定时器4个通道需要保持相同的频率,如果采用相同的定时器发生的PWM分别驱动舵机和analogWrite,可能会导致舵机失效。
> 2. 更多引脚布局相关信息参见 [pins_arduino.c](pins_arduino.c) 和 [pins_arduino.h](pins_arduino.h)
## 3 通信
......@@ -72,10 +73,17 @@ I2C总线是 `D14` 和 `D15` 引脚,这两个引脚默认是被RT-Thread I2C
SPI总线是 `D24``D25``D26` 引脚,这三个引脚默认是被RT-Thread SPI设备框架接管的,直接引用`#include <SPI.h>`(Arduino官方SPI头文件)即可使用。此外,还使用到了片选引脚(SS),默认为 `D7`
### 3.3 USB
### 3.3 串口
默认支持USB虚拟串口,详见[例程](https://github.com/RTduino/RTduino/tree/master/examples/USBSerial)
默认支持通过 `Serial.` 方法调用 `uart1` 串口设备;通过 `Serial2.` 方法调用 `uart2` 串口设备;通过 `Serial3.` 方法调用 `uart3` 串口设备。详见[例程](https://github.com/RTduino/RTduino/blob/master/examples/Basic/helloworld.cpp)
### 3.4 串口
### 3.4 USB虚拟串口
默认支持通过 `Serial.` 方法调用 `uart1` 串口设备;通过 `Serial2.` 方法调用 `uart2` 串口设备;通过 `Serial3.` 方法调用 `uart3` 串口设备。详见[例程](https://github.com/RTduino/RTduino/blob/master/examples/Basic/helloworld.cpp)
本BSP支持USB虚拟串口,如果需要使用,可以手动使能。详见[例程](https://github.com/RTduino/RTduino/tree/master/examples/USBSerial)
```Kconfig
RT-Thread online packages --->
Arduino libraries --->
[*] RTduino: Arduino Ecological Compatibility Layer
[*] Enable USB Serial
```
# STM32F401 Nucleo开发板的Arduino生态兼容说明
# The Arduino Compatible for STM32F401 Nucleo Board
## 1 RTduino - RT-Thread的Arduino生态兼容层
**English** | [中文](README_zh.md)
STM32F401 Nucleo开发板已经完整适配了[RTduino软件包](https://github.com/RTduino/RTduino),即RT-Thread的Arduino生态兼容层。用户可以按照Arduino的编程习惯来操作该BSP,并且可以使用大量Arduino社区丰富的库,是对RT-Thread生态的极大增强。更多信息,请参见[RTduino软件包说明文档](https://github.com/RTduino/RTduino)
## 1 RTduino - Arduino Ecosystem Compatibility Layer for RT-Thread
### 1.1 如何开启针对本BSP的Arduino生态兼容层
STM32F401 Nucleo board has support [RTduino](https://github.com/RTduino/RTduino). Users can use Arduino APIs, third party libraries and programming method to program on Blue Pill board.
Env 工具下敲入 menuconfig 命令,或者 RT-Thread Studio IDE 下选择 RT-Thread Settings:
### 1.1 How to Enable RTduino
Please go to the [RTduino repository](https://github.com/RTduino/RTduino) to see the details.
```Kconfig
Hardware Drivers Config --->
......@@ -14,61 +16,58 @@ Hardware Drivers Config --->
[*] Compatible with Arduino Ecosystem (RTduino)
```
## 2 Arduino引脚排布
# 2 Arduino Pinout
![nucleo-f401-pinout](nucleo-f401-pinout.png)
该BSP遵照Arduino UNO板的引脚排列方式。详见 `pins_arduino.c`
| Arduino引脚编号 | STM32引脚编号 | 5V容忍 | 备注 |
| ----------- | --------- | ---- | --------------------------------------- |
| 0 (D0) | PA3 | | Serial2-Rx,默认被RT-Thread的UART设备框架uart2接管 |
| 1 (D1) | PA2 | | Serial2-Tx,默认被RT-Thread的UART设备框架uart2接管 |
| 2 (D2) | PA10 | 是 | |
| 3 (D3) | PB3 | 是 | PWM2-CH2,默认被RT-Thread的PWM设备框架pwm2接管 |
| 4 (D4) | PB5 | 是 | |
| 5 (D5) | PB4 | 是 | PWM3-CH1,默认被RT-Thread的PWM设备框架pwm3接管 |
| 6 (D6) | PB10 | 是 | PWM2-CH3,默认被RT-Thread的PWM设备框架pwm2接管 |
| 7 (D7) | PA8 | 是 | |
| 8 (D8) | PA9 | 是 | |
| 9 (D9) | PC7 | 是 | PWM3-CH2,默认被RT-Thread的PWM设备框架pwm3接管 |
| 10 (D10) | PB6 | 是 | PWM4-CH1,默认被RT-Thread的PWM设备框架pwm4接管 |
| 11 (D11) | PA7 | 是 | PWM1-CH1N,默认被RT-Thread的PWM设备框架pwm1接管 |
| 12 (D12) | PA6 | 是 | |
| 13 (D13) | PA5 | 是 | 板载LED |
| 14 (D14) | PB9 | 是 | I2C-SDA,默认被RT-Thread的I2C设备框架i2c1总线接管 |
| 15 (D15) | PB8 | 是 | I2C-SCL,默认被RT-Thread的I2C设备框架i2c1总线接管 |
| 16 (D16) | PC13 | 是 | 板载用户按键(左侧蓝色) |
| A0 | PA0 | 是 | ADC1-CH0,默认被RT-Thread的ADC设备框架adc1接管 |
| A1 | PA1 | 是 | ADC1-CH1,默认被RT-Thread的ADC设备框架adc1接管 |
| A2 | PA4 | 是 | ADC1-CH4,默认被RT-Thread的ADC设备框架adc1接管 |
| A3 | PB0 | 是 | ADC1-CH8,默认被RT-Thread的ADC设备框架adc1接管 |
| A4 | PC1 | 是 | ADC1-CH11,默认被RT-Thread的ADC设备框架adc1接管 |
| A5 | PC0 | 是 | ADC1-CH10,默认被RT-Thread的ADC设备框架adc1接管 |
| A6 | -- | | 芯片内部参考电压 ADC,默认被RT-Thread的ADC设备框架adc1接管 |
| A7 | -- | | 芯片内部温度 ADC,默认被RT-Thread的ADC设备框架adc1接管 |
> 注意:
This board complies with Arduino UNO pins layout. For more details, please take a look at: [pins_arduino.c](pins_arduino.c) and [pins_arduino.h](pins_arduino.h).
| Arduino Pin | STM32 Pin | 5V Tolerate | Note |
| --------------------- | --------- | ----------- | --------------------------------------------------------------------------------------------- |
| 0 (D0) | PA3 | Yes | Serial-Rx. Token over by RT-Thread UART device by default |
| 1 (D1) | PA2 | Yes | Serial-Tx. Token over by RT-Thread UART device by default |
| 2 (D2) | PA10 | Yes | |
| 3 (D3) | PB3 | Yes | PWM2-CH2. Token over by RT-Thread PWM device by default |
| 4 (D4) | PB5 | Yes | |
| 5 (D5) | PB4 | Yes | PWM3-CH1. Token over by RT-Thread PWM device by default |
| 6 (D6) | PB10 | Yes | PWM2-CH3. Token over by RT-Thread PWM device by default |
| 7 (D7) | PA8 | Yes | |
| 8 (D8) | PA9 | Yes | |
| 9 (D9) | PC7 | Yes | PWM3-CH2. Token over by RT-Thread PWM device by default |
| 10 (D10) | PB6 | Yes | PWM4-CH1. Token over by RT-Thread PWM device by default |
| 11 (D11) | PA7 | Yes | PWM1-CH1N. Token over by RT-Thread PWM device by default |
| 12 (D12) | PA6 | Yes | |
| 13 (D13, LED_BUILTIN) | PA5 | Yes | USER LED |
| 14 (D14) | PB9 | Yes | I2C-SDA. Token over by RT-Thread I2C device by default |
| 15 (D15) | PB8 | Yes | I2C-SCL. Token over by RT-Thread I2C device by default |
| 16 (D16) | PC13 | Yes | USER Button |
| A0 | PA0 | Yes | ADC1-CH0. Token over by RT-Thread ADC device by default |
| A1 | PA1 | Yes | ADC1-CH1. Token over by RT-Thread ADC device by default |
| A2 | PA4 | Yes | ADC1-CH4. Token over by RT-Thread ADC device by default |
| A3 | PB0 | Yes | ADC1-CH8. Token over by RT-Thread ADC device by default |
| A4 | PC1 | Yes | ADC1-CH11. Token over by RT-Thread ADC device by default |
| A5 | PC0 | Yes | ADC1-CH10. Token over by RT-Thread ADC device by default |
| A6 | -- | | On-chip internal voltage sensor. ADC1-CH17. Token over by RT-Thread ADC device by default |
| A7 | -- | | On-chip internal temperature sensor. ADC1-CH16. Token over by RT-Thread ADC device by default |
> Notice:
>
> 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%),直接正常使用即可。
> 1. Don't use a same hardware timer to drive PWM (analogRead) and servos at same time, because hardware timer can only generate a same frequency for 4 PWM channels. Otherwise, it could cause a failure when drive servos.
> 参考资料
> References
>
> 【1】[STM32 Nucleo-64板官方手册](https://www.st.com/resource/en/user_manual/um1724-stm32-nucleo64-boards-mb1136-stmicroelectronics.pdf)
> 1. [STM32 Nucleo-64 user manual](https://www.st.com/resource/en/user_manual/um1724-stm32-nucleo64-boards-mb1136-stmicroelectronics.pdf)
## 3 通信
## 3 Communication
### 3.1 I2C总线
### 3.1 I2C Bus
STM32F401 Nucleo板的I2C总线是板上丝印的 `SCL/D15``SDA/D14` 引脚,这两个引脚是被RT-Thread I2C设备框架接管的,不需要直接操控这两个引脚,直接引用`#include <Wire.h>`(Arduino官方I2C头文件)即可使用。
I2C bus is `SCL/D15` and `SDA/D14` pins. Users can directly include the `#include <Wire.h>`, which is the Arduino official I2C header file, to use the I2C bus.
### 3.2 SPI总线
### 3.2 SPI Bus
目前本BSP不支持使用Arduino的SPI功能。
This board doesn't support Arduino SPI header file and functions.
### 3.3 串口
### 3.3 Serial
本BSP通过 `Serial.` 方法调用 `uart2` 串口设备。详见[例程](https://github.com/RTduino/RTduino/blob/master/examples/Basic/helloworld.cpp)
This board supports to use `Serial.` method to operate `uart2` device. See [example](https://github.com/RTduino/RTduino/blob/master/examples/Basic/helloworld.cpp).
# STM32F401 Nucleo开发板的Arduino生态兼容说明
[English](README.md) | **中文**
## 1 RTduino - RT-Thread的Arduino生态兼容层
STM32F401 Nucleo开发板已经完整适配了[RTduino软件包](https://github.com/RTduino/RTduino),即RT-Thread的Arduino生态兼容层。用户可以按照Arduino的编程习惯来操作本BSP,并且可以使用大量Arduino社区丰富的库,是对RT-Thread生态的极大增强。更多信息,请参见[RTduino软件包说明文档](https://github.com/RTduino/RTduino)
### 1.1 如何开启针对本BSP的Arduino生态兼容层
Env 工具下敲入 menuconfig 命令,或者 RT-Thread Studio IDE 下选择 RT-Thread Settings:
```Kconfig
Hardware Drivers Config --->
Onboard Peripheral Drivers --->
[*] Compatible with Arduino Ecosystem (RTduino)
```
## 2 Arduino引脚排布
![nucleo-f401-pinout](nucleo-f401-pinout.png)
该BSP遵照Arduino UNO板的引脚排列方式,详见 [pins_arduino.c](pins_arduino.c)[pins_arduino.h](pins_arduino.h)
| Arduino引脚编号 | STM32引脚编号 | 5V容忍 | 备注 |
| ----------- | --------- | ---- | --------------------------------------------- |
| 0 (D0) | PA3 | 是 | Serial-Rx,默认被RT-Thread的UART设备框架uart2接管 |
| 1 (D1) | PA2 | 是 | Serial-Tx,默认被RT-Thread的UART设备框架uart2接管 |
| 2 (D2) | PA10 | 是 | |
| 3 (D3) | PB3 | 是 | PWM2-CH2,默认被RT-Thread的PWM设备框架pwm2接管 |
| 4 (D4) | PB5 | 是 | |
| 5 (D5) | PB4 | 是 | PWM3-CH1,默认被RT-Thread的PWM设备框架pwm3接管 |
| 6 (D6) | PB10 | 是 | PWM2-CH3,默认被RT-Thread的PWM设备框架pwm2接管 |
| 7 (D7) | PA8 | 是 | |
| 8 (D8) | PA9 | 是 | |
| 9 (D9) | PC7 | 是 | PWM3-CH2,默认被RT-Thread的PWM设备框架pwm3接管 |
| 10 (D10) | PB6 | 是 | PWM4-CH1,默认被RT-Thread的PWM设备框架pwm4接管 |
| 11 (D11) | PA7 | 是 | PWM1-CH1N,默认被RT-Thread的PWM设备框架pwm1接管 |
| 12 (D12) | PA6 | 是 | |
| 13 (D13, ) | PA5 | 是 | 板载用户LED |
| 14 (D14) | PB9 | 是 | I2C-SDA,默认被RT-Thread的I2C设备框架i2c1总线接管 |
| 15 (D15) | PB8 | 是 | I2C-SCL,默认被RT-Thread的I2C设备框架i2c1总线接管 |
| 16 (D16) | PC13 | 是 | 用户按键(左侧蓝色) |
| A0 | PA0 | 是 | ADC1-CH0,默认被RT-Thread的ADC设备框架adc1接管 |
| A1 | PA1 | 是 | ADC1-CH1,默认被RT-Thread的ADC设备框架adc1接管 |
| A2 | PA4 | 是 | ADC1-CH4,默认被RT-Thread的ADC设备框架adc1接管 |
| A3 | PB0 | 是 | ADC1-CH8,默认被RT-Thread的ADC设备框架adc1接管 |
| A4 | PC1 | 是 | ADC1-CH11,默认被RT-Thread的ADC设备框架adc1接管 |
| A5 | PC0 | 是 | ADC1-CH10,默认被RT-Thread的ADC设备框架adc1接管 |
| A6 | -- | | 芯片内部参考电压 ADC1-CH17,默认被RT-Thread的ADC设备框架adc1接管 |
| A7 | -- | | 芯片内部温度 ADC1-CH16,默认被RT-Thread的ADC设备框架adc1接管 |
> 注意:
>
> 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反相位引脚(互补输出引脚),但是这里不用考虑到占空比互补问题(CHx-20%,CHxN-80%),直接正常使用即可。
> 参考资料
>
> 1. [STM32 Nucleo-64板用户手册](https://www.st.com/resource/en/user_manual/um1724-stm32-nucleo64-boards-mb1136-stmicroelectronics.pdf)
## 3 通信
### 3.1 I2C总线
STM32F401 Nucleo板的I2C总线是板上丝印的 `SCL/D15``SDA/D14` 引脚,这两个引脚是被RT-Thread I2C设备框架接管的,不需要直接操控这两个引脚,直接引用`#include <Wire.h>`(Arduino官方I2C头文件)即可使用。
### 3.2 SPI总线
目前本BSP不支持使用Arduino的SPI功能。
### 3.3 串口
本BSP通过 `Serial.` 方法调用 `uart2` 串口设备。详见[例程](https://github.com/RTduino/RTduino/blob/master/examples/Basic/helloworld.cpp)
# STM32F412 Nucleo开发板的Arduino生态兼容说明
# The Arduino Compatible for STM32F412 Nucleo Board
## 1 RTduino - RT-Thread的Arduino生态兼容层
**English** | [中文](README_zh.md)
STM32F412 Nucleo开发板已经完整适配了[RTduino软件包](https://github.com/RTduino/RTduino),即RT-Thread的Arduino生态兼容层。用户可以按照Arduino的编程习惯来操作该BSP,并且可以使用大量Arduino社区丰富的库,是对RT-Thread生态的极大增强。更多信息,请参见[RTduino软件包说明文档](https://github.com/RTduino/RTduino)
## 1 RTduino - Arduino Ecosystem Compatibility Layer for RT-Thread
### 1.1 如何开启针对本BSP的Arduino生态兼容层
STM32F412 Nucleo board has support [RTduino](https://github.com/RTduino/RTduino). Users can use Arduino APIs, third party libraries and programming method to program on the board.
Env 工具下敲入 menuconfig 命令,或者 RT-Thread Studio IDE 下选择 RT-Thread Settings:
### 1.1 How to Enable RTduino
Please go to the [RTduino repository](https://github.com/RTduino/RTduino) to see the details.
```Kconfig
Hardware Drivers Config --->
......@@ -14,62 +16,61 @@ Hardware Drivers Config --->
[*] Compatible with Arduino Ecosystem (RTduino)
```
## 2 Arduino引脚排布
## 2 Arduino Pinout
![nucleo-f412-pinout](nucleo-f412-pinout.png)
该BSP遵照Arduino UNO板的引脚排列方式。详见 `pins_arduino.c`
| Arduino引脚编号 | STM32引脚编号 | 5V容忍 | 备注 |
| ----------- | --------- | ---- | -------------------------------------- |
| 0 (D0) | PG9 | 是 | Serial-Rx,默认被RT-Thread的UART设备框架uart3接管 |
| 1 (D1) | PG14 | 是 | Serial-tx,默认被RT-Thread的UART设备框架uart3接管 |
| 2 (D2) | PF15 | 是 | |
| 3 (D3) | PE13 | 是 | PWM(定时器1发生) |
| 4 (D4) | PF14 | 是 | |
| 5 (D5) | PE11 | 是 | PWM(定时器1发生) |
| 6 (D6) | PE9 | 是 | PWM(定时器1发生) |
| 7 (D7) | PF13 | 是 | |
| 8 (D8) | PF12 | 是 | |
| 9 (D9) | PD15 | 是 | PWM(定时器4发生) |
| 10 (D10) | PD14 | 是 | PWM(定时器4发生) |
| 11 (D11) | PA7 | 是 | PWM(定时器14发生) |
| 12 (D12) | PA6 | 是 | |
| 13 (D13) | PA5 | 是 | |
| 14 (D14) | PB9 | 是 | 默认为I2C1-SDA,被RT-Thread的I2C设备框架i2c1总线接管 |
| 15 (D15) | PB8 | 是 | 默认为I2C1-SCL,被RT-Thread的I2C设备框架i2c1总线接管 |
| 16 (D16) | PC13 | 是 | 板载用户按键(左侧蓝色) |
| 17 (D17) | PB0 | 是 | 板载用户LED1 (LED_BUILTIN) |
| 18 (D18) | PB7 | 是 | 板载用户LED2 |
| 19 (D19) | PB14 | 是 | 板载用户LED3 |
| A0 | PA3 | 是 | ADC |
| A1 | PC0 | 是 | ADC |
| A2 | PC3 | 是 | ADC |
| A3 | PC1 | 是 | ADC |
| A4 | PC4 | 是 | ADC |
| A5 | PC5 | 是 | ADC |
| A6 | -- | | 芯片内部参考电压 ADC |
| A7 | -- | | 芯片内部温度 ADC |
> 注意:
This board complies with Arduino UNO pins layout. For more details, please take a look at: [pins_arduino.c](pins_arduino.c) and [pins_arduino.h](pins_arduino.h).
| Arduino引脚编号 | STM32引脚编号 | 5V容忍 | 备注 |
| --------------------- | --------- | ---- | --------------------------------------------------------------------------------------------- |
| 0 (D0) | PG9 | Yes | Serial-Rx. Token over by RT-Thread UART device by default |
| 1 (D1) | PG14 | Yes | Serial-Tx. Token over by RT-Thread UART device by default |
| 2 (D2) | PF15 | Yes | |
| 3 (D3) | PE13 | Yes | PWM1-CH3. Token over by RT-Thread PWM device by default |
| 4 (D4) | PF14 | Yes | |
| 5 (D5) | PE11 | Yes | PWM1-CH2. Token over by RT-Thread PWM device by default |
| 6 (D6) | PE9 | Yes | PWM1-CH1. Token over by RT-Thread PWM device by default |
| 7 (D7) | PF13 | Yes | |
| 8 (D8) | PF12 | Yes | |
| 9 (D9) | PD15 | Yes | PWM4-CH4. Token over by RT-Thread PWM device by default |
| 10 (D10) | PD14 | Yes | PWM4-CH3. Token over by RT-Thread PWM device by default |
| 11 (D11) | PA7 | Yes | PWM14-CH1. Token over by RT-Thread PWM device by default |
| 12 (D12) | PA6 | Yes | |
| 13 (D13) | PA5 | Yes | |
| 14 (D14) | PB9 | Yes | I2C1-SDA. Token over by RT-Thread I2C device by default |
| 15 (D15) | PB8 | Yes | I2C1-SCL. Token over by RT-Thread I2C device by default |
| 16 (D16) | PC13 | Yes | USER Button |
| 17 (D17, LED_BUILTIN) | PB0 | Yes | USER LED1 |
| 18 (D18) | PB7 | Yes | USER LED2 |
| 19 (D19) | PB14 | Yes | USER LED3 |
| A0 | PA3 | Yes | ADC1-CH3. Token over by RT-Thread ADC device by default |
| A1 | PC0 | Yes | ADC1-CH10. Token over by RT-Thread ADC device by default |
| A2 | PC3 | Yes | ADC1-CH13. Token over by RT-Thread ADC device by default |
| A3 | PC1 | Yes | ADC1-CH11. Token over by RT-Thread ADC device by default |
| A4 | PC4 | Yes | ADC1-CH14. Token over by RT-Thread ADC device by default |
| A5 | PC5 | Yes | ADC1-CH15. Token over by RT-Thread ADC device by default |
| A6 | -- | | On-chip internal voltage sensor. ADC1-CH17. Token over by RT-Thread ADC device by default |
| A7 | -- | | On-chip internal temperature sensor. ADC1-CH16. Token over by RT-Thread ADC device by default |
> Notice:
>
> 1. 驱动舵机和analogWrite函数要选择不同定时器发生的PWM信号引脚,由于STM32的定时器4个通道需要保持相同的频率,如果采用相同的定时器发生的PWM分别驱动舵机和analogWrite,可能会导致舵机失效。
> 2. Nucleo板的Arduino接口中AVDD(即AREF)默认是与VDD相连的,如果需要扩展板提供外部参考电压,需要将SB57锡桥挑开。
> 1. Don't use a same hardware timer to drive PWM (analogRead) and servos at same time, because hardware timer can only generate a same frequency for 4 PWM channels. Otherwise, it could cause a failure when drive servos.
> 参考资料
> References
>
> 【1】[STM32 Nucleo-144板官方手册](https://www.st.com/resource/en/user_manual/um1974-stm32-nucleo144-boards-mb1137-stmicroelectronics.pdf)
> 1. [STM32 Nucleo-144 user manual](https://www.st.com/resource/en/user_manual/um1974-stm32-nucleo144-boards-mb1137-stmicroelectronics.pdf)
## 3 通信
## 3 Communication
### 3.1 I2C总线
### 3.1 I2C Bus
I2C总线是板上丝印的 `SCL/D15``SDA/D14` 引脚,这两个引脚默认是被RT-Thread I2C设备框架接管的,直接引用`#include <Wire.h>`(Arduino官方I2C头文件)即可使用。
I2C bus is `SCL/D15` and `SDA/D14` pins. Users can directly include the `#include <Wire.h>`, which is the Arduino official I2C header file, to use the I2C bus.
### 3.2 SPI总线
### 3.2 SPI Bus
目前本BSP不支持使用Arduino的SPI功能。
This board doesn't support Arduino SPI header file and functions.
### 3.3 串口
### 3.3 Serial
本BSP通过 `Serial.` 方法调用 `uart3` 串口设备。详见[例程](https://github.com/RTduino/RTduino/blob/master/examples/Basic/helloworld.cpp)
This board supports to use `Serial.` method to operate `uart3` device. See [example](https://github.com/RTduino/RTduino/blob/master/examples/Basic/helloworld.cpp).
# STM32F412 Nucleo开发板的Arduino生态兼容说明
## 1 RTduino - RT-Thread的Arduino生态兼容层
STM32F412 Nucleo开发板已经完整适配了[RTduino软件包](https://github.com/RTduino/RTduino),即RT-Thread的Arduino生态兼容层。用户可以按照Arduino的编程习惯来操作本BSP,并且可以使用大量Arduino社区丰富的库,是对RT-Thread生态的极大增强。更多信息,请参见[RTduino软件包说明文档](https://github.com/RTduino/RTduino)
### 1.1 如何开启针对本BSP的Arduino生态兼容层
Env 工具下敲入 menuconfig 命令,或者 RT-Thread Studio IDE 下选择 RT-Thread Settings:
```Kconfig
Hardware Drivers Config --->
Onboard Peripheral Drivers --->
[*] Compatible with Arduino Ecosystem (RTduino)
```
## 2 Arduino引脚排布
![nucleo-f412-pinout](nucleo-f412-pinout.png)
该BSP遵照Arduino UNO板的引脚排列方式,详见 [pins_arduino.c](pins_arduino.c)[pins_arduino.h](pins_arduino.h)
| Arduino引脚编号 | STM32引脚编号 | 5V容忍 | 备注 |
| --------------------- | --------- | ---- | --------------------------------------------- |
| 0 (D0) | PG9 | 是 | Serial-Rx,默认被RT-Thread的UART设备框架uart3接管 |
| 1 (D1) | PG14 | 是 | Serial-Tx,默认被RT-Thread的UART设备框架uart3接管 |
| 2 (D2) | PF15 | 是 | |
| 3 (D3) | PE13 | 是 | PWM1-CH3,默认被RT-Thread的PWM设备框架pwm1接管 |
| 4 (D4) | PF14 | 是 | |
| 5 (D5) | PE11 | 是 | PWM1-CH2,默认被RT-Thread的PWM设备框架pwm1接管 |
| 6 (D6) | PE9 | 是 | PWM1-CH1,默认被RT-Thread的PWM设备框架pwm1接管 |
| 7 (D7) | PF13 | 是 | |
| 8 (D8) | PF12 | 是 | |
| 9 (D9) | PD15 | 是 | PWM4-CH4,默认被RT-Thread的PWM设备框架pwm4接管 |
| 10 (D10) | PD14 | 是 | PWM4-CH3,默认被RT-Thread的PWM设备框架pwm4接管 |
| 11 (D11) | PA7 | 是 | PWM14-CH1,默认被RT-Thread的PWM设备框架pwm14接管 |
| 12 (D12) | PA6 | 是 | |
| 13 (D13) | PA5 | 是 | |
| 14 (D14) | PB9 | 是 | I2C1-SDA,默认被RT-Thread的I2C设备框架i2c1总线接管 |
| 15 (D15) | PB8 | 是 | I2C1-SCL,默认被RT-Thread的I2C设备框架i2c1总线接管 |
| 16 (D16) | PC13 | 是 | 板载用户按键(左侧蓝色) |
| 17 (D17, LED_BUILTIN) | PB0 | 是 | 板载用户LED1 |
| 18 (D18) | PB7 | 是 | 板载用户LED2 |
| 19 (D19) | PB14 | 是 | 板载用户LED3 |
| A0 | PA3 | 是 | ADC1-CH3,默认被RT-Thread的ADC设备框架adc1接管 |
| A1 | PC0 | 是 | ADC1-CH10,默认被RT-Thread的ADC设备框架adc1接管 |
| A2 | PC3 | 是 | ADC1-CH13,默认被RT-Thread的ADC设备框架adc1接管 |
| A3 | PC1 | 是 | ADC1-CH11,默认被RT-Thread的ADC设备框架adc1接管 |
| A4 | PC4 | 是 | ADC1-CH14,默认被RT-Thread的ADC设备框架adc1接管 |
| A5 | PC5 | 是 | ADC1-CH15,默认被RT-Thread的ADC设备框架adc1接管 |
| A6 | -- | | 芯片内部参考电压 ADC1-CH17,默认被RT-Thread的ADC设备框架adc1接管 |
| A7 | -- | | 芯片内部温度 ADC1-CH16,默认被RT-Thread的ADC设备框架adc1接管 |
> 注意:
>
> 1. 驱动舵机和analogWrite函数要选择不同定时器发生的PWM信号引脚,由于STM32的定时器4个通道需要保持相同的频率,如果采用相同的定时器发生的PWM分别驱动舵机和analogWrite,可能会导致舵机失效。
> 2. Nucleo板的Arduino接口中AVDD(即AREF)默认是与VDD相连的,如果需要扩展板提供外部参考电压,需要将SB57锡桥挑开。
> 参考资料
>
> 1. [STM32 Nucleo-144板用户手册](https://www.st.com/resource/en/user_manual/um1974-stm32-nucleo144-boards-mb1137-stmicroelectronics.pdf)
## 3 通信
### 3.1 I2C总线
I2C总线是板上丝印的 `SCL/D15``SDA/D14` 引脚,这两个引脚默认是被RT-Thread I2C设备框架接管的,直接引用`#include <Wire.h>`(Arduino官方I2C头文件)即可使用。
### 3.2 SPI总线
目前本BSP不支持使用Arduino的SPI功能。
### 3.3 串口
本BSP通过 `Serial.` 方法调用 `uart3` 串口设备。详见[例程](https://github.com/RTduino/RTduino/blob/master/examples/Basic/helloworld.cpp)
### 3.4 USB虚拟串口
本BSP支持USB虚拟串口,如果需要使用,可以手动使能。详见[例程](https://github.com/RTduino/RTduino/tree/master/examples/USBSerial)
```Kconfig
RT-Thread online packages --->
Arduino libraries --->
[*] RTduino: Arduino Ecological Compatibility Layer
[*] Enable USB Serial
```
# STM32F469 Discovery开发板的Arduino生态兼容说明
# The Arduino Compatible for STM32F469 Discovery Board
## 1 RTduino - RT-Thread的Arduino生态兼容层
**English** | [中文](README_zh.md)
STM32F469 Discovery开发板已经完整适配了[RTduino软件包](https://github.com/RTduino/RTduino),即RT-Thread的Arduino生态兼容层。用户可以按照Arduino的编程习惯来操作该BSP,并且可以使用大量Arduino社区丰富的库,是对RT-Thread生态的极大增强。更多信息,请参见[RTduino软件包说明文档](https://github.com/RTduino/RTduino)
## 1 RTduino - Arduino Ecosystem Compatibility Layer for RT-Thread
### 1.1 如何开启针对本BSP的Arduino生态兼容层
STM32F469 Discovery board has support [RTduino](https://github.com/RTduino/RTduino). Users can use Arduino APIs, third party libraries and programming method to program on the board.
Env 工具下敲入 menuconfig 命令,或者 RT-Thread Studio IDE 下选择 RT-Thread Settings:
### 1.1 How to Enable RTduino
Please go to the [RTduino repository](https://github.com/RTduino/RTduino) to see the details.
```Kconfig
Hardware Drivers Config --->
......@@ -14,63 +16,73 @@ Hardware Drivers Config --->
[*] Compatible with Arduino Ecosystem (RTduino)
```
## 2 Arduino引脚排布
## 2 Arduino Pinout
![disco-f469-pinout](disco-f469-pinout.png)
该BSP遵照Arduino UNO板的引脚排列方式。详见 `pins_arduino.c`
| Arduino引脚编号 | STM32引脚编号 | 5V容忍 | 备注 |
| --------------- | ------------- | ------ | ------------------------------------------------------------ |
| 0 (D0) | PG9 | 是 | Serial-Rx,默认被RT-Thread的UART设备框架uart6接管 |
| 1 (D1) | PG14 | 是 | Serial-Tx,默认被RT-Thread的UART设备框架uart6接管 |
| 2 (D2) | PG13 | 是 | |
| 3 (D3) | PA1 | 是 | PWM(定时器2发生) |
| 4 (D4) | PG12 | 是 | |
| 5 (D5) | PA2 | 是 | PWM(定时器2发生) |
| 6 (D6) | PA6 | 是 | PWM(定时器3发生) |
| 7 (D7) | PG11 | 是 | |
| 8 (D8) | PG10 | 是 | |
| 9 (D9) | PA7 | 是 | PWM(定时器3发生) |
| 10 (D10) | PH6 | 是 | PWM(定时器12发生) |
| 11 (D11) | PB15 | 是 | PWM(定时器12发生) |
| 12 (D12) | PB14 | 是 | |
| 13 (D13) | PD3 | 是 | LED_BUILTIN |
| 14 (D14) | PB9 | 是 | I2C1-SDA,被RT-Thread的I2C设备框架i2c1总线接管,不可当做普通IO |
| 15 (D15) | PB8 | 是 | I2C1_SCL,被RT-Thread的I2C设备框架i2c1总线接管,不可当做普通IO |
| 16 (D16) | PA0 | 是 | Discovery板载用户按键(蓝色) |
| 17(D17) | PG6 | 是 | user LED1(用户LED) |
| 18(D18) | PD4 | 是 | user LED2(用户LED) |
| 19(D19) | PD5 | 是 | user LED3(用户LED) |
| 20(D20) | PK3 | 是 | user LED4(用户LED) |
| A0 | PB1 | 是 | ADC Channel_9 |
| A1 | PC2 | 是 | ADC Channel_12 |
| A2 | PC3 | 是 | ADC Channel_13 |
| A3 | PC4 | 是 | ADC Channel_14 |
| A4 | PC5 | 是 | ADC Channel_15 |
| A5 | PA4 | 是 | ADC Channel_4 |
| A6 | -- | | 芯片内部参考电压 ADC |
| A7 | -- | | 芯片内部温度 ADC |
> 注意:
>
> - 暂无
> 参考资料
>
> 【1】[STM32F469 Discovery官方资料](https://www.st.com/en/evaluation-tools/32f469idiscovery.html#documentation)
## 3 通信
### 3.1 I2C总线
STM32F469 Discovery板的I2C总线是板上丝印的 `SCL/D15``SDA/D14` 引脚,这两个引脚是被RT-Thread I2C设备框架接管的,不需要直接操控这两个引脚,直接引用`#include <Wire.h>`(Arduino官方I2C头文件)即可使用。
### 3.2 SPI总线
目前本BSP不支持使用Arduino的SPI功能。
### 3.3 串口
本BSP通过 `Serial.` 方法调用 `uart2` 串口设备。详见[例程](https://github.com/RTduino/RTduino/blob/master/examples/Basic/helloworld.cpp)
This board complies with Arduino UNO pins layout. For more details, please take a look at: [pins_arduino.c](pins_arduino.c) and [pins_arduino.h](pins_arduino.h).
| Arduino Pin | STM32 Pin | 5V Tolerate | Note |
| ----------- | --------- | ----------- | --------------------------------------------------------------------------------------------- |
| 0 (D0) | PG9 | Yes | Serial-Rx. Token over by RT-Thread UART device by default |
| 1 (D1) | PG14 | Yes | Serial-Tx. Token over by RT-Thread UART device by default |
| 2 (D2) | PG13 | Yes | |
| 3 (D3) | PA1 | Yes | PWM2-CH2. Token over by RT-Thread PWM device by default |
| 4 (D4) | PG12 | Yes | |
| 5 (D5) | PA2 | Yes | PWM2-CH3. Token over by RT-Thread PWM device by default |
| 6 (D6) | PA6 | Yes | PWM3-CH1. Token over by RT-Thread PWM device by default |
| 7 (D7) | PG11 | Yes | |
| 8 (D8) | PG10 | Yes | |
| 9 (D9) | PA7 | Yes | PWM3-CH2. Token over by RT-Thread PWM device by default |
| 10 (D10) | PH6 | Yes | PWM12-CH1. Token over by RT-Thread PWM device by default |
| 11 (D11) | PB15 | Yes | PWM12-CH2. Token over by RT-Thread PWM device by default |
| 12 (D12) | PB14 | Yes | |
| 13 (D13, ) | PD3 | Yes | USER LED1 |
| 14 (D14) | PB9 | Yes | I2C1-SDA. Token over by RT-Thread I2C device by default |
| 15 (D15) | PB8 | Yes | I2C1-SCL. Token over by RT-Thread I2C device by default |
| 16 (D16) | PA0 | Yes | USER Button |
| 17(D17) | PG6 | Yes | USER LED2 |
| 18(D18) | PD4 | Yes | USER LED3 |
| 19(D19) | PD5 | Yes | USER LED4 |
| 20(D20) | PK3 | Yes | USER LED5 |
| A0 | PB1 | Yes | ADC1-CH9. Token over by RT-Thread ADC device by default |
| A1 | PC2 | Yes | ADC1-CH12. Token over by RT-Thread ADC device by default |
| A2 | PC3 | Yes | ADC1-CH13. Token over by RT-Thread ADC device by default |
| A3 | PC4 | Yes | ADC1-CH14. Token over by RT-Thread ADC device by default |
| A4 | PC5 | Yes | ADC1-CH15. Token over by RT-Thread ADC device by default |
| A5 | PA4 | Yes | ADC1-CH4. Token over by RT-Thread ADC device by default |
| A6 | -- | | On-chip internal voltage sensor. ADC1-CH17. Token over by RT-Thread ADC device by default |
| A7 | -- | | On-chip internal temperature sensor. ADC1-CH16. Token over by RT-Thread ADC device by default |
> Notice:
>
> 1. Don't use a same hardware timer to drive PWM (analogRead) and servos at same time, because hardware timer can only generate a same frequency for 4 PWM channels. Otherwise, it could cause a failure when drive servos.
> References
>
> 1. [STM32F469 Discovery ST Website](https://www.st.com/en/evaluation-tools/32f469idiscovery.html#documentation)
## 3 Communication
### 3.1 I2C Bus
I2C bus is `SCL/D15` and `SDA/D14` pins. Users can directly include the `#include <Wire.h>`, which is the Arduino official I2C header file, to use the I2C bus.
### 3.2 SPI Bus
This board doesn't support Arduino SPI header file and functions.
### 3.3 Serial
This board supports to use `Serial.` method to operate `uart3` device. See [example](https://github.com/RTduino/RTduino/blob/master/examples/Basic/helloworld.cpp).
### 3.4 USB Virtual Serial
This board supports USB virtual serial. See [example](https://github.com/RTduino/RTduino/tree/master/examples/USBSerial). You may enable it if is needed.
```Kconfig
RT-Thread online packages --->
Arduino libraries --->
[*] RTduino: Arduino Ecological Compatibility Layer
[*] Enable USB Serial
```
# STM32F469 Discovery开发板的Arduino生态兼容说明
[English](README.md) | **中文**
## 1 RTduino - RT-Thread的Arduino生态兼容层
STM32F469 Discovery开发板已经完整适配了[RTduino软件包](https://github.com/RTduino/RTduino),即RT-Thread的Arduino生态兼容层。用户可以按照Arduino的编程习惯来操作该BSP,并且可以使用大量Arduino社区丰富的库,是对RT-Thread生态的极大增强。更多信息,请参见[RTduino软件包说明文档](https://github.com/RTduino/RTduino)
### 1.1 如何开启针对本BSP的Arduino生态兼容层
Env 工具下敲入 menuconfig 命令,或者 RT-Thread Studio IDE 下选择 RT-Thread Settings:
```Kconfig
Hardware Drivers Config --->
Onboard Peripheral Drivers --->
[*] Compatible with Arduino Ecosystem (RTduino)
```
## 2 Arduino引脚排布
![disco-f469-pinout](disco-f469-pinout.png)
该BSP遵照Arduino UNO板的引脚排列方式,详见 [pins_arduino.c](pins_arduino.c)[pins_arduino.h](pins_arduino.h)
| Arduino引脚编号 | STM32引脚编号 | 5V容忍 | 备注 |
| ----------- | --------- | ---- | --------------------------------------------- |
| 0 (D0) | PG9 | 是 | Serial-Rx,默认被RT-Thread的UART设备框架uart3接管 |
| 1 (D1) | PG14 | 是 | Serial-Tx,默认被RT-Thread的UART设备框架uart3接管 |
| 2 (D2) | PG13 | 是 | |
| 3 (D3) | PA1 | 是 | PWM2-CH2,默认被RT-Thread的PWM设备框架pwm2接管 |
| 4 (D4) | PG12 | 是 | |
| 5 (D5) | PA2 | 是 | PWM2-CH3,默认被RT-Thread的PWM设备框架pwm2接管 |
| 6 (D6) | PA6 | 是 | PWM3-CH1,默认被RT-Thread的PWM设备框架pwm3接管 |
| 7 (D7) | PG11 | 是 | |
| 8 (D8) | PG10 | 是 | |
| 9 (D9) | PA7 | 是 | PWM3-CH2,默认被RT-Thread的PWM设备框架pwm3接管 |
| 10 (D10) | PH6 | 是 | PWM12-CH1,默认被RT-Thread的PWM设备框架pwm12接管 |
| 11 (D11) | PB15 | 是 | PWM12-CH2,默认被RT-Thread的PWM设备框架pwm12接管 |
| 12 (D12) | PB14 | 是 | |
| 13 (D13, ) | PD3 | 是 | 板载用户LED1 |
| 14 (D14) | PB9 | 是 | I2C1-SDA,被RT-Thread的I2C设备框架i2c1总线接管 |
| 15 (D15) | PB8 | 是 | I2C1-SCL,被RT-Thread的I2C设备框架i2c1总线接管 |
| 16 (D16) | PA0 | 是 | 板载用户按键 |
| 17(D17) | PG6 | 是 | 板载用户LED2 |
| 18(D18) | PD4 | 是 | 板载用户LED3 |
| 19(D19) | PD5 | 是 | 板载用户LED4 |
| 20(D20) | PK3 | 是 | 板载用户LED5 |
| A0 | PB1 | 是 | ADC1-CH9,默认被RT-Thread的ADC设备框架adc1接管 |
| A1 | PC2 | 是 | ADC1-CH12,默认被RT-Thread的ADC设备框架adc1接管 |
| A2 | PC3 | 是 | ADC1-CH13,默认被RT-Thread的ADC设备框架adc1接管 |
| A3 | PC4 | 是 | ADC1-CH14,默认被RT-Thread的ADC设备框架adc1接管 |
| A4 | PC5 | 是 | ADC1-CH15,默认被RT-Thread的ADC设备框架adc1接管 |
| A5 | PA4 | 是 | ADC1-CH4,默认被RT-Thread的ADC设备框架adc1接管 |
| A6 | -- | | 芯片内部参考电压 ADC1-CH17,默认被RT-Thread的ADC设备框架adc1接管 |
| A7 | -- | | 芯片内部温度 ADC1-CH16,默认被RT-Thread的ADC设备框架adc1接管 |
> 注意:
>
> 1. 驱动舵机和analogWrite函数要选择不同定时器发生的PWM信号引脚,由于STM32的定时器4个通道需要保持相同的频率,如果采用相同的定时器发生的PWM分别驱动舵机和analogWrite,可能会导致舵机失效。
> 参考资料
>
> 1. [STM32F469 Discovery官方资料](https://www.st.com/zh/evaluation-tools/32f469idiscovery.html#documentation)
## 3 通信
### 3.1 I2C总线
本BSP的I2C总线是板上丝印的 `SCL/D15``SDA/D14` 引脚,这两个引脚是被RT-Thread I2C设备框架接管的,不需要直接操控这两个引脚,直接引用`#include <Wire.h>`(Arduino官方I2C头文件)即可使用。
### 3.2 SPI总线
目前本BSP不支持使用Arduino的SPI功能。
### 3.3 串口
本BSP通过 `Serial.` 方法调用 `uart3` 串口设备。详见[例程](https://github.com/RTduino/RTduino/blob/master/examples/Basic/helloworld.cpp)
### 3.4 USB虚拟串口
本BSP支持USB虚拟串口,如果需要使用,可以手动使能。详见[例程](https://github.com/RTduino/RTduino/tree/master/examples/USBSerial)
```Kconfig
RT-Thread online packages --->
Arduino libraries --->
[*] RTduino: Arduino Ecological Compatibility Layer
[*] Enable USB Serial
```
......@@ -21,8 +21,8 @@
*/
const pin_map_t pin_map_table[]=
{
{D0, GET_PIN(G,9), "uart6"}, /* Serial-Rx */
{D1, GET_PIN(G,14), "uart6"}, /* Serial-Tx */
{D0, GET_PIN(G,9), "uart3"}, /* Serial-Rx */
{D1, GET_PIN(G,14), "uart3"}, /* Serial-Tx */
{D2, GET_PIN(G,13)},
{D3, GET_PIN(A,1), "pwm2", 2}, /* PWM */
{D4, GET_PIN(G,12)},
......
......@@ -8,6 +8,12 @@ config SOC_STM32F469NI
default y
menu "Onboard Peripheral Drivers"
config BSP_USING_STLINK_TO_USART
bool "Enable STLINK TO USART (uart3)"
select BSP_USING_UART
select BSP_USING_UART3
default y
config BSP_USING_LVGL
bool "Enable LVGL for LCD"
select BSP_USING_LCD_OTM8009A
......@@ -177,11 +183,11 @@ menu "On-chip Peripheral Drivers"
menuconfig BSP_USING_UART
bool "Enable UART"
select RT_USING_SERIAL
default y
default n
if BSP_USING_UART
config BSP_USING_UART3
bool "Enable UART3"
default y
default n
config BSP_UART3_RX_USING_DMA
bool "Enable UART3 RX DMA"
......
......@@ -20,49 +20,51 @@ Hardware Drivers Config --->
### 2.1 Arduino引脚排布统览
| Arduino引脚编号 | STM32引脚编号 | 5V容忍 | 备注 |
| --------------------- | --------- | ------- | -------------------------------------- |
| 0 (D0) | PA10 | 是 | Serial-Rx,被RT-Thread的UART设备框架uart1接管 |
| 1 (D1) | PA9 | 是 | Serial-Tx,被RT-Thread的UART设备框架uart1接管 |
| 2 (D2) | PB9 | 是 | 普通IO |
| 3 (D3) | PD15 | 是 | PWM(定时器4发生) |
| 4 (D4) | PA8 | 是 | 普通IO |
| 5 (D5) | PD14 | 是 | 普通IO |
| 6 (D6) | PB11 | 是 | PWM(定时器2发生) |
| 7 (D7) | PB14 | 是 | 普通IO |
| 8 (D8) | PB12 | 是 | 普通IO |
| 9 (D9) | PD12 | 是 | PWM(定时器4发生) |
| 10 (D10) | PB10 | 是 | PWM(定时器2发生) |
| 11 (D11) | PB8 | 是 | PWM(定时器4发生) |
| 12 (D12) | PB15 | 是 | 普通IO |
| 13 (D13) | PB13 | 是 | 普通IO |
| 14 (D14) | PA1 | 是 | 振动电机-A |
| 15 (D15) | PA0 | 是 | 振动电机-B |
| 16 (D16) | PB2 | 是 | 蜂鸣器 |
| 17 (D17) | PD10 | 是 | KEY0 |
| 18 (D18) | PD9 | 是 | KEY1 |
| 19 (D19) | PD8 | 是 | KEY2 |
| 20 (D20) | PC13 | 是 | KEY-WKUP |
| 21 (D21) | PE7 | 是 | 红色LED |
| 22 (D22, LED_BUILTIN) | PE8 | 是 | 绿色LED,Arduino默认LED |
| 23 (D23) | PE9 | 是 | 蓝色LED,具有PWM功能(定时器1发生) |
| 24 (D24) | PB0 | 3.6V容忍 | 红外发送 |
| 25 (D25) | PB1 | 是 | 红外接收 |
| 26 (D26) | PD4 | 是 | 无线模块 CE |
| 27 (D27) | PD3 | 是 | 无线模块 中断 |
| 28 (D28, SS) | PD5 | 是 | 无线模块 片选 CS |
| 29 (D29) | PB13 | | SPI2-SCK,默认被RT-Thread的SPI设备框架spi2总线接管 |
| 30 (D30) | PB14 | | SPI2-MISO,默认被RT-Thread的SPI设备框架spi2总线接管 |
| 31 (D31) | PB15 | | SPI2-MOSI,默认被RT-Thread的SPI设备框架spi2总线接管 |
| 32 (D32) | PC7 | 是 | I2C1-SDA,默认被RT-Thread的I2C设备框架i2c1总线接管 |
| 33 (D33) | PC6 | 是 | I2C1-SCL,默认被RT-Thread的I2C设备框架i2c1总线接管 |
| 34 (D34) | PA2 | | Serial2-Tx,默认被RT-Thread的UART设备框架uart2接管 |
| 35 (D35) | PA3 | | Serial2-Rx,默认被RT-Thread的UART设备框架uart2接管 |
| A0 | PC2 | 是(但不建议) | ADC |
| A1 | PC4 | 是(但不建议) | ADC |
| A2 | -- | | 芯片内部参考电压 ADC |
| A3 | -- | | 芯片内部温度 ADC |
| DAC0 | PA4 | 3.6V容忍 | 真模拟输出 DAC |
更多引脚布局相关信息参见 [pins_arduino.c](pins_arduino.c)[pins_arduino.h](pins_arduino.h)
| Arduino引脚编号 | STM32引脚编号 | 5V容忍 | 备注 |
| --------------------- | --------- | ------- | -------------------------------------------- |
| 0 (D0) | PA10 | 是 | Serial-Rx,被RT-Thread的UART设备框架uart1接管 |
| 1 (D1) | PA9 | 是 | Serial-Tx,被RT-Thread的UART设备框架uart1接管 |
| 2 (D2) | PB9 | 是 | 普通IO |
| 3 (D3) | PD15 | 是 | PWM4-CH4,默认被RT-Thread的PWM设备框架pwm4接管 |
| 4 (D4) | PA8 | 是 | 普通IO |
| 5 (D5) | PD14 | 是 | 普通IO |
| 6 (D6) | PB11 | 是 | PWM2-CH4,默认被RT-Thread的PWM设备框架pwm2接管 |
| 7 (D7) | PB14 | 是 | 普通IO |
| 8 (D8) | PB12 | 是 | 普通IO |
| 9 (D9) | PD12 | 是 | PWM4-CH1,默认被RT-Thread的PWM设备框架pwm4接管 |
| 10 (D10) | PB10 | 是 | PWM2-CH3,默认被RT-Thread的PWM设备框架pwm2接管 |
| 11 (D11) | PB8 | 是 | PWM4-CH3,默认被RT-Thread的PWM设备框架pwm4接管 |
| 12 (D12) | PB15 | 是 | 普通IO |
| 13 (D13) | PB13 | 是 | 普通IO |
| 14 (D14) | PA1 | 是 | 振动电机-A |
| 15 (D15) | PA0 | 是 | 振动电机-B |
| 16 (D16) | PB2 | 是 | 蜂鸣器 |
| 17 (D17) | PD10 | 是 | KEY0 |
| 18 (D18) | PD9 | 是 | KEY1 |
| 19 (D19) | PD8 | 是 | KEY2 |
| 20 (D20) | PC13 | 是 | KEY-WKUP |
| 21 (D21) | PE7 | 是 | 用户红色LED |
| 22 (D22, LED_BUILTIN) | PE8 | 是 | 用户绿色LED |
| 23 (D23) | PE9 | 是 | 用户蓝色LED,PWM1-CH1,默认被RT-Thread的PWM设备框架pwm1接管 |
| 24 (D24) | PB0 | 3.6V容忍 | 红外发送 |
| 25 (D25) | PB1 | 是 | 红外接收 |
| 26 (D26) | PD4 | 是 | 无线模块 CE |
| 27 (D27) | PD3 | 是 | 无线模块 中断 |
| 28 (D28, SS) | PD5 | 是 | 无线模块 片选 CS |
| 29 (D29) | PB13 | | SPI2-SCK,默认被RT-Thread的SPI设备框架spi2总线接管 |
| 30 (D30) | PB14 | | SPI2-MISO,默认被RT-Thread的SPI设备框架spi2总线接管 |
| 31 (D31) | PB15 | | SPI2-MOSI,默认被RT-Thread的SPI设备框架spi2总线接管 |
| 32 (D32) | PC7 | 是 | I2C1-SDA,默认被RT-Thread的I2C设备框架i2c1总线接管 |
| 33 (D33) | PC6 | 是 | I2C1-SCL,默认被RT-Thread的I2C设备框架i2c1总线接管 |
| 34 (D34) | PA2 | | Serial2-Tx,默认被RT-Thread的UART设备框架uart2接管 |
| 35 (D35) | PA3 | | Serial2-Rx,默认被RT-Thread的UART设备框架uart2接管 |
| A0 | PC2 | 是(但不建议) | ADC1-CH3,默认被RT-Thread的ADC设备框架adc1接管 |
| A1 | PC4 | 是(但不建议) | ADC1-CH13,默认被RT-Thread的ADC设备框架adc1接管 |
| A2 | -- | | 芯片内部参考电压 ADC1-CH0,默认被RT-Thread的ADC设备框架adc1接管 |
| A3 | -- | | 芯片内部温度 ADC1-CH17,默认被RT-Thread的ADC设备框架adc1接管 |
| DAC0 | PA4 | 3.6V容忍 | 真模拟输出 DAC1-CH1,默认被RT-Thread的DAC设备框架dac1接管 |
> 注意:
>
......@@ -119,9 +121,16 @@ I2C的引脚都是被RT-Thread I2C设备框架接管的,不需要直接操控
默认支持通过 `Serial.` 方法调用 `uart1` 串口设备;通过 `Serial2.` 方法调用 `uart2` 串口设备。详见[例程](https://github.com/RTduino/RTduino/blob/master/examples/Basic/helloworld.cpp)
### 3.4 USB
### 3.4 USB虚拟串口
默认支持USB虚拟串口,详见[例程](https://github.com/RTduino/RTduino/tree/master/examples/USBSerial)
支持USB虚拟串口,如果需要使用,可以手动使能。详见[例程](https://github.com/RTduino/RTduino/tree/master/examples/USBSerial)
```Kconfig
RT-Thread online packages --->
Arduino libraries --->
[*] RTduino: Arduino Ecological Compatibility Layer
[*] Enable USB Serial
```
## 4 特殊功能说明
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册