cancel
Showing results for 
Search instead for 
Did you mean: 

Controller stalls at NVIC_EnableIRQ(CAN_TX_IRQn) after jump to application from a bootloader.

MGand.1
Associate II

Hi,

I am using a CAN bootloader to update my application. But after flashing the application and jumping from the bootloader to the reset vector of the app, the program stalls after calling NVIC_EnableIRQ(CAN_TX_IRQn). Is there a problem that the bootloader already used the CAN peripheral?

The bootloader resets and stops the peripheral before the jump.

Controller is a STM32F303RE.

Before NVIC_EnableIRQ is called, the peripheral registers have the following values:

MCR = 0x0001004c

MSR = 0x00000c00

TSR = 0x1c000003

RF0R, RF1R = 0

IER = 0x00008f03

ESR = 0

BTR = 0x012d000f

Update:

I looks like the application calls the old interrupt routine address of the bootloader

0690X00000BufjIQAR.png

0690X00000BufjiQAB.png

 .text.TgtCAN1TXIsr
                0x08009be8        0xc VisualGDB/Debug/target.o
                0x08009be8                TgtCAN1TXIsr

1 ACCEPTED SOLUTION

Accepted Solutions

Make sure you correctly configure the Vector Table, via SCB->VTOR, typically in SystemInit()

Don't call from an interrupt/callback.

Have HardFault_Handler and ErrorHandler output useful / actionable information.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

5 REPLIES 5

Make sure you correctly configure the Vector Table, via SCB->VTOR, typically in SystemInit()

Don't call from an interrupt/callback.

Have HardFault_Handler and ErrorHandler output useful / actionable information.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
MGand.1
Associate II

Before the jump to the application the bootloader set stack pointer and the vtor pointer, after the start of the application the

SystemInit overrides with the old flash start value 0x08000000.

> ... after the start of the application the SystemInit overrides with the old flash start value 0x08000000.

Then you might need to adapt your application / SystemInit.

Both bootloader and application are supposed to harmonize in this regard.

That would be because you haven't accounted for.the change in location. ST has coded this poorly, code it better.​ The use of a linker fixed symbol would make the code agnostic.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Thank you, I have know added an additional variable that sets the flash origin in my linker script and SystemInit uses this variable to define VTOR.