stlink: STM32F103C8T6 using St-link v2 doesn't flash on Ubuntu (works properly on windows)

Thank you for giving feedback to the stlink project.

NOTICE: Please read and follow instructions in #906 before submitting a ticket. This feature request will be deleted without notice when not enough information is provided! So please ensure that all fields are filled out.

  • I made serious effort to avoid creating duplicate or nearly similar issue

In order to allow developers and other contributors to isolate and target your respective issue, please take some time to fill out each of the following items appropriate to your specific problem:

  • Programmer/board type: st-link v2
  • Operating system and version: Linux (Ubuntu 20.04)
  • Stlink tools version and/or git commit hash: v1.6.1, v.1.6.0, v.1.5.1
  • Stlink commandline tool name: st-flash
  • Target chip (and board if applicable): STM32F103C8T6

Futher we kindly ask you to describe the detected problem as detailed as possible and to add debug output if available, by using the following template:

Commandline-Output:

st-flash --reset write /home/marcos/code/stm32/stm32f103vc-tempalte/main.bin 0x08000000

st-flash 1.6.0
2020-09-07T15:38:53 INFO common.c: Loading device parameters....
2020-09-07T15:38:53 INFO common.c: Device connected is: F1 Medium-density device, id 0x20000410
2020-09-07T15:38:53 INFO common.c: SRAM size: 0x5000 bytes (20 KiB), Flash: 0 bytes (0 KiB) in pages of 1024 bytes
Unknown memory region

st-flash --format=ihex write /home/marcos/code/stm32/stm32f103vc-tempalte/main.hex

st-flash 1.6.0
2020-09-07T15:38:53 INFO common.c: Loading device parameters....
2020-09-07T15:38:53 INFO common.c: Device connected is: F1 Medium-density device, id 0x20000410
2020-09-07T15:38:53 INFO common.c: SRAM size: 0x5000 bytes (20 KiB), Flash: 0 bytes (0 KiB) in pages of 1024 bytes
Unknown memory region

Expected/description:

I reviewed all issues related to this “Unknown memory region”, many of them point to a bad cable connection between st-link and bluepill (SCLK SDIO), but, i tested everything on windows 10 too, and i am able to flash successfully, so connection must be fine.

Everything else seems to be well recognized, as:

 st-info --probe  

Found 1 stlink programmers
 serial: 371a0b002c135737334d4e00
openocd: "\x37\x1a\x0b\x00\x2c\x13\x57\x37\x33\x4d\x4e\x00"
  flash: 0 (pagesize: 1024)
   sram: 20480
 chipid: 0x0410
  descr: F1 Medium-density device

Maybe is my fault, but i don’t know what else to do, i even installed everything from scratch in a different ubuntu machine (18.04) with same results.

Thank you for your support.

The stlink project maintainers

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 20 (10 by maintainers)

Commits related to this issue

Most upvoted comments

@Nightwalker-87 Thank you so much for your time and even more for your patience.

Hmm, I wouldn’t assess that writing concluded successfully:

020-09-29T19:26:38 INFO flash_loader.c: Successfully loaded flash loader in sram

3/57 pages written

2020-09-29T19:26:38 ERROR common.c: stlink_flash_loader_run(0x8000c00) failed! == -1
stlink_fwrite_flash() == -1

We need some improvement here as well. 😕 I’d need a STM32F1C8T6 Bluepill (Note: Not to be confused with STM32F1CBT6 !) with 128k to look into this. Mine only has the standard 64k flash.

For me, everything works as expected with v1.6.1 on Ubuntu 16.04 with a bluepill:

$ st-info --version
v1.6.1

$ st-info --probe
Found 1 stlink programmers
 serial:     500024001800003250334d4e
 hla-serial: "\x50\x00\x24\x00\x18\x00\x00\x32\x50\x33\x4d\x4e"
 flash:      65536 (pagesize: 1024)
 sram:       20480
 chipid:     0x0410
 descr:      F1xx Medium-density

$ st-flash --version
v1.6.1

$ st-flash write blinky.bin 0x8000000
st-flash 1.6.1
2020-09-11T06:39:55 INFO common.c: F1xx Medium-density: 20 KiB SRAM, 64 KiB flash in at least 1 KiB pages.
file blinky.bin md5 checksum: e378e365fc9787922c1d3514fb7d8d3e, stlink checksum: 0x0000c4a8
2020-09-11T06:39:55 INFO common.c: Attempting to write 688 (0x2b0) bytes to stm32 address: 134217728 (0x8000000)
2020-09-11T06:39:55 INFO common.c: Flash page at addr: 0x08000000 erased
2020-09-11T06:39:55 INFO common.c: Finished erasing 1 pages of 1024 (0x400) bytes
2020-09-11T06:39:55 INFO common.c: Starting Flash write for VL/F0/F3/F1_XL core id
2020-09-11T06:39:55 INFO flash_loader.c: Successfully loaded flash loader in sram
  1/1 pages written
2020-09-11T06:39:55 INFO common.c: Starting verification of write complete
2020-09-11T06:39:55 INFO common.c: Flash written and verified! jolly good!