I don't know if this is an ARM question, an MPLAB.X question or a SEGGER J-Link question, so bear with me!!
I have a custom board with the SAML21 Cortex M0+ microcontroller. Its programmed via the SEGGER J-Link via SWD interface, controlled by the MPLAB.X v6.10 IDE.
The test app simply toggles an LED.
When I compile / load / run the app under the debugger, the app runs as expected.
When I leave the J-Link connected and try to run the app without the debugger, it does not run.
When I disconnect the J-Link (i.e. disconnect the SWD interface) and pull down and release the reset line, the app starts running.
ALSO:
If I then reconnect the J-Link/SWD, the app continues to run.
But if I then pull down and then release the reset line, the app stops.
AND ALSO if I launch J-Link COMMANDER and connect to the device:
Typing R (reset) makes the app stop.
Typing G (go) makes the app run again, even while connected to the J-Link.
I assume there must be something about the state of the other SWD lines (SWDCLK, SWDIO, SWO) that's preventing the app from running, but only when the J-Link is controlled by MPLAB.X. Is it possible MPLAB.X is putting the J-Link into some state that's causing this? It isn't a huge deal since there are workarounds (I can run under the debugger, I can disconnect the SWD lines and twiddle RESET, I can launch J-Link Commander and type r then g), but those slow down development.
Any idea what's going on? Or what to look for?