Skip to content
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

STM32F072CBU: ST-Flash fails randomly on Raspberry Pi 2 #556

Closed
6 tasks done
Galaxy88 opened this issue Feb 10, 2017 · 6 comments · Fixed by #1113
Closed
6 tasks done

STM32F072CBU: ST-Flash fails randomly on Raspberry Pi 2 #556

Galaxy88 opened this issue Feb 10, 2017 · 6 comments · Fixed by #1113

Comments

@Galaxy88
Copy link

Galaxy88 commented Feb 10, 2017

  • Programmer/board type: Stlink/v2,
  • Programmer firmware version: V2J25S4
  • Operating system: Raspbian 8.0 Linux raspberrypi 4.4.38-v7+
  • Stlink tools version and/or git commit hash: vv1.3.0-9-g88c6162
  • Stlink commandline tool name: st-flash
  • Target chip (and optional board): STM32F072CBU

I have a bug which appears on Raspbian (For info, it works perfectly on Windows 10 and Ubuntu 16.04). The st-flash will sometimes fail to program my target chip with either of the error messages:
home/pi/stlink/src/flash_loader.c: flash loader run error
ERROR /home/pi/stlink/src/common.c: stlink_flash_loader_run(0x8000000) failed! == -1

OR:

INFO /home/pi/stlink.git/src/common.c: Loading device parameters....
WARN /home/pi/stlink.git/src/common.c: unknown chip id! 0xa05f0000

I have tried erasing the Flash before programming as detailed in the README but this does not prevent the problem, only makes it less prevalent. Have seen the other closed issues but none of them seem to present both messages at the same time.

Thank you for your awesome tool.

Output:

INFO /home/pi/stlink.git/src/common.c: Loading device parameters....
WARN /home/pi/stlink.git/src/common.c: unknown chip id! 0xa05f0000
INFO /home/pi/stlink/src/common.c: Loading device parameters....
INFO /home/pi/stlink/src/common.c: Device connected is: F07x device, id 0x20016448
INFO /home/pi/stlink/src/common.c: SRAM size: 0x4000 bytes (16 KiB), Flash: 0x20000 bytes (128 KiB) in pages of 2048 bytes
INFO /home/pi/stlink/src/common.c: Attempting to write 42512 (0xa610) bytes to stm32 address: 134217728 (0x8000000)
Flash page at addr: 0x0800a000 erased
INFO /home/pi/stlink/src/common.c: Finished erasing 21 pages of 2048 (0x800) bytes
INFO /home/pi/stlink/src/common.c: Starting Flash write for VL/F0/F3 core id
INFO /home/pi/stlink/src/flash_loader.c: Successfully loaded flash loader in sram
ERROR /home/pi/stlink/src/flash_loader.c: flash loader run error
ERROR /home/pi/stlink/src/common.c: stlink_flash_loader_run(0x8000000) failed! == -1
stlink_fwrite_flash() == -1
@xor-gate
Copy link
Member

I must say, this is a very weird situation. I have seen people having trouble with a half broken USB cable. Not connected reset to target. You should try to upgrade the firmware of your programmer to V2J27 I have seen better results with this.

@Galaxy88
Copy link
Author

Hi thanks for the suggestion. Have upgraded the firmware of the programmer to V2J27 but the problem still persists randomly.

@xor-gate
Copy link
Member

To bad this didn't help. The difficult part is it happens "random", hopefully other people will spot this and can reproduce. Currently I have no idea or fix.

@xor-gate xor-gate added this to the Unplanned (Contributions Welcome) milestone Feb 14, 2017
@Nightwalker-87 Nightwalker-87 modified the milestones: Unplanned (Contributions Welcome), Next Feb 19, 2020
@Nightwalker-87 Nightwalker-87 modified the milestones: General, Feedback required Feb 23, 2020
@Nightwalker-87 Nightwalker-87 modified the milestones: Feedback required, Device issues Mar 31, 2020
@Nightwalker-87 Nightwalker-87 added the programmer/STLINK/V2 V2 / V2-A / V2-B label Mar 31, 2020
@Nightwalker-87 Nightwalker-87 changed the title ST-Flash fails randomly on Raspberry Pi 2 STM32F072CBU: ST-Flash fails randomly on Raspberry Pi 2 Mar 31, 2020
@Nightwalker-87 Nightwalker-87 modified the milestones: Device issues, Feedback required, Flash loader run errors Apr 6, 2020
@Nightwalker-87
Copy link
Member

Is this reproducible with a STM32F072 or any similar MCU in a comparable environment?
Tests should occur on the v1.3.1-patch branch at first.

@chenguokai
Copy link
Collaborator

chenguokai commented Jul 9, 2020

Since the flashing fails randomly and occurs on a RPI2, where undervolt occurs from time to time when it is connected with peripherals or running at a heavy load, I would suggest checking the volt of the ST MCU.

@Nightwalker-87 Nightwalker-87 modified the milestones: c) Flash loader run errors, a) Old issues Mar 11, 2021
@Nightwalker-87
Copy link
Member

Apart from the advice from @chenguokai this is also related to #356.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

5 participants