Sending data without a delimiter using the nordic uart service (NUS) sample - Dropping bytes

I'm developing my application using the NRF Connect SDK in VS code.  SDK Version 2.4.2.  The NRF52832f we're using is integrated into a module made by fanstel and it has been assembled on our own internal ECU that interfaces with another microcontroller.  We're wanting to use the nordic uart service (NUS) to transfer data from one device to another,  in this case using two circuit boards but in the future one of the boards will be replaced by a smart phone.

In our project we're sending binary data using the nordic uart service profile with the peripheral uart service sample application connected to the central uart service sample application on a different evaluation board.  I added a periodic uart flush which disables the uart (code example below) because I don't have a delimiter character to indicate data is done being sent but I think this potentially makes me drop bytes when the central may receive bytes over it's physical UART between the time I disable the UART and before it's enabled again.  I see bytes drop frequently, using a BLE sniffer and also confirmed via inspection in the RTT console, which is causing serious throughput issues.

Does anyone have any experience with this?  I'm also concerned that even if I do designate a delimiter like \r\n the process of disabling/renabling the uart in the uart interrupt as is done in the sample project will still make bytes drop if more messages are sent in short succession after this.  Does anyone have the UART peripheral running without enable/disable anywhere and without delimiters?  Thanks in advance!

void uart_timeout_flush(void)
{
	for (;;) {
		if(uart_bytes_read > 0u)
		{
			uart_bytes_read = 0;
			LOG_INF("UART Flush: ");
			disable_req = true;
			uart_rx_disable(uart);
		}
		k_sleep(K_MSEC(50));
	}
}

K_THREAD_DEFINE(uart_timeout_flush_thread_id, UART_FLUSH_STACKSIZE, uart_timeout_flush, NULL, NULL,
		NULL, UART_FLUSH_PRIO, 0, 0);

Parents Reply Children
No Data
Related