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

printf output via uart

I use SPI Example code and nrf52832.

I don't want to RTT.

I would like printf to be output via UART.

  • Hi,

    I'm assuming you are using the latest SDK (v14.2.0), since you do not specify this, but the answer should apply to most recent versions.

    By default the SPI example use NRF_LOG module for printing. The default backend is UART, but if you use another SDK or you have changed this, it can be set to RTT. you can easily switch this to UART if you want to output the information on UART interface. This is done by setting the two following defines in sdk_config.h file:

    #define NRF_LOG_BACKEND_RTT_ENABLED 0
    
    #define NRF_LOG_BACKEND_UART_ENABLED 1
    

    If you want to use printf to output to UART, you need to setup app_uart library, and enable retargeting of the STDIO functions. Please have a look at the UART example in the SDK for details on how this is done.

    Best regards,

    Jørgen

Related