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

nRF52832 SDK15.2.0: Direct Logs to UART on Custom Board

Hi,

I have the following lines:

NRF_LOG_ERROR("This is an ERROR message.");
NRF_LOG_WARNING("This is a WARNING message.");
NRF_LOG_DEBUG("This is a DEBUG message.");

Using RTT works fine, when it comes to using UART, it doesn't work. Can you guys help?

P.S: I am able to push text to UART using printf.

Thanks

Parents
  • Hi.

    Have you enabled the backend UART in sdk_config.h?

    // <e> NRF_LOG_BACKEND_UART_ENABLED - nrf_log_backend_uart - Log UART backend
    //==========================================================
    #ifndef NRF_LOG_BACKEND_UART_ENABLED
    #define NRF_LOG_BACKEND_UART_ENABLED 1
    #endif

    To use the different NRF_LOG levels you have to set this in the sdk_config.h also:

    // <o> NRFX_UART_CONFIG_LOG_LEVEL  - Default Severity level
     
    // <0=> Off 
    // <1=> Error 
    // <2=> Warning 
    // <3=> Info 
    // <4=> Debug 
    
    #ifndef NRFX_UART_CONFIG_LOG_LEVEL
    #define NRFX_UART_CONFIG_LOG_LEVEL 3
    #endif
    

    Setting this as 4 should let you see NRF_LOG_ERROR, NRF_LOG_WARNING, and NRF_LOG_DEBUG.

    Best regards,

    Andreas

  • I don't see in the sdk_config that came with ble_app_uart example, It looks like all the macros for NRF_LOG_BACKEND_* are not in the sdk_config because when I add your first macro, the build fails due to missing other supporting macros such as NRF_LOG_BACKEND_UART_BAUDRATE, NRF_LOG_BACKEND_UART_TEMP_BUFFER_SIZE etc...

    The closest I could find in my sdk_config is NRFX_UART_CONFIG_LOG_ENABLED, NRFX_UART_ENABLED and NRFX_UART0_ENABLED

    I am using the latest SDK 15.2, what am I missing?
    Thanks
  • Hi.

    I was unaware that you were using the ble_app_uart example, you don't need NRF_LOG_BACKEND_UART_ENABLED in the UART example.

    Best regards,

    Andreas

  • My intention was not to use UART for debugging purposes while using the ble_app_uart but as a demonstration. I get your point as to if I was using a different example, I should have gotten it to work by enabling the designated macro.

    Thanks for clarifying.  

Reply Children
No Data
Related