-
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
STM32L052 flash loader run error: write_half_pages failed == -1 #817
Comments
It is possible there is a bug in the algorithm for programming the flash and leaves it in an odd state where you can only recover from using powercycle. Always make sure you use the latest HEAD version of the texane/stlink repository, or else we are unable to support you. Also it needs investigation why it fails. Most flash drivers are identical for a series of processors so I think indeed the "L0x3" should not be the issue. You could also dig into the git history to see the original author of the STM32L flash driver as I have no detailed knowledge why it should not work. Thanks for reporting! |
Thanks for the reply. I had pulled down the head of the repository and built it; it seems to behave much better. It is also tagged as 1.5.2 (IIRC, I know it was 1.5.x) so ignore my mumble about 1.3.0 before; the summary must be out of date. |
@Ant-ON: What's your opinion on this one? |
@Nightwalker-87 Yes, the error is different since the flash loading code for L0 and L1 is slightly different from other series. Most likely the problem in |
Closed by #1113. |
(See closed issue #269, as well.)
Summary:
Remote flashing via gdb often (? 30%) fails with "write_half_pages failed == -1"
Details:
I am using st-util 1.4.0 on MacOS to drive the ST-LINK half of a Discovery STM32L0308 as my debugging tool. The ST-LINK is running firmware V2J34S0 . I debug with GDB ("GNU gdb (GNU Tools for ARM Embedded Processors) 7.8.0.20150604-cvs").
The target is a bare-bones STM32L052K8 . I connect the Discovery's SWDIO/CLK to STM32L0 PA13/PA14 respectively, NRST to STM32L0 NRST, Vpp to the STM32 Vcc/Vss, and the STM32L0 BOOT0 is pulled to ground. The STM32 GPIOs are configured for I2C, SPI, and polling simple SPST switches.
The STM32L052 is USB-powered. I read a steady 5v01 at Vusb, and I feed that into an 800mA 3.3V regulator (TC1265-3.3). It shows a steady 3v28 output. With the Cortex busy-spinning awaiting a debug, current is well below 800mA - I read 24 - 30mA at the USB pins (regulator Vin).
Upon launching st-util, the target is identifed as such:
I notice st-util displays "L0x3" while my target is indeed STM32L052, but have no reason to think this is an issue. I have not pulled the sources to check that, I confess.
Debugging is generally robust. I only have issues with the loading of flash.
Using the GDB 'load' command to update system flash, there is a high probability that st-util will begin to fail to write half-pages. The failures are not always at the same half-page. Once this is encountered, the only workaround I have found is to remove power from the ST-LINK, re-apply power, and reconnect GDB to a new instance of st-util .
Each failure seems to stall for a few seconds before proceeding.
Once power cycled and with a new instance of st-util, the same load almost 100% always works the first time.
I have looked through other topics and seen similar problems as well, but some years ago and resolved.
I notice that the head of this repository appears to be 1.3.0, but mine claims to be 1.4.0. I've been using my copy of st-util for a while and put it aside for another project; now I don't recall where I downloaded this version.
Any wisdom one may have on this problem will be appreciated. I hope I have provided the right amount of information.
Thank you for your time.
The text was updated successfully, but these errors were encountered: