STM32F072 USART becomes unresponsive after jump from custom bootloader to application code
Hi, I wrote a custom bootloader which downloads new firmware using GSM module and starts application firmware. Bootloader is able to start application firmware and application firmware is able to configure vector table, systick and different I/O pins. But is unable to communicate on any USART interface.
Below is code to jump to application firmware from bootloader:__disable_irq();
// Jump to user application JumpAddress = *(__IO uint32_t*) (ApplicationAddress + 4); Jump_To_Application = (pFunction) JumpAddress; // Initialize user application's Stack Pointer __set_MSP(*(__IO uint32_t*) ApplicationAddress); //Remap_Table(); Jump_To_Application(); Below is start of main() in application firmware:void
Remap_Table(
void)
{ // Copy interrupt vector table to the RAM. volatileuint32_t *VectorTable = (
volatileuint32_t *)0x20000000;
uint32_t ui32_VectorIndex = 0; for(ui32_VectorIndex = 0; ui32_VectorIndex < 48; ui32_VectorIndex++)
{ VectorTable[ui32_VectorIndex] = *(__IO uint32_t*)((uint32_t)FIRMWARE_START_ADDR + (ui32_VectorIndex << 2)); } RCC_APB2PeriphResetCmd(RCC_APB2Periph_SYSCFG, ENABLE); // Remap RAM into 0x0000 0000 SYSCFG_MemoryRemapConfig(SYSCFG_MemoryRemap_SRAM); } intmain(
void)
{ Remap_Table(); //SystemInit(); __enable_irq(); SysTick_Config(SystemCoreClock / 1000); configurePins(); //NVIC_SetPriority(SysTick_IRQn, 0x0); configureImu(); //configures I2C InterfaceREST_COUNTER = 0;
configureDebugger(); //configures USART4configureLidar();
//configure I2CconfigureGps();
//configure USART3.....
} Device is able to configure interfaces but when trying to access USART to write data it keeps on looping at :while
(USART_GetFlagStatus(USART3, USART_FLAG_TXE) == RESET);
Transmit Data Register of USART is not getting set. Can anyone please tell me what I am missing or doing wrong? #usart #stm32 #bootloader #arm-cortex-m0-stm32-multiply