J-Link Low power modes production

From SEGGER Wiki
Jump to: navigation, search

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.

Recommended sequence:

  1. Program target via J-Flash
  2. Make sure that under "project options" -> production -> Start application is checked and set to "via reset pin"


  1. Program target via J-Flash etc.
  2. Exit J-Flash etc. (will clear the debug bits)
  3. Start J-Link Commander
  4. Issue "r0" followed by "r1" command (do NOT call "connect" or anything else!)
  5. 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.