Hello,
i have an application with soft device 112 and libuarte_async on nrf52811. Everything working well when I'm sending small amout of data.
But now i have a task to update firmware in external IC over TWI/I2C. That firmware should be writen in pages 0x2011 long (8209 bytes). Since i cant have that large buffer, i split the page to smaller chunks of max 255 bytes. With this aproach I'm able to send 11 pages out of 27 without any problem. But when I'm sending page 12, part of the bytes are lost. Everytime on the same location.
NRF_LIBUARTE_ASYNC_DEFINE(libuarte, 0,1, NRF_LIBUARTE_PERIPHERAL_NOT_USED, 2, 1024, 3); NRF_QUEUE_DEF(buffer_t, m_buf_queue, 255, NRF_QUEUE_MODE_NO_OVERFLOW);
I suspect that there could be some soft device interrupt. Could you please suggest me how to debug it?
My event handler is like this:
void uart_event_handle(void * context, nrf_libuarte_async_evt_t * p_evt)
...
switch (p_evt->type)
{
case NRF_LIBUARTE_ASYNC_EVT_RX_DATA:
buffer_t buf = {
.p_data = p_evt->data.rxtx.p_data,
.length = p_evt->data.rxtx.length,
};
ret = nrf_queue_push(&m_buf_queue, &buf);
APP_ERROR_CHECK(ret);
nrf_libuarte_async_rx_free(p_libuarte, p_evt->data.rxtx.p_data, p_evt->data.rxtx.length);
app_uart_flush();
and data are processed by nrf_queue_pop in main:
nrf_queue_pop(&m_buf_queue, &buf2);
memcpy(receivedData, buf2.data, buf2.length);
nrf_queue_reset(&m_buf_queue);