cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G491 and BOOT_LOCK

mccabehm
Senior

STM32G491KEU3 on custom board. Using STM32CubeProgrammer to read/change option bytes.

With BOOT_LOCK unchecked I use STM32CubeIDE to flash and debug my project. However SysTick_Handler() is never called, so HAL_GetTick() always returns the same value (zero). 

With BOOT_LOCK checked, HAL_GetTick() returns incrementing tick counts as expected.

I thought I understood the ref manual description of BOOT_LOCK. Does BOOT_LOCK do other things?

3 REPLIES 3
TDK
Super User

BOOT_LOCK doesn't affect systicks. If BOOT0 is floating, maybe it's going into the bootloader rather than user flash. when BOOT_LOCK=0. How are the relevant option bits configured?

If you feel a post has answered your question, please click "Accept as Solution".
mccabehm
Senior

#1 Originally I had:

  • BOOT_LOCK 0
  • nBOOT1 1
  • nBOOT0 1
  • nSWBOOT0 1

Using STM32CubeIDE I could flash and debug, but no systick. MCU reset did not boot from flash.

#2 I changed to:

  • BOOT_LOCK 1

I could flash and debug, systick OK. MCU reset booted from flash.

#3 Then I realized PB8 used for CAN. Changed to:

  • BOOT_LOCK 0
  • nBOOT1 1
  • nBOOT0 1
  • nSWBOOT0 0

I could flash and debug, systick OK. MCU reset booted from flash.

Either #2 or #3 above work OK.

For #1, I am curious why no systick. System bootloader disables systick and HAL_Init() doesn't enable? Doubtful.

TDK
Super User

Probably what happens is the chip starts up in the bootloader and then the debugger jumps to the main code with a partially initialized system. Bootloader may be disabling interrupts during a critical section. Check to see if global interrupts are disabled.

If you feel a post has answered your question, please click "Accept as Solution".