[SOLVED] ST-Link bug?

Please post bugs and enhancements for the STM core here
Post Reply
User avatar
ekawahyu
Posts: 107
Joined: Wed Apr 13, 2016 6:17 am

[SOLVED] ST-Link bug?

Post by ekawahyu » Thu Sep 21, 2017 8:24 pm

I am porting STM32F072RB Discovery and so far it's been working with the Blink example. However, I notice that it takes two hits to flash the board through ST-Link. The first hit is always failed. Is this a known bug within STM core?

Another thing, after it successfully programs the board, it does not seem to reboot it. I have to press the reset button to see it working. Is this also a known bug with ST-Link?
Last edited by ekawahyu on Sat Sep 23, 2017 4:20 am, edited 1 time in total.

fpiSTM
Posts: 243
Joined: Fri Sep 16, 2016 12:33 pm
Location: Le Mans, France

Re: ST-Link bug?

Post by fpiSTM » Thu Sep 21, 2017 8:29 pm

Hi, on which OS you run Arduino?

User avatar
ekawahyu
Posts: 107
Joined: Wed Apr 13, 2016 6:17 am

Re: ST-Link bug?

Post by ekawahyu » Fri Sep 22, 2017 6:24 am

Arduino 1.6.9 on OS X 10.10.5

When the Discovery board is running, re-flashing it would fail all the time:

Code: Select all

2017-09-22T00:01:06 INFO /Users/jerry/Downloads/stlink-master/src/common.c: Loading device parameters....
2017-09-22T00:01:06 INFO /Users/jerry/Downloads/stlink-master/src/common.c: Device connected is: F07x device, id 0x20016448
2017-09-22T00:01:06 INFO /Users/jerry/Downloads/stlink-master/src/common.c: SRAM size: 0x4000 bytes (16 KiB), Flash: 0x20000 bytes (128 KiB) in pages of 2048 bytes
2017-09-22T00:01:06 INFO /Users/jerry/Downloads/stlink-master/src/common.c: Attempting to write 15220 (0x3b74) bytes to stm32 address: 134217728 (0x8000000)
st-flash 1.3.0

Flash page at addr: 0x08000000 erased
Flash page at addr: 0x08000800 erased
Flash page at addr: 0x08001000 erased
Flash page at addr: 0x08001800 erased
Flash page at addr: 0x08002000 erased
Flash page at addr: 0x08002800 erased2017-09-22T00:01:06 INFO /Users/jerry/Downloads/stlink-master/src/common.c: Finished erasing 8 pages of 2048 (0x800) bytes
2017-09-22T00:01:06 INFO /Users/jerry/Downloads/stlink-master/src/common.c: Starting Flash write for VL/F0/F3 core id
2017-09-22T00:01:06 INFO /Users/jerry/Downloads/stlink-master/src/flash_loader.c: Successfully loaded flash loader in sram

Flash page at addr: 0x08003000 erased
Flash page at addr: 0x08003800 erased2017-09-22T00:01:08 ERROR /Users/jerry/Downloads/stlink-master/src/flash_loader.c: flash loader run error
2017-09-22T00:01:08 ERROR /Users/jerry/Downloads/stlink-master/src/common.c: stlink_flash_loader_run(0x8000000) failed! == -1

stlink_fwrite_flash() == -1
At this point, the board seems halted or simply stops working. The second try would always be successful:

Code: Select all

2017-09-22T00:03:51 INFO /Users/jerry/Downloads/stlink-master/src/common.c: Loading device parameters....
2017-09-22T00:03:51 INFO /Users/jerry/Downloads/stlink-master/src/common.c: Device connected is: F07x device, id 0x20016448
2017-09-22T00:03:51 INFO /Users/jerry/Downloads/stlink-master/src/common.c: SRAM size: 0x4000 bytes (16 KiB), Flash: 0x20000 bytes (128 KiB) in pages of 2048 bytes
2017-09-22T00:03:51 INFO /Users/jerry/Downloads/stlink-master/src/common.c: Attempting to write 15220 (0x3b74) bytes to stm32 address: 134217728 (0x8000000)
st-flash 1.3.0

Flash page at addr: 0x08000000 erased
Flash page at addr: 0x08000800 erased
Flash page at addr: 0x08001000 erased
Flash page at addr: 0x08001800 erased2017-09-22T00:03:51 INFO /Users/jerry/Downloads/stlink-master/src/common.c: Finished erasing 8 pages of 2048 (0x800) bytes
2017-09-22T00:03:51 INFO /Users/jerry/Downloads/stlink-master/src/common.c: Starting Flash write for VL/F0/F3 core id
2017-09-22T00:03:51 INFO /Users/jerry/Downloads/stlink-master/src/flash_loader.c: Successfully loaded flash loader in sram

Flash page at addr: 0x08002000 erased
Flash page at addr: 0x08002800 erased
Flash page at addr: 0x08003000 erased
Flash page at addr: 0x08003800 erased

  0/7 pages written
  1/7 pages written
  2/7 pages written
  3/7 pages written
  4/7 pages written
  5/7 pages written2017-09-22T00:03:52 INFO /Users/jerry/Downloads/stlink-master/src/common.c: Starting verification of write complete

  6/7 pages written
  7/7 pages written2017-09-22T00:03:52 INFO /Users/jerry/Downloads/stlink-master/src/common.c: Flash written and verified! jolly good!

fpiSTM
Posts: 243
Joined: Fri Sep 16, 2016 12:33 pm
Location: Le Mans, France

Re: ST-Link bug?

Post by fpiSTM » Fri Sep 22, 2017 7:37 am

Ok thanks.
So, two possibilities:
1- old firmware, please upgrade it thanks the ST-LINK/V2-1 firmware upgrade available here:
https://my.st.com/content/my_st_com/en/ ... NK007.html
2- issue with the texane stlink software used for Mac OS. we use the version1.3.0 but there is a new one 1.4.0, unfortunately they do not provide a build version.

So first try to update the STLink firmware, please.

Edit: there are several similar issues open on texane stlink github.

User avatar
ekawahyu
Posts: 107
Joined: Wed Apr 13, 2016 6:17 am

Re: ST-Link bug?

Post by ekawahyu » Fri Sep 22, 2017 8:09 pm

Ok, updating the ST-LINK V2 firmware to the latest did the trick. Texane 1.3.0 works just fine with the latest ST-LINK V2 on OS X. Thanks!

fpiSTM
Posts: 243
Joined: Fri Sep 16, 2016 12:33 pm
Location: Le Mans, France

Re: [SOLVED]ST-Link bug?

Post by fpiSTM » Sat Sep 23, 2017 7:07 am

Welcome ;)

Post Reply