2021-07-03 12:22 PM
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.
2021-07-03 02:08 PM
BOOT0 pin needs to be pulled LOW
Or vector table at 0x08000000 invalid
2021-07-03 09:34 PM
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!!
2021-07-04 06:35 AM
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()
2021-07-04 06:59 AM
2021-07-04 05:08 PM
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
2021-07-14 05:37 AM
Hi @SMano.1 ,
the above linked thread now contains a solution, which probably helps you with this issue too.
JW