This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Is there a way to know if debug mode is enabled?

I don't find the information in the nRF51822 documentations and in this forum.

How can I know that? Is there some register to check, or some hints to know that debug mode is activated?

I am using nRF51822, softdevice S110, SDK10.

Long story

The reason of this question is because we put a big filtering capacitor on the power line. The module can run without battery during severals seconds when this capacitor is fully charged. The problem is that just after the module programmation: a simple reset is not enough because the chip stay in debug mode because the chip has not be completely powered off due to the capacitor. It is necessary to wait several seconds before plugging the final battery coin in order to be sure that the capacitor is completely uncharged and debug mode will no longer enabled when the battery will be in place.

In case of the debug mode would be still activated, I want to warn the operator (LED, buzzer) that there is a problem instead of consuming 1mA until battery die.

Any advices are welcome.

Thanks

Parents
  • The debug registers in the Cortex M0 are only accessible over the DAP port, not via memory reads, so you can't tell if the processor is in debug mode from code.

    The nrf51 does have a reset sequence which disables debug mode, can you use that? You set the reset flag in the power register and then have your debugger hold the SWDCLK and SWDIO lines low to hard reset the chip. As long as the debugger doesn't re-connect, you're now reset and not in debug mode.

Reply
  • The debug registers in the Cortex M0 are only accessible over the DAP port, not via memory reads, so you can't tell if the processor is in debug mode from code.

    The nrf51 does have a reset sequence which disables debug mode, can you use that? You set the reset flag in the power register and then have your debugger hold the SWDCLK and SWDIO lines low to hard reset the chip. As long as the debugger doesn't re-connect, you're now reset and not in debug mode.

Children
Related