Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

[SOLVED] Recommended method for writing LOG messages during RUNTIME?

I've tried ble_app_uart, nrf_serial.c etc. and none seems satisfactory.

I can write to the logger logger/uart during DEBUG, but it doesn't seem to succeed in RUN.

Question:

1. Can SEGGER_RTT be used in RUN build?

2. Can NRF_LOG (_INFO etc.) be used in RUN build, or is it only in DEBUG?

3. I have tried to get nrf_serial.c (nrf_serial_write() etc.) in RUN and I can't seem to get it working.

4. What is the recommended method to get messages out in Runtime?

UPDATE

I am using nrf_serial.c  with UART in legacy mode and set to POLLING. It is writing enough debug data (in RUNTIME) for now.

Caveat: If you're using nrf_serial, make sure your code doesn't have any printf statements - it crashes the code.

I also turned REDIRECT off.

Parents
  • Hello,

    RTT messages are 'printed'  out via the debug interface, so the chip must be in debug interface mode in order for a client to be able to retrieve log messages. I use the attached batch script to get RTT logs on windows when not debugging the project from and IDE.

    Attachments: 

    @echo off
    set arg=%1
    
    IF "%arg%"=="" ( 
    	echo Error: no device selected.
    	EXIT /B
    )
    REM Jlink (jlinkcommander) enables the debug interface
    start cmd /c jlink -device %arg% -if SWD -speed 1000 -autoconnect 1 -CommanderScript %HOME%/run.jlink
    REM RTT client listens for RTT messages on telnet port. 
    start cmd /c jlinkrttclient
    
    @echo on
    
    

    run.jlink

  • Which SERIAL method would you then recommend? 

    the nrf_serial.c functions?

Reply Children
Related