STM32 UART1 interrupts not firing after booatloader to user application jump
I have been trawling these forums reading about the bootloader
code in AN2557, looking for an answer to a problem I have.
I have the bootloader up and running, and I can download my user
application code via RS232 USART1. The flash programs and verifies
correctly, and the PC jumps to my user application code. I can see
data being piped out of USART1, so i know my code is running
correctly. The bootloader code is at 0x08000000, and my application
code is at 0x08002000. I have set VECT_TAB_OFFSET to 0x00002000 and I
am calling SystemInit from my user application main().
However, I do not receive data on USART1 once my application code
is running. All the settings for the port are the same as the
bootloader, but just in case I have tried DeIniting it before
initialising in my application code. Important to note that the
Bootloader code doesn't use USART1 interrupts - it just polls.
I am calling NVIC_SETPRIMASK() before jumping to application code,
and NVIC_RESETPRIMASK() in my applicaton code main();
I have also tried NVIC_GenerateSystemReset() instead of jumping to
my code, and still I don't get data received correctly. It's driving
If I load up my bootloader and application code into flash through
uVision4, and run, I get interrupts and can receive data on USART1.
The problem occurs when the bootloader code is running, then the
flash is update and the PC jumps (or chip is reset) and the
application code runs.
What seems to be happening is this: After the user code
starts execution, I get a USART1 interrupt. The flags are:
SR : CTS = 0, LBD = 1, TXE = 1, TC = 1, RXNE = 1, IDLE = 1, ORE =
1, NE = 0, FE = 0, PE = 0
RXNEIE = 1
And then if I try to step over the following line of code in my
USART1 IRQ handler, the code window gets out of step.
if(USART_GetITStatus(USART1, USART_IT_RXNE) != RESET)
My application code still spews data form USART 1, but then
eventually I will get an error in uVision, trying to read data from
addresses that are in the bootloader code range, such as
Any tips greatly appreciated.