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

enable debug in thingy52

Hello guys.

I'm new with nodic nRF52 SDK and I tried to enable debug by setting 1 on "NRF_LOG_ENABLED" in sdk_config.h, but nothing happens in com port criated by Jtag (pca10040).

Where is my error? What is the correctly procedure?

Parents
  • Hi Leoni,

    Unfortunately, the process is more difficult than this. You will need to first download the Thingy FW code, then take a look at this link to be able to compile the Thingy FW. This link then shows you how to compile the Thingy FW. Remember to set NRF_LOG_ENABLED 1 & NRF_LOG_BACKEND_RTT_ENABLED 1 in sdk_config.h header file to enable logging over RTT. I compiled the debug version of the Thingy FW.

    Then, you have two options: the proper way via secure dfu bootloader or an easy solution. I would recommend the easy solution at the beginning.

    The easy solution: Connect your Thingy:52 via a 10-pin SWD cable to the debug out port (P19) on an nrf52DK. Open nrf go studio (you can download it here (32 bit or 64 bit) if you don't have it already). Turn the dev kit & the Thingy devices on. Click on the Segger tab under nrf52 dev boards in Device Manager. Press the erase all button. Click on the Program Softdevice tab & flash the Softdevice v4.0.2 (located here: thingy_fw\external\sdk13\components\softdevice\s132\hex ). Then, press on the Program Application tab & flash the Thingy application hex file that you compiled in Keil or GCC.

    Finally, open up the J-Link RTT Viewer program, change specify target device to the dev kit that you have & press the OK button. You should then get debug info via RTT.

Reply
  • Hi Leoni,

    Unfortunately, the process is more difficult than this. You will need to first download the Thingy FW code, then take a look at this link to be able to compile the Thingy FW. This link then shows you how to compile the Thingy FW. Remember to set NRF_LOG_ENABLED 1 & NRF_LOG_BACKEND_RTT_ENABLED 1 in sdk_config.h header file to enable logging over RTT. I compiled the debug version of the Thingy FW.

    Then, you have two options: the proper way via secure dfu bootloader or an easy solution. I would recommend the easy solution at the beginning.

    The easy solution: Connect your Thingy:52 via a 10-pin SWD cable to the debug out port (P19) on an nrf52DK. Open nrf go studio (you can download it here (32 bit or 64 bit) if you don't have it already). Turn the dev kit & the Thingy devices on. Click on the Segger tab under nrf52 dev boards in Device Manager. Press the erase all button. Click on the Program Softdevice tab & flash the Softdevice v4.0.2 (located here: thingy_fw\external\sdk13\components\softdevice\s132\hex ). Then, press on the Program Application tab & flash the Thingy application hex file that you compiled in Keil or GCC.

    Finally, open up the J-Link RTT Viewer program, change specify target device to the dev kit that you have & press the OK button. You should then get debug info via RTT.

Children
  • I'm trying to debug custom Thingy52 firmware. I've followed the steps here to compile and modified the sdk_config.h file as described.  I can flash the Thingy and the J-Link RTT View seems to show connectivity, but no messages beyond this appear.

    Is there anything else that I need to do to show debugging information on the RTT Viewer?

  • I believe you might need to set the DEBUG flag in the preprocessor symbols (i.e. in Keil using the debug v1_0_0 FW, right click on project, Options for Target, C/C++ tab, write DEBUG inside the Define window). Otherwise, I believe you have done everything correctly. It might be something with your FW, so to double check, you can download the regular Thingy FW, make the RTT changes required & RTT should work. Or start commenting out some lines in your custom FW.

  • Thanks,

    I tried it on the original firmware.  I'm now able to get NRF_LOG_INFO data through RTT.  I'm using GCC to compile.  I changed the two settings in sdk_config from above and went into the makefile.  There, I uncommented the line for using RTT.  Would that be the same thing as setting the debug flag in Keil?

  • I was a bit unsure about what the DEBUG flag does, but it seems like it adds blocking asserts instead of a reset loop when something goes wrong in your code (see link).

    Comparing the preprocessor symbols in Keil with the makefile located at: project\pca20020_s132\armgcc\, I noticed this:

    The first picture shows the preprocessor definitions in Keil & the second picture shows the makefile. It seems the makefile sets a -D in front of the preprocessor definitions compared to Keil. If you go a bit further down, you notice that there is already a debug flag set at line 307:

    ASMFLAGS += -DDEBUG

    TLDR: The debug flag is already set in the makefile. You are good to go Slight smile

  • Line 273 of the makefile had the following line:

    #CFLAGS += NRF_LOG_ENABLED=1 # Use if RTT output is desired.

    I uncommented it and added the -D in front.  Maybe I'm trying to compile the wrong version of the Thingy FW.

    I compiled the debug version of the Thingy FW.

    Are there two different FW versions in the Nordic-Thingy52-FW-master directory, one for debugging and the other for release?  Or did you mean that the firmware was made into a debug version by applying the changes to the sdk_config.h file? Right now I'm compiling from Nordic-Thingy52-FW-master\project\pca20020_s132\armgcc.  There's another directory (Nordic-Thingy52-FW-master\project\bootloader_secure\pca20020_debug) that obviously has something to do with debugging, but there's no makefile and is too large to build in my version of Keil.

    Thanks again!

Related