cancel
Showing results for 
Search instead for 
Did you mean: 

[SOLVED] Crash if BOOT0 pin is high

winotix
Associate II

Hello Dear Experts,

I have strange behavior on my STM3210 board.

I flash my binary using STLink and it works well.

Then I toggle BOOT0 pin in order to use the standard bootloader in the system memory and I reset the system.

The bootloader starts and listens UART.

I send the "GO" command over UART from the CubeProgrammer app (no flashing/reading, only "GO" command).

In debugger I see that it jumps to the main() function as expected.

BUT after calling a few functions it crashes somewhere and the PC register becomes "0x1fffeade".

If I disable the BOOT0 pin and restart - everything works well again.

I've no idea how to debug that, please help.

Thank you.

UPD: Thanks to @Community member​ just realized that "0x1fffeade" address is in the system memory region => Looks like the "crash" is actually "restart".

By why does it restart?

1 ACCEPTED SOLUTION

Accepted Solutions

>>I don't enable it in my code.

But your code isn't starting the device is it? If you inherit the watchdog, you're going to have to keep kicking it otherwise the CPU will restart and reenter the ROM based on the BOOT0 pin state.

>>..and is not disabled automatically?

As I understand the functionality you specifically CAN'T disable it

Make sure you get SCB->VTOR set early in your code, the ROM is mapped at zero, the default for SCB->VTOR is zero, and you want it pointing at FLASH at 0x08000000

>>STM3210 board

?? One of the early series F103 EVAL boards (C, D, E..)

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

6 REPLIES 6

Might need to kick the watchdog

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

Do you mean the IWDG? I don't enable it in my code.

Or is there another watchdog that is activated for the bootloader and is not disabled automatically?

In the doc I see the following

0693W00000D2LbEQAV.png

Also, the "crash" I observe happens immediately (doesn't seem to be a watchdog "configured to its maximum value")

>>I don't enable it in my code.

But your code isn't starting the device is it? If you inherit the watchdog, you're going to have to keep kicking it otherwise the CPU will restart and reenter the ROM based on the BOOT0 pin state.

>>..and is not disabled automatically?

As I understand the functionality you specifically CAN'T disable it

Make sure you get SCB->VTOR set early in your code, the ROM is mapped at zero, the default for SCB->VTOR is zero, and you want it pointing at FLASH at 0x08000000

>>STM3210 board

?? One of the early series F103 EVAL boards (C, D, E..)

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

(The board is STM3210E-EVAL)

Thank you, I think that's the right direction.

The SCB->VTOR == 0x1fffe000 in my case. If I manually change it to 0x0800000 - it works!

Now two questions:

  • Where is it set (SystemInit() doesn't set it)
  • Do I change the default value by defining USER_VECT_TAB_ADDRESS ?

winotix
Associate II

Thanks a lot @Community member​ !

Fixed by enabling the USER_VECT_TAB_ADDRESS that forces initialization of SCB->VTOR with the base FLASH address in SystemInit() function.