-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Verification of flash failed" for STM32L4S5 #814
Comments
There are two differences:
I think there is something wrong in the flash loader code when writing in 32bit mode, and the verify is done after it. Or the verify is broken in the 32bit mode. Long story short, there is something wrong with the st-flash tool. |
oh, thanks for quick answer. That was exactly my thought too, but proved wrong. This 32-bit mode is not the reason. I've discovered that both 8-bit and 32-bit modes may or may not fail. What i see consistently is when I flash using windows (stlink drag-drop) makes the future flashes from my Linux go fine, both 8-bit and 32-bit. I agree with you it is the st-flash,. Probably not yet made compatible with the STM32L4S5. |
further analysis reveals that it is the writing to the flash that does not work. The reading is fine. So when I previously successfully flashed with Windows st-Link utility, "flashing" the same file with st-flash results in success. Actually it does not do any flashing (nor erasing?), just reading and comparing. As soon as the file to flash changes, the verification does not work. It is a newer binary, but still the old flash content, created by st-link utility on Windows. |
I seem to have sorted this out. All boiled down to adding the (sibling) device STLINK_CHIPID_STM32_L4RX to wherever other L4s were in the if statements in the common.c. I do not know if it fixes the issue completely, but it certainly does for my needs. One thing I had to comment out was the voltage measurement in common.c: my voltage reading is always 0, and I currently do not have time to investigate why. cheers |
This is fixed with merge #839 |
st-info
,st-flash
,st-util
I have two of the same PCB. On one, the flashing works and the flow is as following:
pi@raspberrypi:~ $ st-flash write BaseSTM32L4S5.bin 0x8000000
st-flash 1.5.1-30-g84f63d2
2019-06-27T22:38:15 INFO common.c: Loading device parameters....
2019-06-27T22:38:15 INFO common.c: Device connected is: L4Rx device, id 0x100f6470
2019-06-27T22:38:15 INFO common.c: SRAM size: 0xa0000 bytes (640 KiB), Flash: 0x200000 bytes (2048 KiB) in pages of 4096 bytes
2019-06-27T22:38:15 INFO common.c: Attempting to write 652720 (0x9f5b0) bytes to stm32 address: 134217728 (0x8000000)
Flash page at addr: 0x0809f000 erasedEraseFlash - Sector:0x8 Size:0x1000
2019-06-27T22:38:20 INFO common.c: Finished erasing 160 pages of 4096 (0x1000) bytes
2019-06-27T22:38:20 INFO common.c: Starting Flash write for F2/F4/L4
2019-06-27T22:38:20 INFO flash_loader.c: Successfully loaded flash loader in sram
Target voltage (9 mV) too low for 32-bit flash, using 8-bit flash writes
size: 32768
size: 32768
size: 32768
size: 32768
size: 32768
size: 32768
size: 32768
size: 32768
size: 32768
size: 32768
size: 32768
size: 32768
size: 32768
size: 32768
size: 32768
size: 32768
size: 32768
size: 32768
size: 32768
size: 30128
2019-06-27T22:38:36 INFO common.c: Starting verification of write complete
2019-06-27T22:38:42 INFO common.c: Flash written and verified! jolly good!
On the other one it fails. The printout is below:
pi@raspberrypi:~ $ st-flash write BaseSTM32L4S5.bin 0x8000000
st-flash 1.5.1-30-g84f63d2
2019-06-27T22:40:37 INFO common.c: Loading device parameters....
2019-06-27T22:40:37 INFO common.c: Device connected is: L4Rx device, id 0x100f6470
2019-06-27T22:40:37 INFO common.c: SRAM size: 0xa0000 bytes (640 KiB), Flash: 0x200000 bytes (2048 KiB) in pages of 4096 bytes
2019-06-27T22:40:37 INFO common.c: Attempting to write 652720 (0x9f5b0) bytes to stm32 address: 134217728 (0x8000000)
Flash page at addr: 0x0809f000 erasedEraseFlash - Sector:0x8 Size:0x1000
2019-06-27T22:40:43 INFO common.c: Finished erasing 160 pages of 4096 (0x1000) bytes
2019-06-27T22:40:43 INFO common.c: Starting Flash write for F2/F4/L4
2019-06-27T22:40:43 INFO flash_loader.c: Successfully loaded flash loader in sram
enabling 32-bit flash writes
size: 32768
size: 32768
size: 32768
size: 32768
size: 32768
size: 32768
size: 32768
size: 32768
size: 32768
size: 32768
size: 32768
size: 32768
size: 32768
size: 32768
size: 32768
size: 32768
size: 32768
size: 32768
size: 32768
size: 30128
2019-06-27T22:40:58 INFO common.c: Starting verification of write complete
2019-06-27T22:40:58 ERROR common.c: Verification of flash failed at offset: 36864
stlink_fwrite_flash() == -1
Expected/description:
should flash the code without errors
The text was updated successfully, but these errors were encountered: