[bsp][stm32][stm32f103-fire-arbitrary][board]

修改stm32f1xx_hal_msp.c文件CAN引脚配置,
修改Kconfig文件,取消CAN2相关内容
还原stm32f1xx_hal_conf.h中与CAN不相关的内容
This commit is contained in:
杨连钊 2019-03-13 16:20:56 +08:00
parent 0b63d83485
commit 900050ba98
4 changed files with 29 additions and 30 deletions

View File

@ -50,7 +50,7 @@
#define HAL_MODULE_ENABLED #define HAL_MODULE_ENABLED
#define HAL_ADC_MODULE_ENABLED #define HAL_ADC_MODULE_ENABLED
/*#define HAL_CRYP_MODULE_ENABLED */ /*#define HAL_CRYP_MODULE_ENABLED */
#define HAL_CAN_MODULE_ENABLED #define HAL_CAN_MODULE_ENABLED
/*#define HAL_CEC_MODULE_ENABLED */ /*#define HAL_CEC_MODULE_ENABLED */
/*#define HAL_CORTEX_MODULE_ENABLED */ /*#define HAL_CORTEX_MODULE_ENABLED */

View File

@ -184,20 +184,22 @@ void HAL_CAN_MspInit(CAN_HandleTypeDef* hcan)
/* Peripheral clock enable */ /* Peripheral clock enable */
__HAL_RCC_CAN1_CLK_ENABLE(); __HAL_RCC_CAN1_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE(); __HAL_RCC_GPIOB_CLK_ENABLE();
/**CAN GPIO Configuration /**CAN GPIO Configuration
PA11 ------> CAN_RX PB8 ------> CAN_RX
PA12 ------> CAN_TX PB9 ------> CAN_TX
*/ */
GPIO_InitStruct.Pin = GPIO_PIN_11; GPIO_InitStruct.Pin = GPIO_PIN_8;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT; GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
GPIO_InitStruct.Pin = GPIO_PIN_12; GPIO_InitStruct.Pin = GPIO_PIN_9;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
__HAL_AFIO_REMAP_CAN1_2();
/* USER CODE BEGIN CAN1_MspInit 1 */ /* USER CODE BEGIN CAN1_MspInit 1 */
@ -225,10 +227,10 @@ void HAL_CAN_MspDeInit(CAN_HandleTypeDef* hcan)
__HAL_RCC_CAN1_CLK_DISABLE(); __HAL_RCC_CAN1_CLK_DISABLE();
/**CAN GPIO Configuration /**CAN GPIO Configuration
PA11 ------> CAN_RX PB8 ------> CAN_RX
PA12 ------> CAN_TX PB9 ------> CAN_TX
*/ */
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_11|GPIO_PIN_12); HAL_GPIO_DeInit(GPIOB, GPIO_PIN_8|GPIO_PIN_9);
/* USER CODE BEGIN CAN1_MspDeInit 1 */ /* USER CODE BEGIN CAN1_MspDeInit 1 */

View File

@ -45,15 +45,15 @@ Mcu.Pin18=PC9
Mcu.Pin19=PA9 Mcu.Pin19=PA9
Mcu.Pin2=OSC_IN Mcu.Pin2=OSC_IN
Mcu.Pin20=PA10 Mcu.Pin20=PA10
Mcu.Pin21=PA11 Mcu.Pin21=PA13
Mcu.Pin22=PA12 Mcu.Pin22=PA14
Mcu.Pin23=PA13 Mcu.Pin23=PC10
Mcu.Pin24=PA14 Mcu.Pin24=PC11
Mcu.Pin25=PC10 Mcu.Pin25=PC12
Mcu.Pin26=PC11 Mcu.Pin26=PD2
Mcu.Pin27=PC12 Mcu.Pin27=PB5
Mcu.Pin28=PD2 Mcu.Pin28=PB8
Mcu.Pin29=PB5 Mcu.Pin29=PB9
Mcu.Pin3=OSC_OUT Mcu.Pin3=OSC_OUT
Mcu.Pin30=VP_IWDG_VS_IWDG Mcu.Pin30=VP_IWDG_VS_IWDG
Mcu.Pin31=VP_RTC_VS_RTC_Activate Mcu.Pin31=VP_RTC_VS_RTC_Activate
@ -91,10 +91,6 @@ OSC_OUT.Mode=HSE-External-Oscillator
OSC_OUT.Signal=RCC_OSC_OUT OSC_OUT.Signal=RCC_OSC_OUT
PA10.Mode=Asynchronous PA10.Mode=Asynchronous
PA10.Signal=USART1_RX PA10.Signal=USART1_RX
PA11.Mode=Master
PA11.Signal=CAN_RX
PA12.Mode=Master
PA12.Signal=CAN_TX
PA13.Mode=Serial_Wire PA13.Mode=Serial_Wire
PA13.Signal=SYS_JTMS-SWDIO PA13.Signal=SYS_JTMS-SWDIO
PA14.Mode=Serial_Wire PA14.Mode=Serial_Wire
@ -124,6 +120,12 @@ PB14.Signal=SPI2_MISO
PB15.Mode=Full_Duplex_Master PB15.Mode=Full_Duplex_Master
PB15.Signal=SPI2_MOSI PB15.Signal=SPI2_MOSI
PB5.Signal=S_TIM3_CH2 PB5.Signal=S_TIM3_CH2
PB8.Locked=true
PB8.Mode=Master
PB8.Signal=CAN_RX
PB9.Locked=true
PB9.Mode=Master
PB9.Signal=CAN_TX
PC1.Locked=true PC1.Locked=true
PC1.Signal=ADCx_IN11 PC1.Signal=ADCx_IN11
PC10.Mode=SD_4_bits_Wide_bus PC10.Mode=SD_4_bits_Wide_bus

View File

@ -268,18 +268,13 @@ menu "On-chip Peripheral Drivers"
default n default n
menuconfig BSP_USING_CAN menuconfig BSP_USING_CAN
bool "Enable can" bool "Enable CAN"
default n default n
select RT_USING_CAN select RT_USING_CAN
if BSP_USING_CAN if BSP_USING_CAN
config BSP_USING_CAN1 config BSP_USING_CAN1
bool "using CAN1" bool "using CAN1"
default n default n
config BSP_USING_CAN2
bool "using CAN2"
default n
select BSP_USING_CAN1
endif endif
endmenu endmenu