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

Code runs in debugger, but not on power up

I have an app built in IAR using S110, SDK 7 on PCA10028 DK board that runs fine with the debugger, but if I stop the debugger and unplug and plug back in the USB cable, it does not run.

This used to work, but has recently stopped. The only thing I can think of that could have caused this is a recent update to the built in JTAG code on the board. Perhaps it is holding the Nordic CPU reset now, where it didn't before.

Does this sound like a possibility? Anyone else seen this behavior? Anyone know how to downgrade the JTAG code to a previous version to test this theory?

Thanks, Jeff.

  • By using the LEDs and putting in rather large delays, I've found that the place the code hangs is in dm_init(). Not sure why it hangs there running outside the debugger, and not when running inside the debugger, but at least I can see where it is hanging.

    The dm_init() routine is fairly large, so it will take some time to figure out where it is in there that is causing the issue.

  • And I found the answer.

    I had ENABLE_DEBUG_LOG_SUPPORT enabled, and this requires an implementation of printf. When running in the IAR debugger, there is a mechanism for "semi-hosting" that redirects printf and scanf and the like for stdio to the debugger. Running without the debugger, nowhere for that stuff to go and it hangs. Removing ENABLE_DEBUG_LOG_SUPPORT from my compile options allows the code to work from a power up without the debugger.

    Jeff.

Related