cancel
Showing results for 
Search instead for 
Did you mean: 

Using ST-LINKv2 on the F4Discovery board to program an external STM32F0

upgrdman
Associate II
Posted on March 24, 2013 at 22:12

I have an F4Discovery board that I want to use as an SWD programmer to program an F0 on a home made PCB. I keep getting the ''No target connected error.''

I know the F4Discovery board works (both the ST-LINKv2 and the F4) because I can program it.

My setup is as follows:

-Jumpers on CN3 (''ST-LINK/DISCOVERY'') are both open to allow programming of an extermal microcontroller.

-SB11 is open, to allow ST-LINK to control the reset line of my F0.

-My F0 PCB is powered by the F4Discovery board. (3V rail and GND.)

-CN2 pin 1, VDD-Sense, is connected to the 3V rail of my F0 PCB, which is also the 3V rail of the F4Discovery.

-CN2 pin 2, SWCLK, is connected to my F0 pin PA14.

-CN2 pin 3, Ground, is connected to the ground of my F0 PCB, which is also the ground of the F4Discovery.

-CN2 pin 4, SWIO, is connected to my F0 pin PA13.

-CN2 pin 5, NRST, is connected to my F0 pin NRST.

-CN2 pin 6, reserved, is not connected to anything.

I don't know of a way to test the F0 without programming it, but the NRST pin seems to be functional. When the F0 is powered on, the NRST pin is high. When the F0 is powered off, the NRST pin is not connected to 3V or ground.

The BOOT0 pin of my F0 is tied to ground.

Any ideas?

Thanks,

-Farrell

3 REPLIES 3
Posted on March 25, 2013 at 00:49

None of that sounds unreasonable.

You should make sure the F4 board has the most current ST-LINK firmware, in case it doesn't recognize the F0.

The other method to indicate signs of life on the F0 would be to pull BOOT0 high at reset, and the using USART1 (PA9,PA10) send data to the System Loader. Set your terminal app to 9600 8E1 or 115200 8E1 and send an 0x7F (DEL) character, you should receive an 0x79 in response. If that doesn't work make sure of the power connections are wired up, including VSSA/VDDA, and any decoupling and bulk capacitors are attached across them.
Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
upgrdman
Associate II
Posted on March 25, 2013 at 06:54

I found the problem, or at least part of it. I don't have a serial port or USB/serial converter laying around, so I started to check out the SWIO and SWCLK waveforms with my scope.

I found both to have occasional bursts of 3V square waves *before* attempting to connect to the F0 with the stlink software. *After* attempting (and failing) to connect with the stlink software, the waveforms changed: SWCLK was now an occasional 2V square wave, and SWIO was now an occasional 2V square wave with a +1V offset (1V - 3V waveform.) The NRST line was now at 2V, instead of 3V.

I removed the F0 and soldered a new one in its place. It connected and showed up as expected in the stlink software... for about 10 seconds before the whole problem repeated. Same inability to connect, and weird waveforms.

I just removed the second F0 and put a third in its place. I'm hoping the problem was something simple, like some flux or flux cleaner residue under the chip causing a partial short or something along those lines. I'm going to let it sit for a day or two before applying power.

Anyone ever had similar waveform weirdness on their SWD lines?

-Farrell

upgrdman
Associate II
Posted on March 28, 2013 at 01:17

Problem solved. My firmware reuses the SWD pins as GPIOs so the stlink must connect under reset. That is not the default bahaviour of the stlink utility, and it does not try to connect under reset when a normal connection fails :(

-Farrell