nrf52840 UART variable length receive

hi

I have a question about uart receive.

The UART example receives data based on special characters or the length of the received data to determine whether it is a string.but in my code receives not special characters or unknown length.

In the nRF5 SDK v17.1.0 has example of \examples\peripheral\libuarte, It manages the receive buffers and implements the receiver inactivity timeout.I need this way to receive UART string that unknown length and do not contain special character.

My code is based on FREERTOS,I  tryed nrf_libuarte_async.c,nrf_libuarte_drv.c etc all the way to my code,but Compile error.

How do I implement receiving UART data of variable length like example of \examples\peripheral\libuarte?

I looking forward.

gary

  • Thanks for your reply, the problem has been solved.
    But I have one more question. My program uses the NRF_LIBARTE_ASYNC_EVT_RX_DATA event to determine if the data has been received.
    When data is received, timeout and RX_buffer is full generate events. If a timeout occurs, an event is generated indicating that the data stream has been received. If rx_Buffer is full, an event is generated indicating that the data may not have been received.

    When an event is generated, how do you know that data is still being received?

  • shark said:
    If a timeout occurs, an event is generated indicating that the data stream has been received. If rx_Buffer is full, an event is generated indicating that the data may not have been received.

    It is a bit unclear to me what you mean here.  

    shark said:
    If a timeout occurs, an event is generated indicating that the data stream has been received.

    A timeout normally means that the complete data has not being received.

    shark said:
    When an event is generated, how do you know that data is still being received?

    Which event exactly are we discussing about here? Is it still NRF_LIBARTE_ASYNC_EVT_RX_DATA ?

Related