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.

CONFIG_NRF_CLOUD_CLIENT_ID_SRC_IMEI=y
CONFIG_NRF_CLOUD_CLIENT_ID_PREFIX="******"

CONFIG_USE_SEGGER_RTT=y

# Enable console
CONFIG_CONSOLE=y
CONFIG_RTT_CONSOLE=y
CONFIG_UART_CONSOLE=n
CONFIG_PRINTK=y

CONFIG_LOG_BACKEND_RTT=y

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.

Parents Reply Children
Related