Browse Source

[RTduino]更新blue-pill引脚分布 (#6400)

* [RTduino]更新引脚分布

* update

* update readme
liYangYang 2 năm trước cách đây
mục cha
commit
19106eb3a1

+ 35 - 34
bsp/stm32/stm32f103-blue-pill/applications/arduino_pinout/README.md

@@ -22,40 +22,41 @@ Hardware Drivers Config --->
 
 | Arduino引脚编号 | STM32引脚编号 | 5V容忍 | 备注                                           |
 | ----------- | --------- | ---- | -------------------------------------------- |
-| 0 (D0)      | PB7       | 是    |                                              |
-| 1 (D1)      | PB6       | 是    |                                              |
-| 2 (D2)      | PB5       | 否    | PWM3-CH2(定时器3发生)                             |
-| 3 (D3)      | PB4       | 是    | PWM3-CH1(定时器3发生)                             |
-| 4 (D4)      | PB3       | 是    | PWM2-CH2(定时器2发生)                             |
-| 5 (D5)      | PA15      | 是    | PWM2-CH1(定时器2发生)                             |
-| 6 (D6)      | PA8       | 是    |                                              |
-| 7 (D7)      | PB12      | 是    |                                              |
-| 8 (D8)      | PC13      | 否    |                                              |
-| 9 (D9)      | PC14      | 否    |                                              |
-| 10 (D10)    | PC15      | 否    |                                              |
-| 11 (D11)    | PA0       | 否    |                                              |
-| 12 (D12)    | PB0       | 否    | PWM3-CH3(定时器3发生)                             |
-| 13 (D13)    | PB1       | 否    | PWM3-CH4(定时器3发生)                             |
-| A0          | PA1       | 否    | ADC1-CH1                                     |
-| A1          | PA4       | 否    | ADC1-CH4                                     |
-| A2          | PA5       | 否    | ADC1-CH5                                     |
-| A3          | PA6       | 否    | ADC1-CH6                                     |
-| A4          | PA7       | 否    | ADC1-CH7                                     |
-| A5          | --        |      | 芯片内部参考电压 ADC                                 |
-| A6          | --        |      | 芯片内部温度 ADC                                   |
-| --          | PB9       | 是    | I2C-SDA,被RT-Thread的I2C设备框架i2c1总线接管,不可当做普通IO  |
-| --          | PB8       | 是    | I2C-SCL,被RT-Thread的I2C设备框架i2c1总线接管,不可当做普通IO  |
-| --          | PA12      | 是    | USB-DP,被TinyUSB接管,不可当做普通IO                   |
-| --          | PA11      | 是    | USB-DM,被TinyUSB接管,不可当做普通IO                   |
-| --          | PA10      | 是    | UART1-RX,被RT-Thread的UART设备框架uart1接管,不可当做普通IO |
-| --          | PA9       | 是    | UART1-TX,被RT-Thread的UART设备框架uart1接管,不可当做普通IO |
-| --          | PA2       | 否    | UART2-TX,被RT-Thread的UART设备框架uart2接管,不可当做普通IO |
-| --          | PA3       | 否    | UART2-RX,被RT-Thread的UART设备框架uart2接管,不可当做普通IO |
-| --          | PB10      | 是    | UART3-TX,被RT-Thread的UART设备框架uart3接管,不可当做普通IO |
-| --          | PB11      | 是    | UART3-RX,被RT-Thread的UART设备框架uart3接管,不可当做普通IO |
-| --          | PB15      | 是    | SPI-MOSI,被RT-Thread的SPI设备框架spi2接管,不可当做普通IO   |
-| --          | PB14      | 是    | SPI-MISO,被RT-Thread的SPI设备框架spi2接管,不可当做普通IO   |
-| --          | PB13      | 是    | SPI-SCK ,被RT-Thread的SPI设备框架spi2接管,不可当做普通IO   |
+| 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                                 |
+
 
 > 注意:
 > 

BIN
bsp/stm32/stm32f103-blue-pill/applications/arduino_pinout/blue-pill-f103-pinout.png


+ 24 - 11
bsp/stm32/stm32f103-blue-pill/applications/arduino_pinout/pins_arduino.c

@@ -22,23 +22,36 @@ const pin_map_t pin_map_table[]=
 {
     {D0, GET_PIN(B,7)},
     {D1, GET_PIN(B,6)},
-    {D2, GET_PIN(B,5), "pwm3", 2},/* PWM */
-    {D3, GET_PIN(B,4), "pwm3", 1}, /* PWM */
-    {D4, GET_PIN(B,3), "pwm2", 2}, /* PWM */
+    {D2, GET_PIN(B,5), "pwm3", 2},  /* PWM */
+    {D3, GET_PIN(B,4), "pwm3", 1},  /* PWM */
+    {D4, GET_PIN(B,3), "pwm2", 2},  /* PWM */
     {D5, GET_PIN(A,15), "pwm2", 1}, /* PWM */
     {D6, GET_PIN(A,8)},
     {D7, GET_PIN(B,12)},
-    {D8, GET_PIN(C,13)}, /* LED_BUILTIN */
+    {D8, GET_PIN(C,13)},            /* LED_BUILTIN */
     {D9, GET_PIN(C,14)},
     {D10, GET_PIN(C,15)},
     {D11, GET_PIN(A,0)},
     {D12, GET_PIN(B,0), "pwm3", 3}, /* PWM */
     {D13, GET_PIN(B,1), "pwm3", 4}, /* PWM */
-    {A0, GET_PIN(A,1), "adc1", 1}, /* ADC */
-    {A1, GET_PIN(A,4), "adc1", 4}, /* ADC */
-    {A2, GET_PIN(A,5), "adc1", 5}, /* ADC */
-    {A3, GET_PIN(A,6), "adc1", 6}, /* ADC */
-    {A4, GET_PIN(A,7), "adc1", 7}, /* ADC */
-    {A5, RT_NULL, "adc1", 17}, /* ADC, On-Chip: internal reference voltage, ADC_CHANNEL_VREFINT */
-    {A6, RT_NULL, "adc1", 16} /* ADC, On-Chip: internal temperature sensor, ADC_CHANNEL_TEMPSENSOR */
+    {D14, GET_PIN(B,9), "i2c1"},    /* I2C (Wire) */
+    {D15, GET_PIN(B,8), "i2c1"},    /* I2C (Wire) */
+    {D16, GET_PIN(A,12), "usb"},    /* SerialUSB */
+    {D17, GET_PIN(A,11), "usb"},    /* SerialUSB */
+    {D18, GET_PIN(A,10), "uart1"},  /* Serial */
+    {D19, GET_PIN(A,9), "uart1"},   /* Serial */
+    {D20, GET_PIN(A,2), "uart2"},   /* Serial2 */
+    {D21, GET_PIN(A,3), "uart2"},   /* Serial2 */
+    {D22, GET_PIN(B,10), "uart3"},  /* Serial3 */
+    {D23, GET_PIN(B,11), "uart3"},  /* Serial3 */
+    {D24, GET_PIN(B,15), "spi2"},   /* SPI */
+    {D25, GET_PIN(B,14), "spi2"},   /* SPI */
+    {D26, GET_PIN(B,13), "spi2"},   /* SPI */
+    {A0, GET_PIN(A,1), "adc1", 1},  /* ADC */
+    {A1, GET_PIN(A,4), "adc1", 4},  /* ADC */
+    {A2, GET_PIN(A,5), "adc1", 5},  /* ADC */
+    {A3, GET_PIN(A,6), "adc1", 6},  /* ADC */
+    {A4, GET_PIN(A,7), "adc1", 7},  /* ADC */
+    {A5, RT_NULL, "adc1", 17},      /* ADC, On-Chip: internal reference voltage, ADC_CHANNEL_VREFINT */
+    {A6, RT_NULL, "adc1", 16}       /* ADC, On-Chip: internal temperature sensor, ADC_CHANNEL_TEMPSENSOR */
 };

+ 21 - 7
bsp/stm32/stm32f103-blue-pill/applications/arduino_pinout/pins_arduino.h

@@ -26,13 +26,26 @@
 #define D11  (11)
 #define D12  (12)
 #define D13  (13)
-#define A0   (14)
-#define A1   (15)
-#define A2   (16)
-#define A3   (17)
-#define A4   (18)
-#define A5   (19)
-#define A6   (20)
+#define D14  (14)
+#define D15  (15)
+#define D16  (16)
+#define D17  (17)
+#define D18  (18)
+#define D19  (19)
+#define D20  (20)
+#define D21  (21)
+#define D22  (22)
+#define D23  (23)
+#define D24  (24)
+#define D25  (25)
+#define D26  (26)
+#define A0   (27)
+#define A1   (28)
+#define A2   (29)
+#define A3   (30)
+#define A4   (31)
+#define A5   (32)
+#define A6   (33)
 
 #define F_CPU  72000000L /* CPU: 72MHz */
 #define LED_BUILTIN  D8 /* Default Built-in LED */
@@ -52,6 +65,7 @@
 /*
  * spi2 - PB13-SCK  PB14-MISO  PB15-MOSI
  */
+#define SS  D7 /* Chip select pin of default spi */
 #define RTDUINO_DEFAULT_SPI_BUS_NAME            "spi2"
 
 #endif /* Pins_Arduino_h */