cancel
Showing results for 
Search instead for 
Did you mean: 

Error initializing ST-Link device

timotet
Associate II
Posted on June 20, 2012 at 22:59

First post here.

I have been programming the stm32f0 discovery kit for a few days now using the

Atollic gdb server with no problems whatsoever, that is until today.

I was in the middle of debugging and lost the link to the stm32f0, now

when I try to reinitialize the device I get the initialization error.

I can use the stm stlink utility and load a hex file with no problems.

I actually reloaded the same program I was working on when I

lost the link. I have the Stm32f4 discovery board as well and I connected that

to see if it was a driver issue but I have no problems initializing the st-link on that board.

I connected the f0 board to another computer I have and I cant get it to initialize the

st-link either. Does anyone have any suggestions for a fix, Im at a loss here.

thanks

Tim

oh by the way there is a new arm forum called Arm-hq

go here: http://forum.arm-hq.com

It needs more members so sign up

#stm32 #st-link #stm32f0
4 REPLIES 4
Posted on June 21, 2012 at 00:23

ST-Link's are quite sensitive to aberrant code being run on them, as there is quite a large window when the device first starts up until the JTAG/SWD can wrestle control of them. Things like reprogramming important GPIOs, disabling debugging, or DMA, are among the things to kill them. I would generally recommend checking a GPIO on startup, and then spinning in a loop as a break-out/recover mechanism. Getting the BOOT0 pin pulled high will also permit recovery.

On XP machines we've also seen a lot of reports of Daemon Tools interfering with operation of the ST-LINK's.

On the electrical side check that the regulators are outputting suitable voltages.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
timotet
Associate II
Posted on June 21, 2012 at 09:02

Thanks for the tip clive1.

I single stepped up to where the code loses the st-link, and it was in my GPIO config

function. Attached is the function

When I call GPIO_Init(GPIOA, &GPIO_InitStructure) the st-link gets lost, I changed it to GPIO_Init(GPIOF, &GPIO_InitStructure) and no problems st_link

works as expected. any thoughts?

thanks

________________

Attachments :

GPIO_confg.c : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I00F&d=%2Fa%2F0X0000000bST%2F_5.MTGuLjeJ.Z3Z3oPbe8V0uWGMIr1Y1LPBV21GNE28&asPdf=false
Posted on June 21, 2012 at 13:27

You can't use GPIO_Init() like that. You need to deals with the pins on each GPIO bank individually. ie the Pins on GPIOA, then pins on GPIOB, then GPIOC.

The way your code works is that is trashes the setting of PA.14 (SWCLK) which is the clock for the debug interface.
Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
timotet
Associate II
Posted on June 21, 2012 at 18:02

Thanks again clive1

I had a feeling that was not the correct way to use the GPIO_Init().

thanks