How to keep debug connection alive between sleep cycles?

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • How to keep debug connection alive between sleep cycles?

      Hi guys,

      We ship eval boards with our device "RSL10" from ON Semiconductor, which uses OB J-Link.
      We can debug the device just fine but we have trouble with applications that use sleep mode. Whenever the debugger detects the device is sleeping, it throw errors and closes the debug connection.
      I don't think the device support any kind of special low power mode debugging (no debug port clocks are active).

      So, we don't expect to be able to do anything while the device is asleep.

      The only thing we want is to be able to keep the debug connection alive, such that a breakpoint is hit next time the device wakes up. Is this possible?

      So far, we use a workaround when we want to debug the device state after waking up from sleep:
      1. Add an infinite loop trap in the part of the code that's run only after waking up from sleep
      2. Start a normal debug session that loads the code and let the target run.
      3. The debug connection is lost as soon as the device enter sleep mode, so we close the current debug session
      4. Open a new debug session that "re-attaches" to the running target (remove target reset, load of code or anything special from settings)
      5. Now, we can pause the debugger and see that our device is trapped in the infinite loop added in Step 1

      This is not ideal, as it's inconvenient and requires us to change the code.

      Is there anything else we can do to keep the debug connection alive?
      Maybe restore/retain some memory or debug registers?
      Maybe retain the GPIO pads connected to SWD?
      How does J-Link detects a disconnection? Just by detecting a read memory failure?

      We tried enabling low power mode in the J-Link DLL (wiki.segger.com/Generic_IDE#Low_power_debugging) but it did not work for us.

      Any help is appreciated.

      Best regards,
      Sergio.