un-remap usart pin, restore to pa9 and pa10

firmware update function has been completed
master
bookshiyi 2020-08-25 15:35:10 +08:00
parent db61d1f3d2
commit 8fc85e5f19
6 changed files with 61 additions and 40 deletions

View File

@ -26,6 +26,7 @@
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.nanoprintffloat.1573745116" name="Use float with printf from newlib-nano (-u _printf_float)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.nanoprintffloat" value="true" valueType="boolean"/> <option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.nanoprintffloat.1573745116" name="Use float with printf from newlib-nano (-u _printf_float)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.nanoprintffloat" value="true" valueType="boolean"/>
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.nanoscanffloat.142703396" name="Use float with scanf from newlib-nano (-u _scanf_float)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.nanoscanffloat" value="true" valueType="boolean"/> <option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.nanoscanffloat.142703396" name="Use float with scanf from newlib-nano (-u _scanf_float)" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.nanoscanffloat" value="true" valueType="boolean"/>
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.runtimelibrary_c.1187387752" name="Runtime library" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.runtimelibrary_c" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.runtimelibrary_c.value.standard_c" valueType="enumerated"/> <option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.runtimelibrary_c.1187387752" name="Runtime library" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.runtimelibrary_c" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.runtimelibrary_c.value.standard_c" valueType="enumerated"/>
<option id="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.converthex.1986680919" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.option.converthex" value="true" valueType="boolean"/>
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform.1735301810" isAbstract="false" osList="all" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform"/> <targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform.1735301810" isAbstract="false" osList="all" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.targetplatform"/>
<builder buildPath="${workspace_loc:/NaviKit_stm32}/Debug" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder.510228817" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder"/> <builder buildPath="${workspace_loc:/NaviKit_stm32}/Debug" id="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder.510228817" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.builder"/>
<tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.451303658" name="MCU GCC Assembler" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler"> <tool id="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler.451303658" name="MCU GCC Assembler" superClass="com.st.stm32cube.ide.mcu.gnu.managedbuild.tool.assembler">

View File

@ -64,6 +64,7 @@ void EXTI9_5_IRQHandler(void);
void TIM1_UP_IRQHandler(void); void TIM1_UP_IRQHandler(void);
void I2C1_EV_IRQHandler(void); void I2C1_EV_IRQHandler(void);
void I2C1_ER_IRQHandler(void); void I2C1_ER_IRQHandler(void);
void USART1_IRQHandler(void);
void UART4_IRQHandler(void); void UART4_IRQHandler(void);
void OTG_FS_IRQHandler(void); void OTG_FS_IRQHandler(void);
/* USER CODE BEGIN EFP */ /* USER CODE BEGIN EFP */

View File

@ -110,6 +110,7 @@ int main(void)
/* USER CODE BEGIN 2 */ /* USER CODE BEGIN 2 */
//HAL_IWDG_Refresh(&hiwdg); //HAL_IWDG_Refresh(&hiwdg);
printf("Core initial successfully\n"); printf("Core initial successfully\n");
printf("BIOS Version: 0.9 \n");
/* USER CODE END 2 */ /* USER CODE END 2 */
/* Init scheduler */ /* Init scheduler */
@ -228,7 +229,6 @@ void ISP_Judge()
hrtc.Instance = RTC; hrtc.Instance = RTC;
if(HAL_RTCEx_BKUPRead(&hrtc,RTC_BKP_DR1) == 0x32f2) if(HAL_RTCEx_BKUPRead(&hrtc,RTC_BKP_DR1) == 0x32f2)
{ {
__HAL_RCC_PWR_CLK_ENABLE(); __HAL_RCC_PWR_CLK_ENABLE();
__HAL_RCC_BKP_CLK_ENABLE(); __HAL_RCC_BKP_CLK_ENABLE();
__HAL_RCC_RTC_CONFIG(RCC_RTCCLKSOURCE_HSE_DIV128); __HAL_RCC_RTC_CONFIG(RCC_RTCCLKSOURCE_HSE_DIV128);

View File

@ -63,6 +63,7 @@ extern DMA_HandleTypeDef hdma_adc1;
extern ADC_HandleTypeDef hadc1; extern ADC_HandleTypeDef hadc1;
extern I2C_HandleTypeDef hi2c1; extern I2C_HandleTypeDef hi2c1;
extern UART_HandleTypeDef huart4; extern UART_HandleTypeDef huart4;
extern UART_HandleTypeDef huart1;
extern TIM_HandleTypeDef htim1; extern TIM_HandleTypeDef htim1;
/* USER CODE BEGIN EV */ /* USER CODE BEGIN EV */
@ -322,6 +323,20 @@ void I2C1_ER_IRQHandler(void)
/* USER CODE END I2C1_ER_IRQn 1 */ /* USER CODE END I2C1_ER_IRQn 1 */
} }
/**
* @brief This function handles USART1 global interrupt.
*/
void USART1_IRQHandler(void)
{
/* USER CODE BEGIN USART1_IRQn 0 */
/* USER CODE END USART1_IRQn 0 */
HAL_UART_IRQHandler(&huart1);
/* USER CODE BEGIN USART1_IRQn 1 */
/* USER CODE END USART1_IRQn 1 */
}
/** /**
* @brief This function handles UART4 global interrupt. * @brief This function handles UART4 global interrupt.
*/ */

