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

Nucleo-L073RZ: Device won't flash #593

Closed
6 tasks done
gordonhjs opened this issue May 15, 2017 · 5 comments · Fixed by #1113
Closed
6 tasks done

Nucleo-L073RZ: Device won't flash #593

gordonhjs opened this issue May 15, 2017 · 5 comments · Fixed by #1113

Comments

@gordonhjs
Copy link

Hi,

I ran into troubles to flash my nucleo-l073rz with st-flash and st-util/gdb:

  • Programmer/board type: Stlink/v2-onboard
  • Programmer firmware version: 2.28.18
  • Operating system: Mac OS X (10.12.4)
  • Stlink tools version and/or git commit hash: 5c10d4b
  • Stlink commandline tool name:st-flash, st-util
  • Target chip (and optional board): STM32L073RZ on Nucleo

st-flash output:

./st-flash --debug write fw.bin 0x8000000
...
169/170 pages written2017-05-15T14:57:16 DEBUG src/common.c: *** stlink_write_debug32 2000084c to 0x80054fc
2017-05-15T14:57:16 DEBUG src/common.c: *** stlink_read_debug32 10c is 0x40022018
2017-05-15T14:57:16 DEBUG src/common.c: *** stlink_write_debug32 2000084c to 0x8005500
2017-05-15T14:57:16 DEBUG src/common.c: *** stlink_read_debug32 10c is 0x40022018
2017-05-15T14:57:16 DEBUG src/common.c: *** stlink_write_debug32 20000854 to 0x8005504
2017-05-15T14:57:16 DEBUG src/common.c: *** stlink_read_debug32 10c is 0x40022018
2017-05-15T14:57:16 DEBUG src/common.c: *** stlink_write_debug32 20000854 to 0x8005508
2017-05-15T14:57:16 DEBUG src/common.c: *** stlink_read_debug32 10c is 0x40022018
2017-05-15T14:57:16 DEBUG src/common.c: *** stlink_write_debug32 20000 to 0x800550c
2017-05-15T14:57:16 DEBUG src/common.c: *** stlink_read_debug32 10c is 0x40022018
2017-05-15T14:57:16 DEBUG src/common.c: *** stlink_write_debug32 ffffffff to 0x8005510
2017-05-15T14:57:16 DEBUG src/common.c: *** stlink_read_debug32 10c is 0x40022018

2017-05-15T14:57:16 DEBUG src/common.c: *** stlink_read_debug32 7 is 0x40022004
2017-05-15T14:57:16 DEBUG src/common.c: *** stlink_write_debug32 7 to 0x40022004
2017-05-15T14:57:16 INFO src/common.c: Starting verification of write complete
2017-05-15T14:57:16 DEBUG src/common.c: *** stlink_read_mem32 ***
data_len = 128 0x80
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

2017-05-15T14:57:16 ERROR src/common.c: Verification of flash failed at offset: 0
2017-05-15T14:57:16 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x8000000
2017-05-15T14:57:16 DEBUG src/common.c: *** stlink_write_reg
data_len = 2 0x2
 80 00

2017-05-15T14:57:16 DEBUG src/common.c: *** stlink_read_debug32 0 is 0x8000004
2017-05-15T14:57:16 DEBUG src/common.c: *** stlink_write_reg
data_len = 2 0x2
 80 00

2017-05-15T14:57:16 DEBUG src/common.c: *** stlink_run ***
stlink_fwrite_flash() == -1
2017-05-15T14:57:16 DEBUG src/common.c: *** stlink_exit_debug_mode ***
2017-05-15T14:57:16 DEBUG src/common.c: *** stlink_write_debug32 a05f0000 to 0xe000edf0
2017-05-15T14:57:16 DEBUG src/common.c: *** stlink_close ***

Same issue withh st-util and gdb.

gdb output:

(gdb) load
Loading section .text, size 0x4888 lma 0x8000000
Loading section .init_array, size 0x10 lma 0x8004888
Loading section .ARM.extab, size 0x1d0 lma 0x8004898
Loading section .ARM.exidx, size 0x240 lma 0x8004a68
Loading section .data, size 0x86c lma 0x8004ca8
Error finishing flash operation

st-util output:

