2023-06-16 05:52 PM
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)
If I'm doing something wrong, suggestions would be appreciated!
2023-07-11 08:26 AM
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
2023-07-17 12:54 PM - edited 2023-07-17 12:58 PM
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.
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.
2023-07-17 01:11 PM
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?
2023-07-17 01:42 PM
@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
2023-07-17 06:11 PM
@Tesla DeLorean you have disabled sending private messages in your profile. Is this intentional?
2023-07-18 07:48 AM
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.
2023-07-18 08:33 AM
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.
2023-07-18 10:58 AM
Yes
2023-07-19 04:14 PM - edited 2023-07-19 04:15 PM
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.