{"action":"created","issue":{"url":"https://api.github.com/repos/texane/stlink/issues/705","repository_url":"https://api.github.com/repos/texane/stlink","labels_url":"https://api.github.com/repos/texane/stlink/issues/705/labels{/name}","comments_url":"https://api.github.com/repos/texane/stlink/issues/705/comments","events_url":"https://api.github.com/repos/texane/stlink/issues/705/events","html_url":"https://github.com/texane/stlink/issues/705","id":311781462,"number":705,"title":"Can't flash STM32F030F4P6","user":{"login":"Keziolio","id":3357750,"avatar_url":"https://avatars2.githubusercontent.com/u/3357750?v=4","gravatar_id":"","url":"https://api.github.com/users/Keziolio","html_url":"https://github.com/Keziolio","followers_url":"https://api.github.com/users/Keziolio/followers","following_url":"https://api.github.com/users/Keziolio/following{/other_user}","gists_url":"https://api.github.com/users/Keziolio/gists{/gist_id}","starred_url":"https://api.github.com/users/Keziolio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Keziolio/subscriptions","organizations_url":"https://api.github.com/users/Keziolio/orgs","repos_url":"https://api.github.com/users/Keziolio/repos","events_url":"https://api.github.com/users/Keziolio/events{/privacy}","received_events_url":"https://api.github.com/users/Keziolio/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-04-05T21:50:09Z","updated_at":"2018-04-05T22:16:42Z","closed_at":null,"author_association":"NONE","body":"\r\n- [X] Programmer/board type: Stlink/v2\r\n- [ ] Programmer firmware version: Don't know\r\n- [X] Operating system: Arch Linux\r\n- [X] Stlink tools version: just compiled from git\r\n- [X] Stlink commandline tool name:  `st-flash`\r\n- [X] Target chip: STM32F030F4P6\r\n\r\n\r\n```\r\n ./st-flash  --reset write firmware.bin     0x8000000\r\nst-flash 1.4.0-32-gaaf8e92\r\n2018-04-05T23:36:50 INFO common.c: Loading device parameters....\r\n2018-04-05T23:36:50 INFO common.c: Device connected is: F0 small device, id 0x10006444\r\n2018-04-05T23:36:50 INFO common.c: SRAM size: 0x1000 bytes (4 KiB), Flash: 0x4000 bytes (16 KiB) in pages of 1024 bytes\r\n2018-04-05T23:36:50 INFO common.c: Attempting to write 5932 (0x172c) bytes to stm32 address: 134217728 (0x8000000)\r\nFlash page at addr: 0x08001400 erased\r\n2018-04-05T23:36:50 INFO common.c: Finished erasing 6 pages of 1024 (0x400) bytes\r\n2018-04-05T23:36:50 INFO common.c: Starting Flash write for VL/F0/F3/F1_XL core id\r\n2018-04-05T23:36:50 INFO flash_loader.c: Successfully loaded flash loader in sram\r\n2018-04-05T23:36:53 ERROR flash_loader.c: flash loader run error\r\n2018-04-05T23:36:53 ERROR common.c: stlink_flash_loader_run(0x8000000) failed! == -1\r\nstlink_fwrite_flash() == -1\r\n\r\n```\r\n```\r\n./st-info --probe\r\nFound 1 stlink programmers\r\n serial: 303030303030303030303031\r\nopenocd: \"\\x30\\x30\\x30\\x30\\x30\\x30\\x30\\x30\\x30\\x30\\x30\\x31\"\r\n  flash: 16384 (pagesize: 1024)\r\n   sram: 4096\r\n chipid: 0x0444\r\n  descr: F0 small device\r\n```\r\n\r\n\r\n\r\n\r\n\r\nI can't manage to flash one of these: https://www.ebay.com/itm/Mini-System-Development-Board-ARM-STM32-F030F4P6-CORTEX-M0-Core-32bit-48-MHz/331978736223?hash=item4d4b79825f:g:NncAAOSw-09aQKDm\r\n\r\nIt seems to --probe correctly, erase correctly, the stlink led flashes, but it does not flash the actual firmware, i tried to flash the same firmware with the same setup on an stm32f103c8t6 and it worked.\r\nI'm using a cheap chinese stlink clone.\r\n\r\n\r\nOutput with --debug:\r\n```\r\n2018-04-05T23:14:00 DEBUG common.c: stlink current mode: mass\r\n2018-04-05T23:14:00 DEBUG common.c: stlink current mode: mass\r\n2018-04-05T23:14:00 DEBUG common.c: *** stlink_enter_swd_mode ***\r\n2018-04-05T23:14:00 DEBUG common.c: *** looking up stlink version\r\n2018-04-05T23:14:00 DEBUG common.c: st vid         = 0x0483 (expect 0x0483)\r\n2018-04-05T23:14:00 DEBUG common.c: stlink pid     = 0x3748\r\n2018-04-05T23:14:00 DEBUG common.c: stlink version = 0x2\r\n2018-04-05T23:14:00 DEBUG common.c: jtag version   = 0x11\r\n2018-04-05T23:14:00 DEBUG common.c: swim version   = 0x4\r\n2018-04-05T23:14:00 DEBUG common.c: *** stlink_jtag_reset ***\r\n2018-04-05T23:14:00 DEBUG common.c: *** stlink_reset ***\r\n2018-04-05T23:14:01 INFO common.c: Loading device parameters....\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_core_id ***\r\n2018-04-05T23:14:01 DEBUG common.c: core_id = 0x0bb11477\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_read_debug32 0 is 0xe0042000\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_read_debug32 10006444 is 0x40015800\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_read_debug32 ffff0010 is 0x1ffff7cc\r\n2018-04-05T23:14:01 INFO common.c: Device connected is: F0 small device, id 0x10006444\r\n2018-04-05T23:14:01 INFO common.c: SRAM size: 0x1000 bytes (4 KiB), Flash: 0x4000 bytes (16 KiB) in pages of 1024 bytes\r\n2018-04-05T23:14:01 DEBUG common.c: *** set_swdclk ***\r\n2018-04-05T23:14:01 DEBUG common.c: stlink current mode: debug (jtag or swd)\r\n2018-04-05T23:14:01 DEBUG common.c: stlink current mode: debug (jtag or swd)\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_force_debug_mode ***\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_status ***\r\n2018-04-05T23:14:01 DEBUG common.c:   core status: halted\r\n2018-04-05T23:14:01 INFO common.c: Attempting to write 5932 (0x172c) bytes to stm32 address: 134217728 (0x8000000)\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_core_id ***\r\n2018-04-05T23:14:01 DEBUG common.c: core_id = 0x0bb11477\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_read_debug32 10 is 0x4002200c\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_read_debug32 1 is 0x40022010\r\n2018-04-05T23:14:01 DEBUG common.c: Successfully unlocked flash\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_write_debug32 2 to 0x40022010\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_write_debug32 8000000 to 0x40022014\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_read_debug32 2 is 0x40022010\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_write_debug32 42 to 0x40022010\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_read_debug32 10 is 0x4002200c\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_read_debug32 2 is 0x40022010\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_write_debug32 82 to 0x40022010\r\nst-flash 1.5.0\r\ndata_len = 2 0x2\r\n 77 14\r\n\r\n\r\nFlash page at addr: 0x08000000 erased2018-04-05T23:14:01 DEBUG common.c: *** stlink_read_debug32 10 is 0x4002200c\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_read_debug32 82 is 0x40022010\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_write_debug32 45670123 to 0x40022004\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_write_debug32 cdef89ab to 0x40022004\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_read_debug32 2 is 0x40022010\r\n2018-04-05T23:14:01 DEBUG common.c: Successfully unlocked flash\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_write_debug32 2 to 0x40022010\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_write_debug32 8000400 to 0x40022014\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_read_debug32 2 is 0x40022010\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_write_debug32 42 to 0x40022010\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_read_debug32 10 is 0x4002200c\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_read_debug32 2 is 0x40022010\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_write_debug32 82 to 0x40022010\r\n\r\nFlash page at addr: 0x08000400 erased2018-04-05T23:14:01 DEBUG common.c: *** stlink_read_debug32 10 is 0x4002200c\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_read_debug32 82 is 0x40022010\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_write_debug32 45670123 to 0x40022004\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_write_debug32 cdef89ab to 0x40022004\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_read_debug32 2 is 0x40022010\r\n2018-04-05T23:14:01 DEBUG common.c: Successfully unlocked flash\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_write_debug32 2 to 0x40022010\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_write_debug32 8000800 to 0x40022014\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_read_debug32 2 is 0x40022010\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_write_debug32 42 to 0x40022010\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_read_debug32 10 is 0x4002200c\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_read_debug32 2 is 0x40022010\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_write_debug32 82 to 0x40022010\r\n\r\nFlash page at addr: 0x08000800 erased2018-04-05T23:14:01 DEBUG common.c: *** stlink_read_debug32 10 is 0x4002200c\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_read_debug32 82 is 0x40022010\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_write_debug32 45670123 to 0x40022004\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_write_debug32 cdef89ab to 0x40022004\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_read_debug32 2 is 0x40022010\r\n2018-04-05T23:14:01 DEBUG common.c: Successfully unlocked flash\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_write_debug32 2 to 0x40022010\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_write_debug32 8000c00 to 0x40022014\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_read_debug32 2 is 0x40022010\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_write_debug32 42 to 0x40022010\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_read_debug32 10 is 0x4002200c\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_read_debug32 2 is 0x40022010\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_write_debug32 82 to 0x40022010\r\n\r\nFlash page at addr: 0x08000c00 erased2018-04-05T23:14:01 DEBUG common.c: *** stlink_read_debug32 10 is 0x4002200c\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_read_debug32 82 is 0x40022010\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_write_debug32 45670123 to 0x40022004\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_write_debug32 cdef89ab to 0x40022004\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_read_debug32 2 is 0x40022010\r\n2018-04-05T23:14:01 DEBUG common.c: Successfully unlocked flash\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_write_debug32 2 to 0x40022010\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_write_debug32 8001000 to 0x40022014\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_read_debug32 2 is 0x40022010\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_write_debug32 42 to 0x40022010\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_read_debug32 10 is 0x4002200c\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_read_debug32 2 is 0x40022010\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_write_debug32 82 to 0x40022010\r\n\r\nFlash page at addr: 0x08001000 erased2018-04-05T23:14:01 DEBUG common.c: *** stlink_read_debug32 10 is 0x4002200c\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_read_debug32 82 is 0x40022010\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_write_debug32 45670123 to 0x40022004\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_write_debug32 cdef89ab to 0x40022004\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_read_debug32 2 is 0x40022010\r\n2018-04-05T23:14:01 DEBUG common.c: Successfully unlocked flash\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_write_debug32 2 to 0x40022010\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_write_debug32 8001400 to 0x40022014\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_read_debug32 2 is 0x40022010\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_write_debug32 42 to 0x40022010\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_read_debug32 10 is 0x4002200c\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_read_debug32 2 is 0x40022010\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_write_debug32 82 to 0x40022010\r\n\r\nFlash page at addr: 0x08001400 erased2018-04-05T23:14:01 INFO common.c: Finished erasing 6 pages of 1024 (0x400) bytes\r\n2018-04-05T23:14:01 INFO common.c: Starting Flash write for VL/F0/F3/F1_XL core id\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_write_mem32 52 bytes to 0x20000000\r\n2018-04-05T23:14:01 INFO flash_loader.c: Successfully loaded flash loader in sram\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_read_debug32 82 is 0x40022010\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_write_debug32 45670123 to 0x40022004\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_write_debug32 cdef89ab to 0x40022004\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_read_debug32 2 is 0x40022010\r\n2018-04-05T23:14:01 DEBUG common.c: Successfully unlocked flash\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_read_debug32 2 is 0x40022010\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_write_debug32 1 to 0x40022010\r\n2018-04-05T23:14:01 DEBUG common.c: Finished unlocking flash, running loader!\r\n2018-04-05T23:14:01 DEBUG flash_loader.c: Running flash loader, write address:0x8000000, size: 1024\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_write_mem32 1024 bytes to 0x20000034\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_write_reg\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_write_reg\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_write_reg\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_write_reg\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_write_reg\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_run ***\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_status ***\r\n2018-04-05T23:14:01 DEBUG common.c:   core status: running\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_status ***\r\n2018-04-05T23:14:01 DEBUG common.c:   core status: running\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_status ***\r\n2018-04-05T23:14:01 DEBUG common.c:   core status: running\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_status ***\r\n2018-04-05T23:14:01 DEBUG common.c:   core status: running\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_status ***\r\n2018-04-05T23:14:01 DEBUG common.c:   core status: running\r\n2018-04-05T23:14:01 DEBUG common.c: *** stlink_status ***\r\n2018-04-05T23:14:01 DEBUG common.c:   core status: running\r\n\r\n...\r\n\r\n2018-04-05T23:14:04 DEBUG common.c: *** stlink_status ***\r\n2018-04-05T23:14:04 DEBUG common.c:   core status: running\r\n2018-04-05T23:14:04 DEBUG common.c: *** stlink_status ***\r\n2018-04-05T23:14:04 DEBUG common.c:   core status: running\r\n2018-04-05T23:14:04 DEBUG common.c: *** stlink_status ***\r\n2018-04-05T23:14:04 DEBUG common.c:   core status: running\r\n2018-04-05T23:14:04 DEBUG common.c: *** stlink_status ***\r\n2018-04-05T23:14:04 DEBUG common.c:   core status: running\r\n2018-04-05T23:14:04 DEBUG common.c: *** stlink_status ***\r\n2018-04-05T23:14:04 DEBUG common.c:   core status: running\r\n2018-04-05T23:14:04 DEBUG common.c: *** stlink_status ***\r\n2018-04-05T23:14:04 DEBUG common.c:   core status: running\r\n2018-04-05T23:14:04 DEBUG common.c: *** stlink_status ***\r\n2018-04-05T23:14:04 DEBUG common.c:   core status: running\r\n2018-04-05T23:14:04 ERROR flash_loader.c: flash loader run error\r\n2018-04-05T23:14:04 ERROR common.c: stlink_flash_loader_run(0x8000000) failed! == -1\r\n2018-04-05T23:14:04 DEBUG common.c: *** stlink_read_debug32 0 is 0x8000000\r\n2018-04-05T23:14:04 DEBUG common.c: *** stlink_write_reg\r\n2018-04-05T23:14:04 DEBUG common.c: *** stlink_read_debug32 0 is 0x8000004\r\n2018-04-05T23:14:04 DEBUG common.c: *** stlink_write_reg\r\n2018-04-05T23:14:04 DEBUG common.c: *** stlink_run ***\r\n2018-04-05T23:14:04 DEBUG common.c: *** stlink_exit_debug_mode ***\r\n2018-04-05T23:14:04 DEBUG common.c: *** stlink_write_debug32 a05f0000 to 0xe000edf0\r\n2018-04-05T23:14:04 DEBUG common.c: *** stlink_close ***\r\n\r\ndata_len = 2 0x2\r\n 80 00\r\n\r\ndata_len = 2 0x2\r\n 80 00\r\n\r\ndata_len = 2 0x2\r\n 80 00\r\n\r\ndata_len = 2 0x2\r\n 80 00\r\n\r\ndata_len = 2 0x2\r\n 80 00\r\n\r\ndata_len = 2 0x2\r\n 81 00\r\n\r\ndata_len = 2 0x2\r\n 81 00\r\n\r\nstlink_fwrite_flash() == -1\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/texane/stlink/issues/comments/379093391","html_url":"https://github.com/texane/stlink/issues/705#issuecomment-379093391","issue_url":"https://api.github.com/repos/texane/stlink/issues/705","id":379093391,"user":{"login":"Keziolio","id":3357750,"avatar_url":"https://avatars2.githubusercontent.com/u/3357750?v=4","gravatar_id":"","url":"https://api.github.com/users/Keziolio","html_url":"https://github.com/Keziolio","followers_url":"https://api.github.com/users/Keziolio/followers","following_url":"https://api.github.com/users/Keziolio/following{/other_user}","gists_url":"https://api.github.com/users/Keziolio/gists{/gist_id}","starred_url":"https://api.github.com/users/Keziolio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Keziolio/subscriptions","organizations_url":"https://api.github.com/users/Keziolio/orgs","repos_url":"https://api.github.com/users/Keziolio/repos","events_url":"https://api.github.com/users/Keziolio/events{/privacy}","received_events_url":"https://api.github.com/users/Keziolio/received_events","type":"User","site_admin":false},"created_at":"2018-04-05T22:16:42Z","updated_at":"2018-04-05T22:16:42Z","author_association":"NONE","body":"Ok the issue was that the chip had the usual write protection enabled, I had to use a serial adapter and execute this other tool\r\n\r\n```\r\nstm32flash -k /dev/ttyUSB0\r\n```\r\n\r\nTo unlock it.\r\n\r\nSo, maybe, this issue can be changed to \"make st-flash give an appropriate warning on what's happening\" because this was rather counter intuitive"}}
{"actor":{"display_login":"Keziolio"}}