Skip to content

USB Issues after bad code write #50

vaibhav-kapoor opened this Issue Jan 24, 2012 · 2 comments

2 participants


Hi, just yesterday I had flashed some PWM code relating to the PD12-15 pins, and for some reason after that the board would not be recognized by the computer, both on Windows and Linux. If I held down the reset button the computer successfully recognizes the chip and I can upload code to it. Unfortunately the code doesn't do anything once uploaded and the behavior is the same. It registers as an unknown device in Windows.

Now someone on the forums mentioned that if pull the BOOT0 pin up to the supply that it can reupload the code. So it seems to work, but it doesn't now code get's maybe 90% uploaded but always results in error. I have also erased the chip using ST-Link utility. So the problem with detection is not gone away the only way to upload code

This is an example of the error I get:

[TheLegace@localhost discovery_demo]$ flash write STM32F4-Discovery_Demo.bin 0x8000000
2012-01-23T20:47:23 WARN src/stlink-usb.c: Couldn't find any ST-Link/V2 devices[TheLegace@localhost discovery_demo]$ flash write STM32F4-Discovery_Demo.bin 0x8000000
2012-01-23T20:47:24 INFO src/stlink-usb.c: -- exit_dfu_mode
2012-01-23T20:47:24 INFO src/stlink-common.c: Loading device parameters....
2012-01-23T20:47:24 INFO src/stlink-common.c: Device connected is: F4 device, id 0x413
2012-01-23T20:47:24 INFO src/stlink-common.c: SRAM size: 0x30000 bytes (192 KiB), Flash: 0x100000 bytes (1024 KiB) in pages of 16384 bytes
2012-01-23T20:47:24 INFO src/stlink-common.c: Attempting to write 31620 (0x7b84) bytes to stm32 address: 134217728 (0x8000000)
EraseFlash - Sector:0x0 Size:0x4000
Flash page at addr: 0x08000000 erasedEraseFlash - Sector:0x1 Size:0x4000
Flash page at addr: 0x08004000 erased
2012-01-23T20:47:25 INFO src/stlink-common.c: Finished erasing 2 pages of 16384 (0x4000) bytes
Writing 4kB chunk 1 out of 7
Writing 4kB chunk 2 out of 7
Writing 4kB chunk 3 out of 7
Writing 4kB chunk 4 out of 7
Writing 4kB chunk 5 out of 7
Writing 4kB chunk 6 out of 7
Writing 4kB chunk 7 out of 7
Writing 4kB chunk 8 out of 7
libusb_handle_events() | has_error
[!] send_recv
libusb_handle_events() | has_error
[!] send_only

I am going to see if the windows flasher works properly or not.


Probably this is the STLINK bug with big (>0x1800) Bytes. The USB machines just stalls. Recent git should have this bug fixed by not issuing big transfers. Please retest!


My commit from February 2 "Verify F2 and F4 by using a decent block size" should fix that issue and "works for me". As the issue was opened earlier and the poster didn't react, I propose to vlose that issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.