[bsp][stm32] Standardize the pin configuration

This commit is contained in:
Yuqiang Wang 2024-03-19 14:20:42 +08:00 committed by Meco Man
parent d3d4b44b92
commit 4d7071a1d5
5 changed files with 30 additions and 24 deletions

View File

@ -23,12 +23,12 @@ Hardware Drivers Config --->
| Arduino引脚编号 | STM32引脚编号 | 5V容忍 | 备注 | | Arduino引脚编号 | STM32引脚编号 | 5V容忍 | 备注 |
| ------------------- | --------- | ---- | ------------------------------------------------------------------------- | | ------------------- | --------- | ---- | ------------------------------------------------------------------------- |
| 0 (D0) | PC13 | 是 | 板载用户LED | | 0 (D0) | PC13 | 是 | 板载用户LED |
| 1 (D1) | PC14 | 是 | I2C1-SDA默认被RT-Thread的I2C设备框架i2c1接管 | | 1 (D1) | PC14 | 是 | |
| 2 (D2) | PC15 | 是 | I2C1-SCL默认被RT-Thread的I2C设备框架i2c1接管 | | 2 (D2) | PC15 | 是 | |
| 3 (D3) | PA2 | 是 | Serial2-TX默认被RT-Thread的UART设备框架uart2接管 | | 3 (D3) | PA2 | 是 | Serial2-TX默认被RT-Thread的UART设备框架uart2接管 |
| 4 (D4) | PA3 | 是 | Serial2-RX默认被RT-Thread的UART设备框架uart2接管 | | 4 (D4) | PA3 | 是 | Serial2-RX默认被RT-Thread的UART设备框架uart2接管 |
| 5 (D5) | PB2 | 是 | | | 5 (D5) | PB2 | 是 | I2C1-SDA默认被RT-Thread的I2C设备框架i2c1接管 |
| 6 (D6) | PB10 | 是 | | | 6 (D6) | PB10 | 是 | I2C1-SCL默认被RT-Thread的I2C设备框架i2c1接管 |
| 7 (D7) | PB9 | 是 | PWM4-CH4默认被RT-Thread的PWM设备框架pwm4接管 | | 7 (D7) | PB9 | 是 | PWM4-CH4默认被RT-Thread的PWM设备框架pwm4接管 |
| 8 (D8) | PB8 | 是 | PWM4-CH3默认被RT-Thread的PWM设备框架pwm4接管 | | 8 (D8) | PB8 | 是 | PWM4-CH3默认被RT-Thread的PWM设备框架pwm4接管 |
| 9 (D9) | PB7 | 是 | PWM4-CH2默认被RT-Thread的PWM设备框架pwm4接管 | | 9 (D9) | PB7 | 是 | PWM4-CH2默认被RT-Thread的PWM设备框架pwm4接管 |

View File

