NRFX UART RX CONTINUOUS RECEIVE where RX LEN is unknown

Hello,

  I am using nrfx library for nrf5340 because I wanted to change UART pins dynamically at run time by disabling, changing pins and renabling the UART.  This part is working fine,

Now I neewd to know how to receive data continuously and fill to an OS fifo. 

Right now I am having a handler as below

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
static void uarte_handler(nrfx_uarte_event_t const * p_event, void * p_context)
{
· · nrfx_uarte_t * p_inst = p_context;
· · if (p_event->type == NRFX_UARTE_EVT_TX_DONE)
· · {
· · · · // NRFX_LOG_INFO("--> UARTE event: TX done");
· · · · // NRFX_LOG_INFO("Content of TX buffer: %s", m_tx_buffer);
· · · · // NRFX_LOG_INFO("Content of RX buffer: %s", m_rx_buffer);
· · }
· · else
· · {
· · · · //NRFX_LOG_INFO("UARTE event: %d", p_event->type);
· · }
· · //nrfx_uarte_uninit(p_inst);
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
And the method of initializing RX is to do something like below
   status = nrfx_uarte_rx(&uarte_inst, m_rx_buffer, sizeof(m_rx_buffer));
   NRFX_ASSERT(status == NRFX_SUCCESS);
But how can I continuously receive data where I don't know the length of data because that depends on payload type and this is totally asynchronous and at any time I should be able to receive data. In this scenereo how to achieve it?