cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with programming STM via ST-Link SWD

mailbox112344
Associate
Posted on October 05, 2014 at 10:08

Hello, I use your microcontroller STM32F407(lqfp100) at my work. We develop at the research institute a system of control engine. I developed a program at STM32F4 Discovery. But when I developed my scheme where use this microcontroller it can't be programmable. I connected to my scheme where is stm32f407 via  STM32F4 Discovery ST-Link, but ST-link Utility can't find a CPU. So, can you answer, the simplest scheme to programm the chip is: connect all Vdd and Vdda, Vref+ together and connect them to 3.6V. connect all Vss and Vssa together and connect them to GND then connect ST-link SWCLK to CPU SWCLK, ST-link SWDIO to CPU SWDIO,ST-link SWO to CPU SWO, ST-link NRST to CPU NRST, ST-link GND  to CPU GND??? Can you answer is this the simplest schem for programm this controller? Now I need to program this controller. I can programm STM32F103 controller usin this schem, why it is not works with STM32F407(lqfp100). I tryed to connect it for 2 weeks and my result is empty, I read all of Internet and result empty I can't to connect.

I'm sorry for my English. Thank you very much

7 REPLIES 7
Posted on October 05, 2014 at 14:50

Orientation can be an issue, but you say you've built other STM32 boards.

The F4 does require capacitors on the VCAP pins, and you could expect to measure 1.25V on them.

An alternative signs of life method is to reset the part with BOOT0 pulled high is to send an 0x7F character (hex in RealTerm for example) at 9600 8E1 on USART1 or USART3 and observe an 0x79 response
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
megahercas6
Senior
Posted on October 05, 2014 at 17:48

This is how i do for my custom STM32F4 boards;

I only use SWDCLK, SWDIO,RESET,GND. Now SWDCLK needs pull down to GND, i use 10K. SWDIO needs pull up to Vdd, also i use 10k. When programming in IAR IDE, i must use SWD option in debugger, also using correct flash loader file.

(good practince is to keep GPIOA 13 and 14 alone, since if you select it as gpio, you have problem)

I had problems that long wires will cause disconnection problem, so i use them quite short (20cm max)

BOOT0 always goes to ground, and i use 2.2uF on all pins, same apply for VCAP1..2. VBAT also connected to Vdd directly.

That's about it

kjwhitcombe
Associate II
Posted on October 05, 2014 at 21:34

The Vcc pin (pin 1) of the SWD header on the programmer needs to be connected to the target Vcc as it is used to detect if target board is there, if there is no voltage on this pin the programmer will not even try. Otherwise all else seems ok connection wise with what you have mentioned.

I assume you removed the jumpers on CN3 of your F4 discovery.

From my notes:

If my cable between the discovery and the target board is about 1metre long unshielded it will not work reliably.

If the target board has been programmed to sleep and has gone into that state you cannot program it and have to try to strike it lucky by manually resetting the target board and hitting erase on the programmer application until it succeeds (best luck by holding reset hitting erase and within 300mS removing the reset), IDK why the programmer can't do this itself!

Posted on October 05, 2014 at 21:56

Connecting VCC of 3.6V to VCC of 3.0V is not to be recommended. The stand-alone ST-LINK (and other JTAG pods) often have buffers using the target's supply, the DISCO board DO NOT have this.

Yes a 1 metre cable is excessive for this kind of connectivity, you want to be shooting for 10 cm (100 mm)

The most probable cause for JTAG/SWD not working is that the core is not functional, one needs to check the supplies thoroughly, both voltage and current drawn, and what's happening with the reset. As the part doesn't start external oscillators it's hard to check for signs-of-lift that way.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
kjwhitcombe
Associate II
Posted on October 05, 2014 at 22:42

I would like to clarify that I am saying that pin 1 of the SWD header on the discovery boards, although labeled as Vcc does not supply Vcc to the target. Instead it is an input intended to be some form of detection (routes to AIN1 of the STM32F103 on F4 discovery).

Edit: On further inspection I've found that it does so via R2 on the discovery F4 board, this resistor is not fitted (on my board at least) and so not necessary for programming the device.
mailbox112344
Associate
Posted on October 06, 2014 at 07:25

Thanks awfully! I tried everything, except I didn't know I need use CAP1 & CAP2 and pull down resistor to SWCLK and pull up resistor to SWDIO. C

urrent 

 consumption of CPU was 0,01A and voltage 3.6V. I will try, It seems to mee that's my problem, because I tried everything that I see at this article.

megahercas6
Senior
Posted on October 06, 2014 at 11:06

pull up/downs are used to make system stable, so noise will not cause core to think that it has debugger attached, it should work without resistors just fine (only pull up that must be installed is for RESET)

power consumption should be between 10and 70mA, at least is what i get running at full speed. ( but it will depend how many peripherals you are using)

Regarding VCC on discovery boards, it is sense, that's why i don't use it, it works just fine with it's own power supply