From 4d7071a1d5fc8fc4bdcd6b6fee37c42f70beed77 Mon Sep 17 00:00:00 2001 From: Yuqiang Wang Date: Tue, 19 Mar 2024 14:20:42 +0800 Subject: [PATCH] [bsp][stm32] Standardize the pin configuration --- .../applications/arduino_pinout/README.md | 8 +++--- .../arduino_pinout/pins_arduino.c | 8 +++--- .../arduino_pinout/pins_arduino.h | 2 +- .../board/CubeMX_Config/CubeMX_Config.ioc | 26 ++++++++++++------- .../stm32f411-weact-blackpill/board/Kconfig | 10 +++---- 5 files changed, 30 insertions(+), 24 deletions(-) diff --git a/bsp/stm32/stm32f411-weact-blackpill/applications/arduino_pinout/README.md b/bsp/stm32/stm32f411-weact-blackpill/applications/arduino_pinout/README.md index 79357518a1..b579a05411 100644 --- a/bsp/stm32/stm32f411-weact-blackpill/applications/arduino_pinout/README.md +++ b/bsp/stm32/stm32f411-weact-blackpill/applications/arduino_pinout/README.md @@ -23,12 +23,12 @@ Hardware Drivers Config ---> | Arduino引脚编号 | STM32引脚编号 | 5V容忍 | 备注 | | ------------------- | --------- | ---- | ------------------------------------------------------------------------- | | 0 (D0) | PC13 | 是 | 板载用户LED | -| 1 (D1) | PC14 | 是 | I2C1-SDA,默认被RT-Thread的I2C设备框架i2c1接管 | -| 2 (D2) | PC15 | 是 | I2C1-SCL,默认被RT-Thread的I2C设备框架i2c1接管 | +| 1 (D1) | PC14 | 是 | | +| 2 (D2) | PC15 | 是 | | | 3 (D3) | PA2 | 是 | Serial2-TX,默认被RT-Thread的UART设备框架uart2接管 | | 4 (D4) | PA3 | 是 | Serial2-RX,默认被RT-Thread的UART设备框架uart2接管 | -| 5 (D5) | PB2 | 是 | | -| 6 (D6) | PB10 | 是 | | +| 5 (D5) | PB2 | 是 | I2C1-SDA,默认被RT-Thread的I2C设备框架i2c1接管 | +| 6 (D6) | PB10 | 是 | I2C1-SCL,默认被RT-Thread的I2C设备框架i2c1接管 | | 7 (D7) | PB9 | 是 | PWM4-CH4,默认被RT-Thread的PWM设备框架pwm4接管 | | 8 (D8) | PB8 | 是 | PWM4-CH3,默认被RT-Thread的PWM设备框架pwm4接管 | | 9 (D9) | PB7 | 是 | PWM4-CH2,默认被RT-Thread的PWM设备框架pwm4接管 | diff --git a/bsp/stm32/stm32f411-weact-blackpill/applications/arduino_pinout/pins_arduino.c b/bsp/stm32/stm32f411-weact-blackpill/applications/arduino_pinout/pins_arduino.c index 3df894a962..b54e02e55e 100644 --- a/bsp/stm32/stm32f411-weact-blackpill/applications/arduino_pinout/pins_arduino.c +++ b/bsp/stm32/stm32f411-weact-blackpill/applications/arduino_pinout/pins_arduino.c @@ -22,12 +22,12 @@ const pin_map_t pin_map_table[]= { {D0, GET_PIN(C,13)}, /* LED_BUILTIN */ - {D1, GET_PIN(C,14), "i2c1"}, /* I2C-SDA (Wire) */ - {D2, GET_PIN(C,15), "i2c1"}, /* I2C-SCL (Wire) */ + {D1, GET_PIN(C,14)}, + {D2, GET_PIN(C,15)}, {D3, GET_PIN(A,2), "uart2"}, /* Serial-TX */ {D4, GET_PIN(A,3), "uart2"}, /* Serial-RX */ - {D5, GET_PIN(B,2)}, - {D6, GET_PIN(B,10)}, + {D5, GET_PIN(B,2), "i2c1"}, /* I2C-SDA (Wire) */ + {D6, GET_PIN(B,10), "i2c1"}, /* I2C-SCL (Wire) */ {D7, GET_PIN(B,9), "pwm4", 4}, /* PWM */ {D8, GET_PIN(B,8), "pwm4", 3}, /* PWM */ {D9, GET_PIN(B,7), "pwm4", 2}, /* PWM */ diff --git a/bsp/stm32/stm32f411-weact-blackpill/applications/arduino_pinout/pins_arduino.h b/bsp/stm32/stm32f411-weact-blackpill/applications/arduino_pinout/pins_arduino.h index 2f535cb9a0..68689fbf43 100644 --- a/bsp/stm32/stm32f411-weact-blackpill/applications/arduino_pinout/pins_arduino.h +++ b/bsp/stm32/stm32f411-weact-blackpill/applications/arduino_pinout/pins_arduino.h @@ -57,7 +57,7 @@ #define SS D14 /* Chip select pin of default spi */ #define RTDUINO_DEFAULT_SPI_BUS_NAME "spi1" -/* i2c1 : PC14-SDA PC15-SCL */ +/* i2c1 : PB2-SDA PB10-SCL */ #define RTDUINO_DEFAULT_IIC_BUS_NAME "i2c1" /* Serial2 - PA2-TX PA3-RX */ diff --git a/bsp/stm32/stm32f411-weact-blackpill/board/CubeMX_Config/CubeMX_Config.ioc b/bsp/stm32/stm32f411-weact-blackpill/board/CubeMX_Config/CubeMX_Config.ioc index e7d3020756..9f6e8a3963 100644 --- a/bsp/stm32/stm32f411-weact-blackpill/board/CubeMX_Config/CubeMX_Config.ioc +++ b/bsp/stm32/stm32f411-weact-blackpill/board/CubeMX_Config/CubeMX_Config.ioc @@ -5,6 +5,9 @@ ADC1.NbrOfConversionFlag=1 ADC1.Rank-0\#ChannelRegularConversion=1 ADC1.SamplingTime-0\#ChannelRegularConversion=ADC_SAMPLETIME_3CYCLES ADC1.master=1 +CAD.formats= +CAD.pinconfig= +CAD.provider= File.Version=6 GPIO.groupedBy=Group By Peripherals KeepUserPlacement=false @@ -72,17 +75,17 @@ Mcu.UserConstants= Mcu.UserName=STM32F411CEUx MxCube.Version=6.5.0 MxDb.Version=DB.6.0.50 -NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:true -NVIC.DebugMonitor_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\:false NVIC.ForceEnableDMAVector=true -NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:true -NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:true -NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:true -NVIC.PendSV_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\:false +NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false +NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4 -NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:true -NVIC.SysTick_IRQn=true\:0\:0\:false\:false\:true\:false\:true\:true -NVIC.UsageFault_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\:false +NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false PA0-WKUP.Locked=true PA0-WKUP.Signal=ADCx_IN0 PA1.Locked=true @@ -182,12 +185,15 @@ ProjectManager.PreviousToolchain= ProjectManager.ProjectBuild=false ProjectManager.ProjectFileName=CubeMX_Config.ioc ProjectManager.ProjectName=CubeMX_Config +ProjectManager.ProjectStructure= ProjectManager.RegisterCallBack= ProjectManager.StackSize=0x400 ProjectManager.TargetToolchain=MDK-ARM V5 ProjectManager.ToolChainLocation= +ProjectManager.UAScriptAfterPath= +ProjectManager.UAScriptBeforePath= 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.AHBFreq_Value=60000000 RCC.APB1CLKDivider=RCC_HCLK_DIV2 diff --git a/bsp/stm32/stm32f411-weact-blackpill/board/Kconfig b/bsp/stm32/stm32f411-weact-blackpill/board/Kconfig index 8d9a2773b7..7897299cd1 100644 --- a/bsp/stm32/stm32f411-weact-blackpill/board/Kconfig +++ b/bsp/stm32/stm32f411-weact-blackpill/board/Kconfig @@ -4,8 +4,8 @@ menu "Onboard Peripheral Drivers" config BSP_USING_ARDUINO bool "Compatible with Arduino Ecosystem (RTduino)" select PKG_USING_RTDUINO - select BSP_USING_USART1 - select BSP_USING_USART2 + select BSP_USING_UART1 + select BSP_USING_UART2 select BSP_USING_GPIO select BSP_USING_ADC select BSP_USING_ADC1 @@ -79,15 +79,15 @@ menu "On-chip Peripheral Drivers" select RT_USING_I2C_BITOPS select RT_USING_PIN if BSP_USING_I2C1 - comment "Notice: PC14 --> 46; PC15 --> 47" + comment "Notice: PB2 --> 18; PB10 --> 26" config BSP_I2C1_SCL_PIN int "i2c1 scl pin number" range 0 48 - default 47 + default 26 config BSP_I2C1_SDA_PIN int "I2C1 sda pin number" range 0 48 - default 46 + default 18 endif menuconfig BSP_USING_PWM