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-19 05:01 PM
Let me guess... "Good day, sir! I did a co degeneration and something doesn't work. I kindly request you to give me a solution to the issue. This is very important and ASAP. Thank you, sir." Or... "helo deer brother1"
2023-07-26 06:17 AM
Hello @DAlbe.3 ,
Sorry for the late reply,
After further investigation, we figured that the erase is not working properly on this device. This led to a failure during the download. The sector size issue is also confirmed.
These issues are reported to the development team and will be fixed in the upcoming release. I'll keep you posted.
Internal ticket number: 157508 (This is an internal tracking number and is not accessible or usable by customers).
Thanks for your contribution,
Sara.
2023-07-26 06:46 AM
I'm experiencing the same issue. Will downgrading the STM32CubeProgrammer work or is it also in prior versions?
2023-07-26 04:19 PM - edited 2023-07-26 04:20 PM
Thank you Sara.
It may be stating the obvious, but the bug is in STM32_Prog_DB_0x415.xml. In my case, I am using the 512K single bank configuration so line 148 should read:
<Parameters address="0x08000000" name="sector0" occurrence="0x100" size="0x800"/>
For anyone else with this issue who needs a fix before the next update, replacing line 148 in the above-mentioned file does indeed fix the problem. For windows users, the file is in C:/Program Files/STMicroelectronics/STM32Cube/STM32CubeProgrammer/Data_Base
2023-07-27 01:16 AM
Good find !! Thanks !
2023-07-27 05:09 AM - edited 2023-07-27 05:17 AM
I think I'm experiencing a similar issue with an NUCLEO-WB15CC. Also can't flash two seperate programs without erasing flash first. I also get these "Data mismatch" errors all the time..
I am running STM32CubeProgrammer v2.14.0 but also tested with v2.8.0 and 2.8.10, where I experienced the same issues.
2023-07-27 05:58 AM
Hi tester, that board uses an STM32WB55RG processor with 1MB Flash; it is handled by the database file STM32_Prog_DB_0x495.xml and the Embedded Flash description looks correct there:
<Parameters address="0x08000000" name="sector0" occurrence="0x100" size="0x1000"/>
Since that part has 4KB sectors.
I believe it is a single-bank only part (i.e. you can't split Flash into two 512K segments). Can you share specifically how you are loading the programs? Are you loading one program and then trying to overwrite it with the next and getting errors? On the Erasing & Programming page, is "Skip flash erase before programming checked"?
2023-07-27 06:16 AM - edited 2023-07-27 06:34 AM
I am pretty sure the NUCLEO-WB15CC uses an STM32WB15CC, with 320kB Flash, right? At least thats the target information I'm getting. So it should be ID 0x494. That's what's currently in that line:
<Parameters address="0x08000000" name="sector0" occurrence="0xA0" size="0x800"/>
But I am unsure what to change here.
I am currently trying to load the OTA application and my "user application" separately and everytime I uploaded my code from the CudeIDE, the OTA Applicaiton was overriden, eventhough I changed the linker script. The OTA application should only be flashed from 0x08000000 to 0x08007000 and the user application starting from 0x08007000, right?
My solution for right now is using a powershell script with STM32_Programmer_CLI which erases flash, and then flashes the user code first and finally the OTA application
2023-07-27 07:28 AM
I apologize, I have the WB55 and didn't realize (and didn't read closely enough) to see that you have a WB15. You are, of course, correct that the 15 has the 320KB flash processor which is referenced in the file STM32_Prog_DB_0x494.xml. As you point out, the xml configuration looks correct (160 x 2KB sectors per RM0473) so it doesn't look like this is the same issue.
I haven't used the OTA application, but I'll take a look at it as time permits and let you know if I see anything there. Are you able to share a screen capture showing the Cube Programmer GUI flashing your user app? When you load the .hex file into STM32CubeProgrammer GUI, does it show the start address and length correctly?