UART RX data loss from time to time when BLE communication is enabled

Hi,

We have a device in production based on nrf52840 which uses UARTE to TX/RX data to/from a washing machine and in paralel communicates with a Phone App via BLE.

SD: 132_3.0  |  nRF5 SDK v12.3.0

Communicating with the machine via UART works without data loss when SoftDevice is disabled, however when SD is enabled and firmware communicates with PhoneApp, we experience the loss of 1-2 bytes from time to time.

UART Settings: baudrate 38400, no flow control. 

Data exchange / second: TX = 19bytes, RX=48bytes.

My assumption is that the data loss is caused by CPU being disabled or owned by the SD processing during BLE communication. Do you think this is the case? If yes, I would expect to receive ‘Overrun errors’ reported in the uart event handler, but I get none. Is there a way to enable UART driver logging to maybe get more information on data loss?

We use ‘use_easy_dma = 1’  and ‘rx_dma_buf[1]’. Could increasing the ‘rx_dma_buf’ fix the problem? I tried to make buffer size 2 but it stopped receiving data...

NOTE: All the RX bytes are reported with PARITY_ERROR in the Uart event handler (NRF_DRV_UART_EVT_ERROR) - we suspect machine parity is ODD even if machine specs state it's EVEN. My question is: why do we still receive all the correct bytes (NRF_DRV_UART_EVT_RX_DONE) if they are flagged as Parity error? (of course excepting when we're missing 1-2 bytes for reason explained above)

static void nrf_uart_event_handler(nrf_drv_uart_event_t *event, void *arg)
{
	nrf_uart_data_t *uart_data = (nrf_uart_data_t *)arg;
	switch (event->type)
	{
	case NRF_DRV_UART_EVT_RX_DONE:
		/* write received byte to FIFO */
		QB_ARRAY_ENQUEUE(event->data.rxtx.p_data[0]);
		/* continue rx */
		(void)nrf_drv_uart_rx(&uart_data->uart_inst, &uart_data->rx_dma_buf[0], 1);
		break;
	
	case NRF_DRV_UART_EVT_ERROR:
        /* continue rx */
		(void)nrf_drv_uart_rx(&uart_data->uart_inst, &uart_data->rx_dma_buf[0], 1);
        break;
	
	case NRF_DRV_UART_EVT_TX_DONE:
		/* get next byte from FIFO */
		(void)nrf_drv_uart_tx(&uart_data->uart_inst, &uart_data->tx_dma_buf, 1);
	}
}

Thank you.

Parents Reply Children
No Data
Related