View File

@ -103,23 +103,24 @@ void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle)
/* USART1 clock enable */ /* USART1 clock enable */
__HAL_RCC_USART1_CLK_ENABLE(); __HAL_RCC_USART1_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE(); __HAL_RCC_GPIOA_CLK_ENABLE();
/**USART1 GPIO Configuration /**USART1 GPIO Configuration
PB6 ------> USART1_TX PA9 ------> USART1_TX
PB7 ------> USART1_RX PA10 ------> USART1_RX
*/ */
GPIO_InitStruct.Pin = GPIO_PIN_6; 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(GPIOB, &GPIO_InitStruct); HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
GPIO_InitStruct.Pin = GPIO_PIN_7; GPIO_InitStruct.Pin = GPIO_PIN_10;
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(GPIOB, &GPIO_InitStruct); HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
__HAL_AFIO_REMAP_USART1_ENABLE();
/* USART1 interrupt Init */
HAL_NVIC_SetPriority(USART1_IRQn, 5, 0);
HAL_NVIC_EnableIRQ(USART1_IRQn);
/* USER CODE BEGIN USART1_MspInit 1 */ /* USER CODE BEGIN USART1_MspInit 1 */
/* USER CODE END USART1_MspInit 1 */ /* USER CODE END USART1_MspInit 1 */
@ -158,11 +159,13 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* uartHandle)
__HAL_RCC_USART1_CLK_DISABLE(); __HAL_RCC_USART1_CLK_DISABLE();
/**USART1 GPIO Configuration /**USART1 GPIO Configuration
PB6 ------> USART1_TX PA9 ------> USART1_TX
PB7 ------> USART1_RX PA10 ------> USART1_RX
*/ */
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_6|GPIO_PIN_7); HAL_GPIO_DeInit(GPIOA, GPIO_PIN_9|GPIO_PIN_10);
/* USART1 interrupt Deinit */
HAL_NVIC_DisableIRQ(USART1_IRQn);
/* USER CODE BEGIN USART1_MspDeInit 1 */ /* USER CODE BEGIN USART1_MspDeInit 1 */
/* USER CODE END USART1_MspDeInit 1 */ /* USER CODE END USART1_MspDeInit 1 */

View File

