Hi.
In nrf52840 is it possible to use in NRF_LOG the second UART (DMA based) ?
I know i can define the TX pin in the SDK_CONFIG but can the NRF_LOG_BACKEND_UART work with UARTE1 ?
Hi,
The UART instance used by the logger is hardcoded in the source (components\libraries\log\src\nrf_log_backend_uart.c:48 in SDK 17.1.0). If you want to use the second UART instance, you need to modify this line to:
nrf_drv_uart_t m_uart = NRF_DRV_UART_INSTANCE(1);
Note that the logger backend uses the UART driver configuration, so you need to enable the second UART instance in your sdk_config.h file:
// <e> UART1_ENABLED - Enable UART1 instance //========================================================== #ifndef UART1_ENABLED #define UART1_ENABLED 1 #endif
Best regards,
Jørgen
Thanks! But i looked in the code , doesn't it rely on the interrupts ? as far as i know it's based on DMA and from what i recall works differently than interrupt based UART, for input AND output (like you need to define the output buffer).
Hi,
Both UART and UARTE peripherals are using interrupt, the main difference is that UARTE peripherals uses EasyDMA to get/put data from/to buffers in RAM without CPU, while with the UART peripheral the CPU needs to provide/get the data to/from the peripheral for each byte.
NRF_LOG library uses the nrf_drv_uart driver, which will handle the differences between the peripheral types for you. The driver is configured to use UARTE for instance 0 used by the logger in most examples.
Best regards,
Jørgen