1
votes

enter image description here

MCU : STM32L496

JFlash version: v6.32i

We are facing the "Connection to target under reset failed" issue, when we try to program the board with STM32 MCU.

We were programming the board before with no issues. This error started appearing suddenly and now we are not able to program the board. When we scoped the reset pin of the MCU, the reset pin is going low when we click the connect button in the JFlash and clearly the board is resetting (We can see the firmware functionality restarting).

We tried the following:

Tied the BOOT0 pin to VDD and tried booting to the system memory and then tried programming. But this doesn't made any difference.

Tried always pulling down the reset pin to GND while trying to flash. We have ensured that there are no issues with the track leading to the JTAG interface of the MCU.

Could you please help to resolve this situation?

Is there any possibility that the firmware currently running in the MCU could prevent the flashing and lock the device?

2
Have you checked with another board/controller if the connections works?A.R.C.
Yes we have two more prototype boards. We checked flashing both boards. One of the board also moved into non flash-able state (i.e., this actually led us to doubts of our application firmware blocking the program flashing). However, the third board is working fine.HariP
Hi HariP. What is the low power mode used by your firmware?Hugo Bevilacqua
Now we are not making use of any low power modes in the firmware. We are running FreeRTOS task scheduler.HariP
Successful JTAG connection is independent of being able to program the flash. The J-Flash output text may contain useful information - you should copy & paste that to your question. For example it indicates the power supply voltage which is critical. Is it possible you have enabled read-out protection? In your J-Flash installation folder you will find a command line tool JLinkSTM32.exe; I have had parts locked in ways that the J-Flash software could not connect to but which could be recovered using this tool. It will blank your device.Clifford

2 Answers

0
votes

STM32L4 has a feature called Read-out Protection (RDP). See section 1.1 of AN4758. If your firmware application sets (intentionally or accidentally) the RDP level to 1 or 2 in the "option bytes" memory area then the SWD/JTAG port is disabled from accessing flash memory (read, write, and erase).

If the RDP is level 0 or 1 then you should be able to read the option byte memory area. If RDP is level 1 then you should be able to set it back to level 0. The flash memory will be erased when setting RDP back to level 0 but the SWD/JTAG port will get re-enabled. If the RDP level is 2 then I believe there is no way to reset it.

0
votes

This is a common problem with STM32 SWD interface. For successful programming you should not power your custom board/ other hardware with the ST link power, instead you should make the GND connection common and supply from external source. And if you are using ST link only for programming and not for debugging then you should use the STM32 bootloader(easier).