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

nrf_LOG on custom board port p1.10 p1.03 or via usb

Hi all, I'm using a custom board and I ask you if it is possible to use nrf_log (rx \ tx) on port p1.10 p1.03 or if I can use nrf_log redirecting to usb.
I read somewhere that I can redefine the backend but not I can understand how. thank you
Parents
  • Hello,

    We don't have a USB log backend, but if you want to use P1.10 and P1.03, you can easily change the log pins from sdk_config.h. Actually, the log module only uses one pin (UART TX pin) and it is set by:

    // <o> NRF_LOG_BACKEND_UART_TX_PIN - UART TX pin 
    #ifndef NRF_LOG_BACKEND_UART_TX_PIN
    #define NRF_LOG_BACKEND_UART_TX_PIN 6
    #endif

    By default this is set to P0.06. If you want to set it to a pin on P1, e.g. P1.10, you need to add 32. You can either hardcode this, or you can use the macro NRF_GPIO_PIN_MAP(1,10).

    Alternatively, if you have a JLink debugger connected, you can use the RTT log backend, which is done in the ble_app_uart example. Look at the definition:

    //==========================================================
    // <e> NRF_LOG_BACKEND_RTT_ENABLED - nrf_log_backend_rtt - Log RTT backend
    //==========================================================
    #ifndef NRF_LOG_BACKEND_RTT_ENABLED
    #define NRF_LOG_BACKEND_RTT_ENABLED 1
    #endif

    in that example's sdk_config.h file.

    Best regards,

    Edvin

Reply
  • Hello,

    We don't have a USB log backend, but if you want to use P1.10 and P1.03, you can easily change the log pins from sdk_config.h. Actually, the log module only uses one pin (UART TX pin) and it is set by:

    // <o> NRF_LOG_BACKEND_UART_TX_PIN - UART TX pin 
    #ifndef NRF_LOG_BACKEND_UART_TX_PIN
    #define NRF_LOG_BACKEND_UART_TX_PIN 6
    #endif

    By default this is set to P0.06. If you want to set it to a pin on P1, e.g. P1.10, you need to add 32. You can either hardcode this, or you can use the macro NRF_GPIO_PIN_MAP(1,10).

    Alternatively, if you have a JLink debugger connected, you can use the RTT log backend, which is done in the ble_app_uart example. Look at the definition:

    //==========================================================
    // <e> NRF_LOG_BACKEND_RTT_ENABLED - nrf_log_backend_rtt - Log RTT backend
    //==========================================================
    #ifndef NRF_LOG_BACKEND_RTT_ENABLED
    #define NRF_LOG_BACKEND_RTT_ENABLED 1
    #endif

    in that example's sdk_config.h file.

    Best regards,

    Edvin

Children
No Data
Related