Debugging the nRF52840 does not always work

I have been trying to develop a project, my custom board has a nRF52840 chip and I have a nRF52840 DK too.

My problem is when I try to debug any example from any SDK. If I debug the example "Hello world" in the DK it runs correctly but if I try it in my custom board, it works sometimes. 

I tried the next environments:

1º) IDE Segger embbeded studio + SDK 4.2.0

2º) IDE Visual Studio COde + SDK 2.1.2 (Currently trying this)

Im debugging my custom board with a j-link Base (I tried with more j-link devices and more custom boards, and the error persists). When I try to debug my custom board, there are 3 possibilities:

1º) It debugs correctly

2º) The debug image is flashed and I can press "Step in" or whatever buttom from the debug menu, but it never stop in a breakpoint.

3º) A flash error appear when it tries to flash the debug firmware into the board.

SWD pins are correctly routed in the board cause I can show traces from RTT Viewer when it debugs correctly. 

Thanks!

Related