I try to send the NRF_LOG_INFO() messages over a own backend interface. I tried to add a new backend with nrf_log_backend_add() and enable it with nrf_log_backend_enable(). But as soon as I do this, I only get the first log print over RTT and afterwards I receive nothing. I seems the software is "stuck" somewhere.
NRF52832, SDK 15.3 and Softdevice 6.1.1.
#define NRF_LOG_BACKEND_RTT_ENABLED 1 in sdk_conf.h
void logPut(nrf_log_backend_t const * p_backend, nrf_log_entry_t * p_msg)
{
//send over uart
}
static void logFlush(nrf_log_backend_t const * p_backend)
{
//send over uart
}
static void logPanic(nrf_log_backend_t const * p_backend)
{
//send over uart
}
const nrf_log_backend_api_t sOwnLogBackendApi = {
.put = logPut,
.flush = logFlush,
.panic_set = logPanic,
};
static nrf_log_backend_t sOwnLogBackend = {
.p_api = & sOwnLogBackendApi,
};
void logInit()
{
const ret_code_t err_code = NRF_LOG_INIT(NULL);
APP_ERROR_CHECK(err_code);
NRF_LOG_DEFAULT_BACKENDS_INIT();
int32_t backend_id = nrf_log_backend_add(& sOwnLogBackend, NRF_LOG_SEVERITY_DEBUG);
APP_ERROR_CHECK_BOOL(backend_id >= 0);
nrf_log_backend_enable(& sOwnLogBackend);
}
void uartInit(uartMessageHandler_t uartMessageHandler)
{
sUartMessageHandler = uartMessageHandler;
const app_uart_comm_params_t comm_params =
{
.rx_pin_no = RX_PIN_NUMBER,
.tx_pin_no = TX_PIN_NUMBER,
.rts_pin_no = RTS_PIN_NUMBER,
.cts_pin_no = CTS_PIN_NUMBER,
.flow_control = APP_UART_FLOW_CONTROL_DISABLED,
.use_parity = false,
.baud_rate = NRF_UART_BAUDRATE_115200
};
uint32_t result;
APP_UART_FIFO_INIT(& comm_params,
UART_RX_BUF_SIZE,
UART_TX_BUF_SIZE,
onUartEvent,
APP_IRQ_PRIORITY_LOWEST,
result);
APP_ERROR_CHECK(result);
}