@ -117,28 +117,28 @@ Mcu.Pin4=PE6
Mcu.Pin40=PC7 Mcu.Pin40=PC7
Mcu.Pin41=PC8 Mcu.Pin41=PC8
Mcu.Pin42=PA8 Mcu.Pin42=PA8
Mcu.Pin43=PA11 Mcu.Pin43=PA9
Mcu.Pin44=PA12 Mcu.Pin44=PA10
Mcu.Pin45=PA13 Mcu.Pin45=PA11
Mcu.Pin46=PA14 Mcu.Pin46=PA12
Mcu.Pin47=PC10 Mcu.Pin47=PA13
Mcu.Pin48=PC11 Mcu.Pin48=PA14
Mcu.Pin49=PC12 Mcu.Pin49=PC10
Mcu.Pin5=OSC_IN Mcu.Pin5=OSC_IN
Mcu.Pin50=PD0 Mcu.Pin50=PC11
Mcu.Pin51=PD1 Mcu.Pin51=PC12
Mcu.Pin52=PD2 Mcu.Pin52=PD0
Mcu.Pin53=PD3 Mcu.Pin53=PD1
Mcu.Pin54=PD4 Mcu.Pin54=PD2
Mcu.Pin55=PD5 Mcu.Pin55=PD3
Mcu.Pin56=PD6 Mcu.Pin56=PD4
Mcu.Pin57=PD7 Mcu.Pin57=PD5
Mcu.Pin58=PB3 Mcu.Pin58=PD6
Mcu.Pin59=PB4 Mcu.Pin59=PD7
Mcu.Pin6=OSC_OUT Mcu.Pin6=OSC_OUT
Mcu.Pin60=PB5 Mcu.Pin60=PB3
Mcu.Pin61=PB6 Mcu.Pin61=PB4
Mcu.Pin62=PB7 Mcu.Pin62=PB5
Mcu.Pin63=PB8 Mcu.Pin63=PB8
Mcu.Pin64=PB9 Mcu.Pin64=PB9
Mcu.Pin65=VP_FREERTOS_VS_CMSIS_V2 Mcu.Pin65=VP_FREERTOS_VS_CMSIS_V2
@ -181,6 +181,7 @@ NVIC.TIM1_UP_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:true
NVIC.TimeBase=TIM1_UP_IRQn NVIC.TimeBase=TIM1_UP_IRQn
NVIC.TimeBaseIP=TIM1 NVIC.TimeBaseIP=TIM1
NVIC.UART4_IRQn=true\:5\:0\:false\:true\:true\:7\:true\:true\:true NVIC.UART4_IRQn=true\:5\:0\:false\:true\:true\:7\:true\:true\:true
NVIC.USART1_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true
NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false
OSC_IN.Mode=HSE-External-Oscillator OSC_IN.Mode=HSE-External-Oscillator
OSC_IN.Signal=RCC_OSC_IN OSC_IN.Signal=RCC_OSC_IN
@ -192,6 +193,9 @@ PA0-WKUP.GPIO_ModeDefaultEXTI=GPIO_MODE_IT_RISING_FALLING
PA0-WKUP.GPIO_PuPd=GPIO_PULLDOWN PA0-WKUP.GPIO_PuPd=GPIO_PULLDOWN
PA0-WKUP.Locked=true PA0-WKUP.Locked=true
PA0-WKUP.Signal=GPXTI0 PA0-WKUP.Signal=GPXTI0
PA10.Locked=true
PA10.Mode=Asynchronous
PA10.Signal=USART1_RX
PA11.GPIOParameters=GPIO_Label PA11.GPIOParameters=GPIO_Label
PA11.GPIO_Label=USB2_FS_DM PA11.GPIO_Label=USB2_FS_DM
PA11.Locked=true PA11.Locked=true
@ -238,6 +242,9 @@ PA8.GPIO_ModeDefaultOutputPP=GPIO_MODE_OUTPUT_PP
PA8.Locked=true PA8.Locked=true
PA8.PinState=GPIO_PIN_RESET PA8.PinState=GPIO_PIN_RESET
PA8.Signal=GPIO_Output PA8.Signal=GPIO_Output
PA9.Locked=true
PA9.Mode=Asynchronous
PA9.Signal=USART1_TX
PB10.GPIOParameters=GPIO_Label PB10.GPIOParameters=GPIO_Label
PB10.GPIO_Label=IIC2_SCL PB10.GPIO_Label=IIC2_SCL
PB10.Locked=true PB10.Locked=true
@ -275,12 +282,6 @@ PB5.GPIOParameters=GPIO_Label
PB5.GPIO_Label=SOM_MOD_SLEEP PB5.GPIO_Label=SOM_MOD_SLEEP
PB5.Locked=true PB5.Locked=true
PB5.Signal=GPIO_Input PB5.Signal=GPIO_Input
PB6.Locked=true
PB6.Mode=Asynchronous
PB6.Signal=USART1_TX
PB7.Locked=true
PB7.Mode=Asynchronous
PB7.Signal=USART1_RX
PB8.GPIOParameters=GPIO_Label PB8.GPIOParameters=GPIO_Label
PB8.GPIO_Label=IIC1_SCL PB8.GPIO_Label=IIC1_SCL
PB8.Locked=true PB8.Locked=true
@ -481,7 +482,7 @@ ProjectManager.StackSize=0x400
ProjectManager.TargetToolchain=STM32CubeIDE ProjectManager.TargetToolchain=STM32CubeIDE
ProjectManager.ToolChainLocation= ProjectManager.ToolChainLocation=
ProjectManager.UnderRoot=true ProjectManager.UnderRoot=true
ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-MX_DMA_Init-DMA-false-HAL-true,3-SystemClock_Config-RCC-false-HAL-true,4-MX_USB_DEVICE_Init-USB_DEVICE-false-HAL-false,5-MX_I2C1_Init-I2C1-false-HAL-true,6-MX_IWDG_Init-IWDG-false-HAL-true,7-MX_UART4_Init-UART4-false-HAL-true,8-MX_ADC1_Init-ADC1-false-HAL-true,9-MX_USART1_UART_Init-USART1-false-HAL-true ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL-true,2-MX_DMA_Init-DMA-false-HAL-true,3-SystemClock_Config-RCC-false-HAL-true,4-MX_USB_DEVICE_Init-USB_DEVICE-false-HAL-false,5-MX_I2C1_Init-I2C1-false-HAL-true,6-MX_IWDG_Init-IWDG-false-HAL-true,7-MX_UART4_Init-UART4-false-HAL-true,8-MX_ADC1_Init-ADC1-false-HAL-true,9-MX_USART1_UART_Init-USART1-false-HAL-true,10-MX_RTC_Init-RTC-false-HAL-true
RCC.ADCFreqValue=3000000 RCC.ADCFreqValue=3000000
RCC.ADCPresc=RCC_ADCPCLK2_DIV8 RCC.ADCPresc=RCC_ADCPCLK2_DIV8
RCC.AHBCLKDivider=RCC_SYSCLK_DIV2 RCC.AHBCLKDivider=RCC_SYSCLK_DIV2