texane/stlink — Issue #50: USB Issues after bad code write
Author: TheLegace
Created: 2012-01-24 01:49:50+00:00
State: open

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 I think is gone away, it's just uploading the 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.
Thanks.