cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeProgrammer 2.13.0 miscalculates flash sectors to erase

DAlbe.3
Senior

When loading a .hex file into flash, the STM32CubeProgrammer (v 2.13.0) miscalculates which sectors to erase and as a result, the download often fails unless the region being loaded has been previously erased or happens to contain the same values.

For example (see attached image), when loading an image that is 0x23B74 bytes (142.86KB) bytes to address 0x08004000 in an STM32L471 (256 x 2K sectors), it erases sectors 4..39. 

The start sector for address 0x08004000 should be 8 (8 x 2048 = 0x4000) and the end sector (0x08004000+0x23B74=0x08027B74) should be 0x4F (79 decimal)

stm32cubeprogrammer_erase_error.jpg

If I'm doing something wrong, suggestions would be appreciated!

18 REPLIES 18

Check https://community.st.com/t5/stm32cubeprogrammer-mcu/stm32cubeprogrammer-2-14-0-released/td-p/573439

If still an issue, will flag for additional review / analysis

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

Unfortunately, no change with 2.14.0.  It recognizes the device type (it is an STM32L471 - see below) but is not calculating sectors properly (the STM32L471 uses 2K sectors).  So loading a file to 0x08004000 (16K offset into flash) should start at sector 8, not 4.

DAlbe3_0-1689623507793.png

DAlbe3_1-1689623533110.png

From the reference manual (RM0351):
The Flash memory is divided in two banks. Each bank is organized as follows:
• A main memory block containing 256 pages of 2 Kbyte. Each page is made of 8 rows of
256 bytes.

DAlbe.3
Senior

It's pretty clear that the STM32CubeProgrammer simply isn't correctly recognizing the flash layout of the STM32L471.  It clearly thinks it has 4K sectors.  Any chance we can get a beta fix for this?

DAlbe3_0-1689624664599.png

 

@Imen.D @Nawres GHARBI Please add this to the open issues list if not already on there.

We also really need to fix the user finding tool on the forum, 5 names, no scrolling / no employee filtering ?? You've got a forum with ~62K users

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

@Tesla DeLorean you have disabled sending private messages in your profile. Is this intentional?

Sara BEN HADJ YAHYA
ST Employee

Hello @DAlbe.3 ,

Thanks for your feedback,

This issue is under investigation, I will get back to you with more details as soon as possible.

Sara.

DAlbe.3
Senior

Thank you Sara! 
I am hoping (and expect) that it is just a wrong sector size entry in a table that maps processor ID to flash layout.

Yes

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

In case it helps, this problem seems to be specific to the STM32L471.  I have some early prototypes that use the STM32L476 and the sectors are calculated correctly for them.