[rtduino][bluepill] 增加英语readme (#6425)

* [rtduino][bluepill] update readme
This commit is contained in:
Man, Jianting (Meco) 2022-09-14 21:44:36 -04:00 committed by GitHub
parent cb7fd304ff
commit 09e29c4d93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 144 additions and 58 deletions

View File

@ -1,12 +1,14 @@
# STM32F103 Blue-Pill开发板的Arduino生态兼容说明 # The Arduino Compatible of STM32 Blue Pill Board
## 1 RTduino - RT-Thread的Arduino生态兼容层 **English** | [中文](README_zh.md)
STM32F103 Blue-Pill开发板已经完整适配了[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生态兼容层 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.
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 ```Kconfig
Hardware Drivers Config ---> Hardware Drivers Config --->
@ -14,50 +16,62 @@ Hardware Drivers Config --->
[*] Support Arduino [*] Support Arduino
``` ```
## 2 Arduino引脚排布 ## 2 Arduino Pinout
![blue-pill-f103-pinout](blue-pill-f103-pinout.png) ![blue-pill-f103-pinout](blue-pill-f103-pinout.png)
该BSP遵照Arduino UNO板的引脚排列方式并扩展增加了Blue-pill自身的板载资源功能引脚。详见 `pins_arduino.c` | Arduino Pin | STM32 Pin | 5V Tolerate | 备注 |
| ----------- | --------- | ----------- | ----------------------------------------------------------------------------------------------------------- |
| 0 (D0) | PB7 | Yes | |
| 1 (D1) | PB6 | Yes | |
| 2 (D2) | PB5 | No | PWM3-CH2. Token over by RT-Thread PWM device by default |
| 3 (D3) | PB4 | Yes | PWM3-CH1. Token over by RT-Thread PWM device by default |
| 4 (D4) | PB3 | Yes | PWM2-CH2. Token over by RT-Thread PWM device by default |
| 5 (D5) | PA15 | Yes | PWM2-CH1. Token over by RT-Thread PWM device by default |
| 6 (D6) | PA8 | Yes | |
| 7 (D7) | PB12 | Yes | |
| 8 (D8) | PC13 | No | |
| 9 (D9) | PC14 | No | |
| 10 (D10) | PC15 | No | |
| 11 (D11) | PA0 | No | |
| 12 (D12) | PB0 | No | PWM3-CH3. Token over by RT-Thread PWM device by default |
| 13 (D13) | PB1 | No | PWM3-CH4. Token over by RT-Thread PWM device by default |
| 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) | PA12 | Yes | USB-DP. Token over by RT-Thread [TinyUSB](https://github.com/RT-Thread-packages/tinyusb) device by default. |
| 17 (D17) | PA11 | Yes | USB-DM. Token over by RT-Thread [TinyUSB](https://github.com/RT-Thread-packages/tinyusb) device by default. |
| 18 (D18) | PA10 | Yes | UART1-RX. Token over by RT-Thread UART device by default |
| 19 (D19) | PA9 | Yes | UART1-TX. Token over by RT-Thread UART device by default |
| 20 (D20) | PA2 | No | UART2-TX. Token over by RT-Thread UART device by default |
| 21 (D21) | PA3 | No | UART2-RX. Token over by RT-Thread UART device by default |
| 22 (D22) | PB10 | Yes | UART3-TX. Token over by RT-Thread UART device by default |
| 23 (D23) | PB11 | Yes | UART3-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 |
| 27 (A0) | PA1 | No | ADC1-CH1. Token over by RT-Thread ADC device by default |
| 28 (A1) | PA4 | No | ADC1-CH4. Token over by RT-Thread ADC device by default |
| 29 (A2) | PA5 | No | ADC1-CH5. Token over by RT-Thread ADC device by default |
| 30 (A3) | PA6 | No | ADC1-CH6. Token over by RT-Thread ADC device by default |
| 31 (A4) | PA7 | No | ADC1-CH7. Token over by RT-Thread ADC device by default |
| 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 |
| Arduino引脚编号 | STM32引脚编号 | 5V容忍 | 备注 | > Note:
| ----------- | --------- | ---- | -------------------------------------------- |
| 0 (D0) | PB7 | 是 | |
| 1 (D1) | PB6 | 是 | |
| 2 (D2) | PB5 | 否 | PWM3-CH2默认被RT-Thread的PWM设备框架pwm3接管 |
| 3 (D3) | PB4 | 是 | PWM3-CH1默认被RT-Thread的PWM设备框架pwm3接管 |
| 4 (D4) | PB3 | 是 | PWM2-CH2默认被RT-Thread的PWM设备框架pwm2接管 |
| 5 (D5) | PA15 | 是 | PWM2-CH1默认被RT-Thread的PWM设备框架pwm2接管 |
| 6 (D6) | PA8 | 是 | |
| 7 (D7) | PB12 | 是 | |
| 8 (D8) | PC13 | 否 | |
| 9 (D9) | PC14 | 否 | |
| 10 (D10) | PC15 | 否 | |
| 11 (D11) | PA0 | 否 | |
| 12 (D12) | PB0 | 否 | PWM3-CH3默认被RT-Thread的PWM设备框架pwm3接管 |
| 13 (D13) | PB1 | 否 | PWM3-CH4默认被RT-Thread的PWM设备框架pwm3接管 |
| 14 (D14) | PB9 | 是 | I2C-SDA默认被RT-Thread的I2C设备框架i2c1总线接管 |
| 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 | 是 | UART1-RX默认被RT-Thread的UART设备框架uart1接管 |
| 19 (D19) | PA9 | 是 | UART1-TX默认被RT-Thread的UART设备框架uart1接管 |
| 20 (D20) | PA2 | 否 | UART2-TX默认被RT-Thread的UART设备框架uart2接管 |
| 21 (D21) | PA3 | 否 | UART2-RX默认被RT-Thread的UART设备框架uart2接管 |
| 22 (D22) | PB10 | 是 | UART3-TX默认被RT-Thread的UART设备框架uart3接管 |
| 23 (D23) | PB11 | 是 | UART3-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接管 |
| 27 (A0) | PA1 | 否 | ADC1-CH1默认被RT-Thread的ADC设备框架adc1接管 |
| 28 (A1) | PA4 | 否 | ADC1-CH4默认被RT-Thread的ADC设备框架adc1接管 |
| 29 (A2) | PA5 | 否 | ADC1-CH5默认被RT-Thread的ADC设备框架adc1接管 |
| 30 (A3) | PA6 | 否 | ADC1-CH6默认被RT-Thread的ADC设备框架adc1接管 |
| 31 (A4) | PA7 | 否 | ADC1-CH7默认被RT-Thread的ADC设备框架adc1接管 |
| 32 (A5) | -- | | 芯片内部参考电压 ADC |
| 33 (A6) | -- | | 芯片内部温度 ADC |
> 注意:
> >
> 1. 驱动舵机和analogWrite函数要选择不同定时器发生的PWM信号引脚由于STM32的定时器4个通道需要保持相同的频率如果采用相同的定时器发生的PWM分别驱动舵机和analogWrite可能会导致舵机失效。 > 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)
## 3 Communication
### 3.1 I2C Bus
I2C bus is `D14` and `D15` 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
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
This board supports USB virtual COM by default. See [example](https://github.com/RTduino/RTduino/tree/master/examples/USBSerial).

View File

@ -0,0 +1,77 @@
# STM32F103 Blue-Pill开发板的Arduino生态兼容说明
[English](README.md) | **中文**
## 1 RTduino - RT-Thread的Arduino生态兼容层
STM32F103 Blue-Pill开发板已经完整适配了[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 --->
[*] Support Arduino
```
## 2 Arduino引脚排布
![blue-pill-f103-pinout](blue-pill-f103-pinout.png)
| Arduino引脚编号 | STM32引脚编号 | 5V容忍 | 备注 |
| ----------- | --------- | ---- | ------------------------------------------------------------------------- |
| 0 (D0) | PB7 | 是 | |
| 1 (D1) | PB6 | 是 | |
| 2 (D2) | PB5 | 否 | PWM3-CH2默认被RT-Thread的PWM设备框架pwm3接管 |
| 3 (D3) | PB4 | 是 | PWM3-CH1默认被RT-Thread的PWM设备框架pwm3接管 |
| 4 (D4) | PB3 | 是 | PWM2-CH2默认被RT-Thread的PWM设备框架pwm2接管 |
| 5 (D5) | PA15 | 是 | PWM2-CH1默认被RT-Thread的PWM设备框架pwm2接管 |
| 6 (D6) | PA8 | 是 | |
| 7 (D7) | PB12 | 是 | |
| 8 (D8) | PC13 | 否 | |
| 9 (D9) | PC14 | 否 | |
| 10 (D10) | PC15 | 否 | |
| 11 (D11) | PA0 | 否 | |
| 12 (D12) | PB0 | 否 | PWM3-CH3默认被RT-Thread的PWM设备框架pwm3接管 |
| 13 (D13) | PB1 | 否 | PWM3-CH4默认被RT-Thread的PWM设备框架pwm3接管 |
| 14 (D14) | PB9 | 是 | I2C-SDA默认被RT-Thread的I2C设备框架i2c1总线接管 |
| 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 | 是 | UART1-RX默认被RT-Thread的UART设备框架uart1接管 |
| 19 (D19) | PA9 | 是 | UART1-TX默认被RT-Thread的UART设备框架uart1接管 |
| 20 (D20) | PA2 | 否 | UART2-TX默认被RT-Thread的UART设备框架uart2接管 |
| 21 (D21) | PA3 | 否 | UART2-RX默认被RT-Thread的UART设备框架uart2接管 |
| 22 (D22) | PB10 | 是 | UART3-TX默认被RT-Thread的UART设备框架uart3接管 |
| 23 (D23) | PB11 | 是 | UART3-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接管 |
| 27 (A0) | PA1 | 否 | ADC1-CH1默认被RT-Thread的ADC设备框架adc1接管 |
| 28 (A1) | PA4 | 否 | ADC1-CH4默认被RT-Thread的ADC设备框架adc1接管 |
| 29 (A2) | PA5 | 否 | ADC1-CH5默认被RT-Thread的ADC设备框架adc1接管 |
| 30 (A3) | PA6 | 否 | ADC1-CH6默认被RT-Thread的ADC设备框架adc1接管 |
| 31 (A4) | PA7 | 否 | ADC1-CH7默认被RT-Thread的ADC设备框架adc1接管 |
| 32 (A5) | -- | | 芯片内部参考电压 ADC默认被RT-Thread的ADC设备框架adc1接管 |
| 33 (A6) | -- | | 芯片内部温度 ADC |
> 注意:
>
> 1. 如果同时驱动舵机和调度analogWrite函数要选择不同定时器发生的PWM信号引脚由于STM32的定时器4个通道需要保持相同的频率如果采用相同的定时器发生的PWM分别驱动舵机和analogWrite可能会导致舵机失效。
> 2. 更多引脚布局相关信息参见 [pins_arduino.c](pins_arduino.c) 和 [pins_arduino.h](pins_arduino.h)
## 3 通信
### 3.1 I2C (Wire.h)
I2C总线是 `D14``D15` 引脚这两个引脚默认是被RT-Thread I2C设备框架接管的直接引用`#include <Wire.h>`Arduino官方I2C头文件即可使用。
### 3.2 SPI
SPI总线是 `D24``D25``D26` 引脚这三个引脚默认是被RT-Thread SPI设备框架接管的直接引用`#include <SPI.h>`Arduino官方SPI头文件即可使用。此外还使用到了片选引脚(SS),默认为 `D7`
### 3.3 USB
默认支持USB虚拟串口详见[例程](https://github.com/RTduino/RTduino/tree/master/examples/USBSerial)。

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 MiB

After

Width:  |  Height:  |  Size: 6.6 MiB

View File

@ -12,7 +12,7 @@
#include "pins_arduino.h" #include "pins_arduino.h"
/* /*
{Arduino Pin, RT-Thread Pin [, Device Name(PWM or ADC), Channel]} {Arduino Pin, RT-Thread Pin [, Device Name, Channel]}
[] means optional [] means optional
Digital pins must NOT give the device name and channel. Digital pins must NOT give the device name and channel.
Analog pins MUST give the device name and channel(ADC, PWM or DAC). Analog pins MUST give the device name and channel(ADC, PWM or DAC).

View File

@ -50,21 +50,16 @@
#define F_CPU 72000000L /* CPU: 72MHz */ #define F_CPU 72000000L /* CPU: 72MHz */
#define LED_BUILTIN D8 /* Default Built-in LED */ #define LED_BUILTIN D8 /* Default Built-in LED */
/* /* i2c1 - PB9-SDA PB8-SCL */
* i2c1 - PB9-SDA PB8-SCL
*/
#define RTDUINO_DEFAULT_IIC_BUS_NAME "i2c1" #define RTDUINO_DEFAULT_IIC_BUS_NAME "i2c1"
/* /* uart2 - PA2-TX PA3-RX */
* uart2 - PA2-TX PA3-RX
* uart3 - PB10-TX PB11-RX
*/
#define RTDUINO_SERIAL2_DEVICE_NAME "uart2" #define RTDUINO_SERIAL2_DEVICE_NAME "uart2"
/* uart3 - PB10-TX PB11-RX */
#define RTDUINO_SERIAL3_DEVICE_NAME "uart3" #define RTDUINO_SERIAL3_DEVICE_NAME "uart3"
/* /* spi2 - PB13-SCK PB14-MISO PB15-MOSI */
* spi2 - PB13-SCK PB14-MISO PB15-MOSI
*/
#define SS D7 /* Chip select pin of default spi */ #define SS D7 /* Chip select pin of default spi */
#define RTDUINO_DEFAULT_SPI_BUS_NAME "spi2" #define RTDUINO_DEFAULT_SPI_BUS_NAME "spi2"