Skip to content

[STM32G0B1RE]: st-flash fails seemingly randomly #1473

Description

@OpusElectronics

Hello, using st-flash 1.8.0 on Linux here.

When flashing a STM32G0B1RE on a Nucleo 64 board, flashing often (but not always) fails with the following sequence:

st-flash 1.8.0
2025-06-21T18:24:02 INFO common.c: STM32G0Bx_G0Cx: 144 KiB SRAM, 512 KiB flash in at least 2 KiB pages.
2025-06-21T18:24:02 WARN common_flash.c: Flash base use default L0 address
file NFC_Reader.bin md5 checksum: 5951891abe16bfd9fa234e522b8a4d87, stlink checksum: 0x006b9a59
2025-06-21T18:24:02 INFO common_flash.c: Attempting to write 74024 (0x12128) bytes to stm32 address: 134217728 (0x8000000)
-> Flash page at 0x8012000 erased (size: 0x800)
2025-06-21T18:24:02 INFO flash_loader.c: Starting Flash write for WB/G0/G4/L5/U5/H5/C0
 36/36  pages written
2025-06-21T18:24:11 ERROR common_flash.c: Invalid flash address
2025-06-21T18:24:11 ERROR common_flash.c: Flash programming error: 0x00000080
stlink_fwrite_flash() == -1

But sometimes, it succeeds. Even with the exact same binary file.
When it fails, it can fail similarly for a number of attempts. It will eventually succeed.

What I noticed, if that can help find the cause, is that when it fails as above, the erase phase seems to be almost instant, while when it succeeds, it takes a bit more time (enough so that we can see the message -> Flash page at 0x8012000 erased (size: 0x800) changing.

Here is the "normal" report when it succeeds:

st-flash 1.8.0
2025-06-21T18:15:17 INFO common.c: STM32G0Bx_G0Cx: 144 KiB SRAM, 512 KiB flash in at least 2 KiB pages.
2025-06-21T18:15:17 WARN common_flash.c: Flash base use default L0 address
file NFC_Reader.bin md5 checksum: 213d8763ec8b546a19e94ddff03a6f6, stlink checksum: 0x006b9a5b
2025-06-21T18:15:17 INFO common_flash.c: Attempting to write 74024 (0x12128) bytes to stm32 address: 134217728 (0x8000000)
-> Flash page at 0x8012000 erased (size: 0x800)
2025-06-21T18:15:18 INFO flash_loader.c: Starting Flash write for WB/G0/G4/L5/U5/H5/C0
 36/36  pages written
2025-06-21T18:15:28 INFO common_flash.c: Starting verification of write complete
2025-06-21T18:15:28 INFO common_flash.c: Flash written and verified! jolly good!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions