[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

@ -184,20 +184,22 @@ void HAL_CAN_MspInit(CAN_HandleTypeDef* hcan)
/* Peripheral clock enable */
__HAL_RCC_CAN1_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
/**CAN GPIO Configuration
PA11 ------> CAN_RX
PA12 ------> CAN_TX
PB8 ------> CAN_RX
PB9 ------> CAN_TX
*/
GPIO_InitStruct.Pin = GPIO_PIN_11;
GPIO_InitStruct.Pin = GPIO_PIN_8;
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
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.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 */
@ -225,10 +227,10 @@ void HAL_CAN_MspDeInit(CAN_HandleTypeDef* hcan)
__HAL_RCC_CAN1_CLK_DISABLE();
/**CAN GPIO Configuration
PA11 ------> CAN_RX
PA12 ------> CAN_TX
PB8 ------> CAN_RX
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 */

View File

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

View File

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