2016-08-01 05:31 PM
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.2016-08-03 10:07 AM
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?2016-08-03 10:41 AM
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's2016-08-03 04:12 PM
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?2016-08-03 08:01 PM
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.2016-08-04 08:28 AM
Here's the log from the JLink after trying to connect with the board with boot0 High:
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.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!