2014-02-05 04:21 PM
Hi Everyone,
Sorry if this is a repeat post, I'm pretty sure I've looked through all of the past discussions related to this and still have not found a solution.I designed a new board using the STM32F427 and have been unable to program the device using the external ST-Link V2 hardware via SWD or JTAG. I'm simply using the ST-Link Utilities on a windows 7 machine. I can connect to the device, read its ID/revision, read the program memory and erase it, but as soon as I try to program the device the ST-Link Utility disconnects with the following error:Internal command errorCannot connect to the device!I've noticed that this also erases the program memory (since I can program it via the USB boot loader).Now on to why I posted this in the STM32 Discovery section …Since this is my own board design I figured, hey lets try this on the STM32F4 Discovery to make sure I didn't mess up the design. Sure enough I have the same exact problem when I try to flash the discovery board using the SWD header (CN2) which bypasses the ST-Link chip on the discovery board.Early on I was unable to even talk to the F427 on my board until I updated the firmware of the ST-Link V2. This leads me to believe there is a firmware issue on the ST-Link.I found some old posts stating the ST-Link firmware was incompatible with rev Z of the STM32F407, but that it had been fixed. I did not see anything about this in the current errata sheets.The software I am loading is very simple (flash an LED). I am not changing any of the GPIO settings for the pins related to the SWD or using any of the sleep functions.Last, I've connected SWDIO, SWCLK, NRST, one 3.3V line and one return line of the ST-Link to the discovery board. I have not connected SWO as it should not be needed - I will give that a try though.Thanks for any suggestions.2014-02-05 04:46 PM
You upgraded the firmware to what version?
Injecting SWD into a STM32F4-DISCO board is problematic, you have to make sure you break a bunch of solder bridges so the on-board ST-LINK does not interfere. CN2 is NOT a good injection point, for SWCLK and SWDIO the F4 side of CN3 would be better.Don't connect 3V supplies, just the GND2014-02-06 09:36 AM
Hi Clive,
Thanks for your reply.I updated the ST-LINK firmware to version V2.J17.S4 which is later than the version ST has in their firmware release notes.I see what you mean about bypassing the ST-LINK on the discovery board. I misunderstood - apparently the SWD header (CN2) is meant to allow you to use the discovery board as an ST-LINK for other hardware.I don't need to use an external ST-LINK on the discovery board, I was just troubleshooting my hardware. Now this post is in the entirely wrong area …Anyway, it just seems weird that I can use the external ST-LINK to do everything short of flash my own board (I can get the device ID/revision, read and erase). I must be missing something fundamental about SWD or have an issue with my hardware.Any other thoughts?Thanks2014-02-06 09:55 AM
Yes, I grasped what you were doing.
The DISCO boards are a low cost ST-LINK for third part boards, I'm not terribly keen on them for that purpose, or the non-standard header(s). Using external debuggers on the DISCO boards also isn't a simple as it might be.I understand you were trying to cross-check your design/function with a second DISCO, smart move.I don't really have an insight into your board design, not much detail to work with here.For flashing problems I guess I might focus on supplies, and bulk-capacitance, which supply the charge-pump/voltage-generator for the flash programming circuits. You'd want to check the VCAPx pins. Perhaps use a bench supply, and look if supplying VPP helps.Make sure the device isn't held in reset, or reset accidentally. Check NRSTAs I said I probably wouldn't connect the 3V supplies, the DISCO has it's own regulator, have not evaluated it's specifications, but if you have your own regulators on board, I wouldn't want them fighting with the one on the DISCO. The ST-LINK function, at least on the DISCO, only requires the grounds to be common.2014-04-22 04:30 AM
2014-04-22 06:59 AM
That's a bit of a difficult description, so did it work, and then stop? What did you change? Can you change the behaviour by resetting the part with BOOT0 High?
2014-04-22 07:18 AM
2014-04-22 07:43 AM
The ST-LINK is not a particularly commercial solution, and using the Discovery boards to program others is clearly a half-assed solution, where the primary driver is initial purchase cost. Here in the real world we try to use standard debugger headers, and connect up the interface in a sufficiently complete manner, and jumper the BOOTx pins.
The Segger J-Link and Keil U-Link have significantly more engineering resources behind them, and they are significantly more robust. Still, it's possible to put user code on the chips that will break the debug interface, so having a method to break-out, or use the BOOTx pins is highly recommend.2014-04-22 08:16 AM
2014-04-22 08:27 AM
I found this one on mouser.co.uk
Is it good? (Does it do the job?) What are the limitations as compared with the more expensive ones? Thank you