Skip to main content
gerhard
Associate III
October 30, 2023
Solved

New STM32L431KC does not program or run unless mass erase is performed first.

  • October 30, 2023
  • 2 replies
  • 1256 views

When first programming a New STM32L431KC, it does not program or run unless mass erase is performed first.

I use IAR and STLINK/V2

From IAR, I try:

a) Download program - uC does not run, even after reset

b) Start debugging session - Does not execute code. Gets stuck "hang" on HAL_Delay(xx) statement.

When I use STM32MXProgrammer and ERASE all flash, then the programming works, and I can download from IAR.

Any help appreciated.

This topic has been closed for replies.
Best answer by waclawek.jan

I don't use IAR but you can try to power-cycle the board after first programming.

Alternatively, change explicitly the 0x0000'0000 remap to user FLASH at the beginning of your program; or, maybe better, set VTOR to 0x0800'0000.

JW

2 replies

waclawek.jan
waclawek.janBest answer
Super User
October 31, 2023

I don't use IAR but you can try to power-cycle the board after first programming.

Alternatively, change explicitly the 0x0000'0000 remap to user FLASH at the beginning of your program; or, maybe better, set VTOR to 0x0800'0000.

JW

gerhard
gerhardAuthor
Associate III
November 1, 2023

Thanks, and yes that works.

The F051, L051, L052 and others does not do that.

The only difference on the boards is the on the L431 I use a 32KHz resonator.

Perhaps that is it.