cancel
Showing results for 
Search instead for 
Did you mean: 

J-Link could not ''connect under reset'' to the STM32F103RD

Posted on August 02, 2016 at 02:31

Hello, 

I am using the Segger J-Link+ to connect to my target board with the STM32F103RD chip installed. I connected all the necessary pins of the target board (TMS, TDO, TDI, NTRST, TCK, and RESET) to the corresponding pins of the J-Link. Before, I was able to connect to the target board and upload my firmware using J-Flash with no problem. All of a sudden, when I was trying to upload new firmware to the board, I got the ''ERROR: STM32: Connecting to CPU via connect under reset failed.'' I've been looking for possible solutions, but still no luck and I've resorted on posting in this forum.

All the connections are connected properly and the board is powered up as before. The chip doesn't seem to be bricked since the last firmware that I loaded is still running whenever I push the buttons. 

I really hope someone could help me with this. Any help will be appreciated. 
14 REPLIES 14
Posted on August 03, 2016 at 19:07

I was able to connect through SWD connection but not through JTAG. You know what might be the problem? I ensured that everything is connected properly. 

I was able to connect to my target device, but when I'm trying to upload my program to it, it is now giving me this problem: 

'' - ERROR: Failed to download RAMCode.

 - ERROR: Failed to prepare for programming.

Failed to download RAMCode!

 - End of preparing flash programming

 - ERROR: Failed to program and verify target''

Do you know what might be the cause of this problem?

Posted on August 03, 2016 at 19:41

Do you know what might be the cause of this problem?

Flawed design/implementation?

That SWD works and JTAG doesn't suggest pin connection issues?

I have very little to work with here, I'm not familiar with your design/implementation/connectivity. I know the boards I've worked on don't have these issues, so assume the issue is mostly at your end, and not ST's or Segger's

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on August 04, 2016 at 01:12

I have connected the pins directly to the board and still no luck for both JTAG and SWD, checked that everything is connected properly.

I'm also trying to connect using an ST-Link. It connected through SWD for a little bit but when I tried progamming the target device, it won't program the device. When I disconnected to try the JTAG connection (which also failed) and switch back to SWD, it won't connect to the device now. I did all those with boot0 LOW.

Now I'm trying to do the same thing with boot0 HIGH, but I can't still connect with the device. Is it possible that the write protect is enabled on the chip? If so, how do I disable it?

Posted on August 04, 2016 at 05:01

The problem you describe really doesn't sound like an F1 with read-out or write protection.

You'd want to try another board, or replace the chip.

What exactly does the entire connection log from J-Link commander look like? Does it expect you to connect VCC along with GND. The circuits would always need a common ground, the IO buffers may also require a target supply. You'd want to use standard JTAG/SWD headers in designs, it makes connectivity easier and consistent.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on August 04, 2016 at 17:28

 Here's the log from the JLink after trying to connect with the board with boot0 High:

 0690X00000605R6QAI.png

When boot0 is low, the log says it cannot connect under reset and TDO is constant high. TDO would be high because the target device is pulling it up with 3.3 volts. Here's the schematic of the JTAG connector of the target device.

0690X00000605RBQAY.png

I've connected 3.3v (pin 6) to the VTRef of the J-Link. The board and J-Link have common grounds. All the pins needed for JTAG/SWD are connected respectively including the Reset button (that is not in the shown schematic but pulled out through a wire). 

 

Before having problems with the connection, I was testing out the buttons if they are functioning properly. Then when I tried uploading the program to the device again, it suddenly gave me this ''Cannot connect under reset'' error. I did declare some unused GPIO to inputs or outputs but have not touched them yet as I was changing my program a little bit at a time. Is it possible that I have changed some GPIO that was not supposed to be changed that is why I could not connect to it anymore? I checked the reference manual of the STM32F103RD and I didn't change any of the GPIO that are connected to the JTAG/SWD connectors that might have caused the problem. I only changed the following:

PA0

PA1

PA12

PB6

PC12

We are planning on replacing the chip if all else fails. Thank you so much for your time clive!