UART and Logger

I want to use the UART to receive data, but that doesn't look possible if I use the Logging Module.   I don't see where the logger module will interrupt my code to tell me I've received a character.

So must I disable the Logger to gain full interrupt control of the UART?

  • Hi James,

    UART0 is usually used for logging.. The logging module can be configured to use a different backend, such as the RTT.. This ensures that the UART instance is free to be used for your application.. To do this, you need to add the following to prj.conf:

    CONFIG_USE_SEGGER_RTT=y
    CONFIG_LOG=y
    CONFIG_LOG_BACKEND_RTT=y
    CONFIG_LOG_BACKEND_UART=n

    You could also use another UART instance (eg.: you can use UART1 to receive data if UART0 is used for logging)

    Regards,

    Swathy

  • Thank you for such a quick response!   I will work to use the RTT for logging.

    What is the physical layer for RTT on the nRF52DK board?

    I see that the UART is connected from the nRF52832 to the nRF5340, but I don't see anything connections labelled RTT.

    Thanks, and hopefully this is my last question.

    Jim

  • Hi James,

    RTT (Real-Time Transfer) on the nRF52 DK does not use a dedicated physical connection like UART does. Instead, RTT operates through the existing debug interface. 

    Jim Logsdon said:
    I see that the UART is connected from the nRF52832 to the nRF5340, but I don't see anything connections labelled RTT.

    The RTT is not a peripheral on the nRF in the same way. RTT works by having the debugger read and write to specific memory locations on the nRF52832 chip. This means it doesn't require any additional pins or physical connections beyond what's already used for debugging. It is just the debugger reading some memory areas on the nRF, which doesn't affect the performance of the chip. 

    Best Regards,

    Swathy

  • Oh.  That makes so much sense.  Can you still use the debug interface for debugging while also using it as the Logger back end?

  • Jim Logsdon said:
    Can you still use the debug interface for debugging while also using it as the Logger back end?

    Yes, it should be possible. Slight smile

    Regards,

    Swathy

Related