Showing results for 
Search instead for 
Did you mean: 

Problem with V2.16.0 and STM32G0B0, Erasing Too Many Sectors

Associate III

STM32CubeProgrammer version 2.16.0

Target STM32G0B0RET6, device ID 0x467, Rev Z, 512KB flash, bootloader 0xD0

When loading a large bin file (425kB), the programmer tries to erase 65364 sectors! There's only 256 sectors in target, and the image only needs 212 sectors erased.

When using an ST-Link SWD interface it gets past this (albeit erasing entire flash) and programs the flash OK, but when using USB it just locks up.

It doesn't happen with smaller files that will fit in bank 1, just larger files that require 2 banks.

If I do a full chip erase first, then tick "skip flash erase before prog" then it avoids this problem. However I need to preserve config data at top of flash, so this is not a good workaround.

I think it's a similar problem to this post so I replied to that, then thought I should start a separate thread.

Here's some basic logs in case it helps. Via ST-Link:-


15:32:16 : File : wf3835-tank-combined.bin
15:32:16 : Size : 425.17 KB
15:32:16 : Address : 0x08000000
15:32:16 : Erasing memory corresponding to segment 0:
15:32:16 : Erasing internal memory sectors [0 65364]
15:32:20 : Download in Progress:
15:32:25 : File download complete


Via USB:-


12:14:06 : File : wf3835-tank-combined.bin
12:14:06 : Size : 425.17 KB
12:14:06 : Address : 0x08000000
12:14:06 : Erasing memory corresponding to segment 0:
12:14:06 : Erasing internal memory sectors [0 65364]
12:14:06 : erasing sector 0000 @: 0x08000000 done
12:14:12 : erasing sector 0255 @: 0x0807f800 done
12:14:12 : sector 0256 does not exist
etc until it locks up


Happy to post more info, logs etc, here, just ask. I can send you the bin file privately, pm me

Many thanks, Ben

ST Employee

Hello @BenMack99 

Can you share your.bin file.

Best Regards.


To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

@STTwo-32thanks for your quick reply, I have messaged it to you privately, please treat as confidential

@STTwo-32 any news on this? Thanks, Ben

Brief update, I just noticed that if I try to erase the first sector in bank2, i.e. index 256 address 0x08040000 (using the erase selected sector option on the cubeprog download tab), it says "sector 65280 does not exist". So it is clearly a problem with converting index to sector, in bank 2. Hopefully an easy fix?


ST Employee

Hello @BenMack99,

Regarding this issue related to sectors in bank 2, we are aware of it and it's currently under investigation by our development team.

Internal ticket number: 183909 (This is an internal tracking number and is not accessible or usable by customers).

I'll keep you updated.



In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Thanks for the update Amine, much appreciated