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!

Parents
  • Hello,

    1º) IDE Segger embbeded studio + SDK 4.2.0

    What is SDK 4.2.0?

    Does it happen on all applications, or only some? Did you e.g. try both examples that are not using Bluetooth Low Energy (BLE) and examples that are using BLE?

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

    Does that only occur when you are trying to debug? Or does it also happen if you try to flash your application without debugging, e.g. using nrfjprog (nRF Command Line Tools)? and the command:

    nrfjprog --program <path_to_hex_file>.hex --verify --sectorerase --reset

    And on your custom board, do you have an external LFXTAL? And if not, did you set up the application to use the internal RC Oscillator?

    Best regards,

    Edvin

  • Hello Edvin,

    What is SDK 4.2.0?

    SDK 4.2.0 is this one

    Does it happen on all applications, or only some? Did you e.g. try both examples that are not using Bluetooth Low Energy (BLE) and examples that are using BLE?

    Yes, it happens always, with "Hello world" example too.

    oes that only occur when you are trying to debug? Or does it also happen if you try to flash your application without debugging, e.g. using nrfjprog (nRF Command Line Tools)? and the command:

    nrfjprog --program <path_to_hex_file>.hex --verify --sectorerase --reset

    Yes, it happens to me sometimes when I try to debug, and the first step is to flash the board. I attach a picture with 2 attempts in a row, only 3-4 seconds between attempts. 

    And on your custom board, do you have an external LFXTAL? And if not, did you set up the application to use the internal RC Oscillator?

    My custom board has a module nRF52840 with an internal 32MHz clock and an external 32kHz clock. Do I need to change something? Why do the option of changing this settings is not available in the kconfig menu? I cant check any box.

  • JuanAlm said:
    Do I need to change something?

    Probably not. I am just digging and looking at the typical differences between the DK and custom boards.

    In fact, can you please let me know what module you are using, and also upload your schematics and PCB layout files, so that I can run them by a co-worker who is working mainly on HW? 

    Also, can you please test to flash the FW "manually" using nrfjrprog from a cmd window, using the command:

    nrfjprog --program build\zephyr\zephyr.hex --verify --sectorerase --log

    and run that command until it fails, and then check the log file (you can upload it here). Perhaps it holds some information as to why the debugger fails to flash the FW, which may also be related to why it fails to debug at some points. This may or may not be related to the schematics and PCB layout.

    Best regards,

    Edvin

Reply
  • JuanAlm said:
    Do I need to change something?

    Probably not. I am just digging and looking at the typical differences between the DK and custom boards.

    In fact, can you please let me know what module you are using, and also upload your schematics and PCB layout files, so that I can run them by a co-worker who is working mainly on HW? 

    Also, can you please test to flash the FW "manually" using nrfjrprog from a cmd window, using the command:

    nrfjprog --program build\zephyr\zephyr.hex --verify --sectorerase --log

    and run that command until it fails, and then check the log file (you can upload it here). Perhaps it holds some information as to why the debugger fails to flash the FW, which may also be related to why it fails to debug at some points. This may or may not be related to the schematics and PCB layout.

    Best regards,

    Edvin

Children
Related