printk(), printf() over RTT

Hello,

I’m using the GNSS sample (located at C:\ncs\v2.9.0\nrf\samples\cellular\gnss) to evaluate the GNSS module on our custom PCB, and I need to view its output over RTT. I added an overlay file to enable AGPS data downloads from the cloud and to enable RTT, but no data appears in the RTT viewer.

I noticed there’s some confusion about using printf() and printk() with RTT, but I haven’t found a clear explanation. In the GNSS sample, I tried replacing all printf() calls with printk(), but it didn’t work. This is surprising because I’ve used printk() successfully in another project.

For now, I’ve changed all the printf() calls to LOG_INF(), and that works. However, I’m still curious about how to properly enable printk() and printf() for RTT.

SDK 2.9.0.

  • Hello, 

    Did you try with e.g. CONFIG FORCE RTT PRINTK or CONFIG_LOG_PRINTK? This is documented under Logging in nRC Connect SDK and RTT and zephyr/subsys/logging/backends/Kconfig.rtt.

    More information can be found under Logging in Zephyr OS.

    Kind regards,
    Øyvind

  • Hello,

    Thanks for the feedback. The issue was resolved, and everything was actually working from the start. The problem was how I tried to retrieve the data. For some reason, the data did not appear in the "Terminal 0" tab of the J-Link RTT Viewer. All I needed to do was check the "All Terminals" tab to see the data.