cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L4R9 fails execution by going to an invalid address for program execution.

SMano.1
Associate II

I am using an STM32L4R9ZIT. I have written a simple code to toggle a GPIO high and low, with a delay of 2 seconds in between. However, the controller never actually executes this functionality. When I run in debug mode, everything seems to be going alright if I manually run it line by line.

But the moment I let the controller resume execution and then pause it, I see that it is now execution code at a location of 0x1fff3a3c. However, my original program was located near 0x80000000.

The issue I think is that the program counter always gets corrupted at ends up near 0x1ff3a3c. However, this never happens when running through the program instruction by instruction.

Any help with this would be greatly appreciated.

6 REPLIES 6

BOOT0 pin needs to be pulled LOW

Or vector table at 0x08000000 invalid ​

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

Thanks for your help Tesla!

I had tried setting the options bits for nSWBOOT and nBOOT0 so that it would ignore the BOOT0 pin. But that didn't work.

BOOT0 was a floating pin on my board, so I soldered a wire to it and connected that to ground. But that didn't work either.

So I looked into the vector table. SCB->VTOR was set to 0.

I tried setting SCB->VTOR = 0x08000000. And now it works!!

Seems odd the ROM would be mapped by the SYSCFG unit

The SCB->VTOR is usually set to the link/build address basis in SystemInit()

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

Hello @SMano.1​ ,

That's strange. SCB->VTOR is the interrupt vector offset to the default one (depends on the boot configuration). It seems that there's more to your issue than VTOR configuration.

How did you set the boot user option bytes?

Best regards,

@SBEN .2​ 

Hi @SMano.1​ ,

the above linked thread now contains a solution, which probably helps you with this issue too.

JW