I am receiving bytes from a GPS module and passing them to BLE UART example app configured to use UARTE1 and asynchronous API.
After few minutes of running it starts leaking memory by not releasing RX buffers. Using RTT messages I identified it correspond to non-standard bytes. Especially often to 0x0092 and few others.
The uart_cb function in main.c was modified for debugging:
case UART_RX_RDY: LOG_INF("UART_RX_RDY"); buf = CONTAINER_OF(evt->data.rx.buf, struct uart_data_t, data[0]); buf->len += evt->data.rx.len; LOG_INF("UART buf len %u", buf->len); LOG_INF("UART evt->data.rx.len %u", evt->data.rx.len); if (disable_req) { return; } //DEBUG stuff #ifdef DEBUGCOMP if (buf->len < (DEBUG_CHAR_LEN -1)){ memcpy(debugchars, evt->data.rx.buf, buf->len); debugchars[buf->len]=0; LOG_INF("data.rx.buf: %s \n^^", debugchars); } #endif if ((evt->data.rx.buf[buf->len - 1] == '\n') || (evt->data.rx.buf[buf->len - 1] == '\r') || (evt->data.rx.buf[buf->len - 1] == 0x0a)) { #ifdef DEBUGCOMP LOG_INF("running uart_rx_disable(uarte);"); #endif disable_req = true; uart_rx_disable(uarte); } #ifdef DEBUGCOMP if (evt->data.rx.buf[buf->len - 1] == 0x0a) { LOG_INF("UART_RX last symbol LF"); } #endif break;
To rule out noise issues I recorded the signal with an oscilloscope
As you can see, there is no non-display symbols. And there is no noise.
Where should I focus on?