See debug logs from the custom-designed board using nRF52840-DK as a programmer/debugger

Hello, guys!

I want to use the nRF52840-DK board as a programmer/debugger for a custom-designed board containing a BC840M-v2 module with nRF52840 SoC on it. Here is the connection diagram between the boards:

When using Blinky or Hello World examples and nRF Connect SDK v2.0.0, I was able to download the code on my custom board and blink LEDs. However, I'm unable to see any debug logs (neither printk() nor LOG_INF()) from my custom board. When I download the same code on the nRF52840-DK board, the logs are properly printing.

Do you have any idea what I am missing here?

I tried to both, use the nrf52840dk_nrf52840 board or create a custom board that is based on nRF52840 SoC when building the code for a custom board but to no avail.

Thanks in advance for your time and efforts.

Regards,

Bojan.

Parents
  • Hello,

    I assume you are using the UART backend on your logs (when you can see the logs on the DK)?

    If so, the UART on the DK is by default configured to use TX: P0.06, RX: P0.08. These pins are physically connected to the onboard debugger. which is why yousee the UART output on the computer (the debugger translates from UART to USB protocol, since UART is not supported on PC). 

    So one way to see UART logs on your other board is to buy a standalone UART -> USB device. Typically just a device that looks like a USB cable with 4 pin connectors in the other end of the cable. 

    Or, if you connect P0.06 on your board to P0.06 on the DK, and the same with P0.08, you should see the UART logs from the other board.

    I don't remember if you can do that while the DK's debugger is connected to the other board, but at least if you unplut the debugger, and make sure that the nRF on the DK is blank, you should be able to use P0.06 and P0.08 on the DK as a UART bridge.

    Best regards,

    Edvin

Reply
  • Hello,

    I assume you are using the UART backend on your logs (when you can see the logs on the DK)?

    If so, the UART on the DK is by default configured to use TX: P0.06, RX: P0.08. These pins are physically connected to the onboard debugger. which is why yousee the UART output on the computer (the debugger translates from UART to USB protocol, since UART is not supported on PC). 

    So one way to see UART logs on your other board is to buy a standalone UART -> USB device. Typically just a device that looks like a USB cable with 4 pin connectors in the other end of the cable. 

    Or, if you connect P0.06 on your board to P0.06 on the DK, and the same with P0.08, you should see the UART logs from the other board.

    I don't remember if you can do that while the DK's debugger is connected to the other board, but at least if you unplut the debugger, and make sure that the nRF on the DK is blank, you should be able to use P0.06 and P0.08 on the DK as a UART bridge.

    Best regards,

    Edvin

Children
  • Hello, .

    I was aware that we can use either UART or RTT backends. I was hoping to use RTT backend so that debug logs go through the same interface we are using for programming the board (SWDCLK, SWDIO, SWO).

    I tried everything in prj.conf file to activate RTT but to no avail:

    # enable uart driver
    CONFIG_SERIAL=y
    
    # choose UART console
    CONFIG_UART_CONSOLE=n
    CONFIG_CONSOLE=y
    # Debug config
    CONFIG_LOG=y
    CONFIG_LOG_BUFFER_SIZE=512
    CONFIG_LOG_DEFAULT_LEVEL=4
    CONFIG_LOG_BACKEND_FORMAT_TIMESTAMP=y
    CONFIG_LOG_BACKEND_SHOW_COLOR=y
    # RTT Viewer
    CONFIG_RTT_CONSOLE=y
    CONFIG_USE_SEGGER_RTT=y
    CONFIG_LOG_BACKEND_RTT=y
    #CONFIG_LOG_BACKEND_RTT_MODE_DROP=y
    CONFIG_LOG_PRINTK=y

    Is it possible at all to achieve that the debug logs go through SWDCLK/SWDIO pair?

    Regards,

    Bojan.

  • Hello Bojan,

    Using the RTT backend, it works without any issues here. Note that I just tested this using two nRF52840DKs, so unless there is something I didn't think of, I don't see why it wouldn't work.

    RTT is a bit sensitive. Try to erase the custom board completely, in case there is something in the memory that is stuck from previous configurations. Then try to flash your application to the custom board, and connect the RTT backend after the application has started, and let me know if that doesn't work. As long as you are able to connect to and program the custom board using the nRF52840DKs programmer, then everything you need should be connected correctly.

    Best regards,

    Edvin

  • Hello, @Edvin.

    Is there anything we should explicitly do in nRF Connect SDK to enable RTT backend?

    How can we connect the RTT in the nRF Connect SDK environment? Should we do it from this nRF Connect SDK window:

    Regards,

    Bojan.

  • The built in RTT viewer in nRF Connect for VS Code can be a bit flaky some times. Make sure that you close all previous RTT (or UART) connections first by pressing ctrl + shift + p and start typing "stop terminal":

    If that doesn't show up, then you can connect like in your screenshot. 

    Also, if it doesn't work, you can try to use Segger RTT Viewer (download as part of JLink from segger.com).

    But please try to connect the RTT after you program the custom board.

    Best regards,

    Edvin

  • Hi, @Edvin!

    I was finally able to see debug logs using J-Link RTT Viewer.

    Connecting to RTT through Visual Studio Code does not work for me. Anyway, the issue is resolved. Thanks for your assistance!

    Cheers,

    Bojan.

Related