I have compiled code that debugs and runs normally on the nRF52840DK. I just connected my custom PCB to the debug out connector on the DK and I have two issues that are probably related. If I start a debug session, the programming, verifying, pin reset sequences will only complete error free about once in 5 tries. I can see with my scope that the SWCLK signal is too fast for my hardware so I need to slow it down. How can I do this?
I did find an older case where it was suggested that adding a "serverargs" line to the .json file can be used to slow down the clock. This works only after the nrfjprog is finished and the gdb debugger starts. I know this because I can see a slower signal matching my parameter on the SWCLK pin once the debugger has started. In the one in five times that the debugger actually does start, it doesn't run to "main" as it should, and it also does nothing when I hit the "pause" button on the debugger toolbar. The "stop" button does work. I can also see a signal on the SWCLK pin. There is an error message (that I forgot to grab) that tells me something about a "Sigtrap"? in a "thread". Note that none of this happens if I use the nRF52840 that is on the DK with the same code.
So I'm not really sure how to debug this problem. Is there some other way to get the debugger to stop and display the code?
I can use the JLink Commander app to talk to my nRF52840 once it has been programmed. I can view all the registers and step through the code.
I suspect that slowing down the SWCLK for the programming and debug start in Visual Studio might resolve the issue. Changing my hardware is not an option!