J-Link Low power modes production
Low power modes in production can be tricky in some regards. This article explains the pitfalls and how to avoid them
Make sure that target enters low power mode after programming
To connect to a target device via the debug interface, J-Link / Flasher needs to setup certain bits in the debug logic of the device. These bits as a side effect may prevent the target from entering a low power mode. In a low power mode, no J-Link connection and flash programming would be possible.
However, after being done with programming, usually the device is wanted to enter the low power mode again, especially for battery powered devices. Therefore, on a debug / programming session close, J-Link clears the bits that have been set previously. Unfortunately, this does not mean that the target enters the low power mode immediately. An additional toggle of the reset pin may be required to achieve this. It is not guaranteed that clearing the debug bits will put a device back into low power modes it probably was taken out of, by setting the bits.
- Program target via J-Flash
- Make sure that under "project options" -> production -> Start application is checked and set to "via reset pin"
- Program target via J-Flash etc.
- Exit J-Flash etc. (will clear the debug bits)
- Start J-Link Commander
- Issue "r0" followed by "r1" command (do NOT call "connect" or anything else!)
- Exit J-Link Commander
Note: All the steps above assume that the reset pin of the target device is connected to J-Link and can be controlled by J-Link.