st-util 1.3.1-17-g5c10d4b
2017-05-15T14:59:05 INFO src/common.c: Loading device parameters....
2017-05-15T14:59:05 INFO src/common.c: Device connected is: L0x Category 5 device, id 0x20006447
2017-05-15T14:59:05 INFO src/common.c: SRAM size: 0x5000 bytes (20 KiB), Flash: 0x30000 bytes (192 KiB) in pages of 128 bytes
2017-05-15T14:59:05 INFO src/gdbserver/gdb-server.c: Chip ID is 00000447, Core ID is  0bc11477.
2017-05-15T14:59:05 INFO src/gdbserver/gdb-server.c: Listening at *:4242...
2017-05-15T14:59:11 INFO src/gdbserver/gdb-server.c: Found 4 hw breakpoint registers
2017-05-15T14:59:11 INFO src/gdbserver/gdb-server.c: GDB connected.
2017-05-15T14:59:17 INFO src/common.c: Attempting to write 128 (0x80) bytes to stm32 address: 134217728 (0x8000000)
Flash page at addr: 0x08000000 erased
2017-05-15T14:59:17 INFO src/common.c: Finished erasing 1 pages of 128 (0x80) bytes
2017-05-15T14:59:17 INFO src/common.c: Starting Half page flash write for STM32L core id
2017-05-15T14:59:17 INFO src/flash_loader.c: Successfully loaded flash loader in sram
2017-05-15T14:59:18 ERROR src/flash_loader.c: write error, count == 4294967295
2017-05-15T14:59:18 WARN src/common.c: l1_stlink_flash_loader_run(0x8000000) failed! == -1
2017-05-15T14:59:18 WARN src/common.c:
write_half_pages failed == -1
  0/  1 pages written
2017-05-15T14:59:18 INFO src/common.c: Starting verification of write complete
2017-05-15T14:59:18 ERROR src/common.c: Verification of flash failed at offset: 0

In both configurations I tried to do an erase beforehand with st-flash (which is working), but the output is the same.

This issue seems to be related to #579.

Thank you for your help, I'm available to make further tests.

@xor-gate
Copy link
Member

Strange, it looks this is not good:

2017-05-15T14:59:18 ERROR src/flash_loader.c: write error, count == 4294967295
2017-05-15T14:59:18 WARN src/common.c: l1_stlink_flash_loader_run(0x8000000) failed! == -1

An incorrect count is reported, and it is using the L1 flash loader for some reason.

@Faduf
Copy link

Faduf commented Apr 1, 2018

Have you tried with the Boot0 to Vdd before powering the board. This solved the problem for me.

@gordonhjs
Copy link
Author

I don't have the board anymore.
Anyway it was working on another same board reference.

The original board wasn't new when I got it, maybe the option bytes were configured with a bad watchdog or something.

@spth
Copy link

spth commented Apr 3, 2018

I see the same problem on two STM32L073NUCLEO-L073RZ boards. Both boards are new. Writing the flash via st-link worked at least once for each board, but soon after I only kept getting errors:

root@notebook5:/home/philipp/stlink/build/Release# ./st-flash --reset --format ihex write /home/philipp/stdcbench-trunk/stdcbench/stdcbench.ihx 
st-flash 1.4.0-19-gc0d759d
2018-04-03T11:05:36 INFO common.c: Loading device parameters....
2018-04-03T11:05:36 INFO common.c: Device connected is: L0x Category 5 device, id 0x20086447
2018-04-03T11:05:36 INFO common.c: SRAM size: 0x5000 bytes (20 KiB), Flash: 0x30000 bytes (192 KiB) in pages of 128 bytes
2018-04-03T11:05:36 INFO common.c: Attempting to write 532 (0x214) bytes to stm32 address: 134217728 (0x8000000)
Flash page at addr: 0x08000200 erased
2018-04-03T11:05:36 INFO common.c: Finished erasing 5 pages of 128 (0x80) bytes
2018-04-03T11:05:36 INFO common.c: Starting Half page flash write for STM32L core id
2018-04-03T11:05:36 INFO flash_loader.c: Successfully loaded flash loader in sram
2018-04-03T11:05:39 ERROR flash_loader.c: flash loader run error
2018-04-03T11:05:39 WARN common.c: l1_stlink_flash_loader_run(0x8000000) failed! == -1
2018-04-03T11:05:39 WARN common.c: 
write_half_pages failed == -1
  3/  4 pages written
2018-04-03T11:05:40 INFO common.c: Starting verification of write complete
2018-04-03T11:05:40 ERROR common.c: Verification of flash failed at offset: 0
stlink_fwrite_flash() == -1

Output with --debug is the same as in the original bug report.

Philipp

P.S.: The workaround of connecting BOOT0 to VDD works for me.

@Nightwalker-87 Nightwalker-87 modified the milestones: Unplanned (Contributions Welcome), Next, General, Feedback required Feb 19, 2020
@Nightwalker-87 Nightwalker-87 self-assigned this Feb 21, 2020
@Nightwalker-87 Nightwalker-87 removed their assignment Mar 15, 2020
@Nightwalker-87 Nightwalker-87 changed the title Nucleo-L073RZ won't flash Nucleo-L073RZ: Device won't flash Apr 2, 2020
@Nightwalker-87 Nightwalker-87 modified the milestones: Feedback required, Device issues, ERROR flash_loader.c: write error Apr 2, 2020
@Nightwalker-87
Copy link
Member

Please check if #876 resolves this problem as it resolves the related issue #579 mentioned in the opening post.

@Nightwalker-87 Nightwalker-87 modified the milestones: e) ERROR flash_loader.c: write error, a) Old issues Mar 11, 2021
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.

6 participants