@ -22,12 +22,12 @@
const pin_map_t pin_map_table[]= const pin_map_t pin_map_table[]=
{ {
{D0, GET_PIN(C,13)}, /* LED_BUILTIN */ {D0, GET_PIN(C,13)}, /* LED_BUILTIN */
{D1, GET_PIN(C,14), "i2c1"}, /* I2C-SDA (Wire) */ {D1, GET_PIN(C,14)},
{D2, GET_PIN(C,15), "i2c1"}, /* I2C-SCL (Wire) */ {D2, GET_PIN(C,15)},
{D3, GET_PIN(A,2), "uart2"}, /* Serial-TX */ {D3, GET_PIN(A,2), "uart2"}, /* Serial-TX */
{D4, GET_PIN(A,3), "uart2"}, /* Serial-RX */ {D4, GET_PIN(A,3), "uart2"}, /* Serial-RX */
{D5, GET_PIN(B,2)}, {D5, GET_PIN(B,2), "i2c1"}, /* I2C-SDA (Wire) */
{D6, GET_PIN(B,10)}, {D6, GET_PIN(B,10), "i2c1"}, /* I2C-SCL (Wire) */
{D7, GET_PIN(B,9), "pwm4", 4}, /* PWM */ {D7, GET_PIN(B,9), "pwm4", 4}, /* PWM */
{D8, GET_PIN(B,8), "pwm4", 3}, /* PWM */ {D8, GET_PIN(B,8), "pwm4", 3}, /* PWM */
{D9, GET_PIN(B,7), "pwm4", 2}, /* PWM */ {D9, GET_PIN(B,7), "pwm4", 2}, /* PWM */

View File

@ -57,7 +57,7 @@
#define SS D14 /* Chip select pin of default spi */ #define SS D14 /* Chip select pin of default spi */
#define RTDUINO_DEFAULT_SPI_BUS_NAME "spi1" #define RTDUINO_DEFAULT_SPI_BUS_NAME "spi1"
/* i2c1 : PC14-SDA PC15-SCL */ /* i2c1 : PB2-SDA PB10-SCL */
#define RTDUINO_DEFAULT_IIC_BUS_NAME "i2c1" #define RTDUINO_DEFAULT_IIC_BUS_NAME "i2c1"
/* Serial2 - PA2-TX PA3-RX */ /* Serial2 - PA2-TX PA3-RX */

View File

@ -5,6 +5,9 @@ ADC1.NbrOfConversionFlag=1
ADC1.Rank-0\#ChannelRegularConversion=1 ADC1.Rank-0\#ChannelRegularConversion=1
ADC1.SamplingTime-0\#ChannelRegularConversion=ADC_SAMPLETIME_3CYCLES ADC1.SamplingTime-0\#ChannelRegularConversion=ADC_SAMPLETIME_3CYCLES
ADC1.master=1 ADC1.master=1
CAD.formats=
CAD.pinconfig=
CAD.provider=
File.Version=6 File.Version=6
GPIO.groupedBy=Group By Peripherals GPIO.groupedBy=Group By Peripherals
KeepUserPlacement=false KeepUserPlacement=false
@ -72,17 +75,17 @@ Mcu.UserConstants=
Mcu.UserName=STM32F411CEUx Mcu.UserName=STM32F411CEUx
MxCube.Version=6.5.0 MxCube.Version=6.5.0
MxDb.Version=DB.6.0.50 MxDb.Version=DB.6.0.50
NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:true NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:true NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
NVIC.ForceEnableDMAVector=true NVIC.ForceEnableDMAVector=true
NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:true NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:true NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:true NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:true NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4 NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4
NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:true NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
NVIC.SysTick_IRQn=true\:0\:0\:false\:false\:true\:false\:true\:true NVIC.SysTick_IRQn=true\:0\:0\:false\:false\:true\:false\:true\:false
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:true NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
PA0-WKUP.Locked=true PA0-WKUP.Locked=true
PA0-WKUP.Signal=ADCx_IN0 PA0-WKUP.Signal=ADCx_IN0
PA1.Locked=true PA1.Locked=true
@ -182,12 +185,15 @@ ProjectManager.PreviousToolchain=
ProjectManager.ProjectBuild=false ProjectManager.ProjectBuild=false
ProjectManager.ProjectFileName=CubeMX_Config.ioc ProjectManager.ProjectFileName=CubeMX_Config.ioc
ProjectManager.ProjectName=CubeMX_Config ProjectManager.ProjectName=CubeMX_Config
ProjectManager.ProjectStructure=
ProjectManager.RegisterCallBack= ProjectManager.RegisterCallBack=
ProjectManager.StackSize=0x400 ProjectManager.StackSize=0x400
ProjectManager.TargetToolchain=MDK-ARM V5 ProjectManager.TargetToolchain=MDK-ARM V5
ProjectManager.ToolChainLocation= ProjectManager.ToolChainLocation=
ProjectManager.UAScriptAfterPath=
ProjectManager.UAScriptBeforePath=
ProjectManager.UnderRoot=false ProjectManager.UnderRoot=false
ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false,3-MX_USART1_UART_Init-USART1-false-HAL-true,4-MX_RTC_Init-RTC-false-HAL-true,5-MX_TIM10_Init-TIM10-false-HAL-true,6-MX_TIM11_Init-TIM11-false-HAL-true,7-MX_USB_OTG_FS_PCD_Init-USB_OTG_FS-false-HAL-true,8-MX_ADC1_Init-ADC1-false-HAL-true,9-MX_TIM1_Init-TIM1-false-HAL-true,10-MX_TIM4_Init-TIM4-false-HAL-true,11-MX_USART2_UART_Init-USART2-false-HAL-true ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-SystemClock_Config-RCC-false-HAL-false,3-MX_USART1_UART_Init-USART1-false-HAL-true,4-MX_RTC_Init-RTC-false-HAL-true,5-MX_TIM10_Init-TIM10-false-HAL-true,6-MX_TIM11_Init-TIM11-false-HAL-true,7-MX_USB_OTG_FS_PCD_Init-USB_OTG_FS-false-HAL-true,8-MX_ADC1_Init-ADC1-false-HAL-true,9-MX_TIM1_Init-TIM1-false-HAL-true,10-MX_TIM4_Init-TIM4-false-HAL-true,11-MX_USART2_UART_Init-USART2-false-HAL-true,12-MX_SPI1_Init-SPI1-false-HAL-true
RCC.48MHZClocksFreq_Value=48000000 RCC.48MHZClocksFreq_Value=48000000
RCC.AHBFreq_Value=60000000 RCC.AHBFreq_Value=60000000
RCC.APB1CLKDivider=RCC_HCLK_DIV2 RCC.APB1CLKDivider=RCC_HCLK_DIV2

View File

@ -4,8 +4,8 @@ menu "Onboard Peripheral Drivers"
config BSP_USING_ARDUINO config BSP_USING_ARDUINO
bool "Compatible with Arduino Ecosystem (RTduino)" bool "Compatible with Arduino Ecosystem (RTduino)"
select PKG_USING_RTDUINO select PKG_USING_RTDUINO
select BSP_USING_USART1 select BSP_USING_UART1
select BSP_USING_USART2 select BSP_USING_UART2
select BSP_USING_GPIO select BSP_USING_GPIO
select BSP_USING_ADC select BSP_USING_ADC
select BSP_USING_ADC1 select BSP_USING_ADC1
@ -79,15 +79,15 @@ menu "On-chip Peripheral Drivers"
select RT_USING_I2C_BITOPS select RT_USING_I2C_BITOPS
select RT_USING_PIN select RT_USING_PIN
if BSP_USING_I2C1 if BSP_USING_I2C1
comment "Notice: PC14 --> 46; PC15 --> 47" comment "Notice: PB2 --> 18; PB10 --> 26"
config BSP_I2C1_SCL_PIN config BSP_I2C1_SCL_PIN
int "i2c1 scl pin number" int "i2c1 scl pin number"
range 0 48 range 0 48
default 47 default 26
config BSP_I2C1_SDA_PIN config BSP_I2C1_SDA_PIN
int "I2C1 sda pin number" int "I2C1 sda pin number"
range 0 48 range 0 48
default 46 default 18
endif endif
menuconfig BSP_USING_PWM menuconfig BSP_USING_PWM