Saturday, 12 March 2016

Recovering an STM32F4 board

This is a note on overcoming a problem connecting to my STM32F429I-DISCO board.

The board has an on-board ST-LINK/V2 interface, accessed via the USB connector. The software to do this is no doubt available from the usual embedded developer toolchains, but I've been using stlink which has built and run without problems on OS X; there's a Mac Sourceforge download available.

You can use st-flash to download binary to the board, and st-util to act as a GDB server.

I've been working on porting the board startup code I'd developed for the Arduino Due (startup.ads, startup.adb, startup-set_up_clock.adb) to the STM32F429I, and managed to get the board into a state where st-util couldn't connect at all:

$ st-util
2016-03-10T17:59:47 INFO src/stlink-usb.c: -- exit_dfu_mode
2016-03-10T17:59:47 INFO src/stlink-common.c: Loading device parameters....
2016-03-10T17:59:47 WARN src/stlink-common.c: unknown chip id! 0xe0042000

Clearly I'd (at best) got the board into a state where the on-board ST-LINK package wasn't working - at worst, it was fried. I was thinking about ordering a replacement board when I wondered whether my Segger J-Link EDU would work if I could connect it.

Turns out that SEGGER have an application note that tells how to do just that; it's AN00015 here.

I didn't have any female-to-female jumpers, just male-to-female and male-to-male, so had to cobble the connection using a breadboard as below (the top section with the red LEDs is part of an earlier project) ...

Using this setup, I was able to download an image I'd built earlier, which ran correctly on the board. I could then download the new image, with the new startup, and work out what was wrong with it (I'm afraid I've forgotten what the problem actually was in the rush of relief): and then the board was happy to connect to st-util again.

No comments:

Post a Comment