I want to check for an RX timeout after sending a TX.
I am puzzled on how this comes about.
As best I can tell I have enabled TIMER3 for the timeout.
NRF_LIBUARTE_ASYNC_DEFINE(uart1, 1, 2, NRF_LIBUARTE_PERIPHERAL_NOT_USED, 3, 255, 3);
I have created a timeout of 50*1000 us. (50ms)
nrf_libuarte_async_config_t uart1_config = {
.tx_pin = UART1_TX_PIN,
.rx_pin = UART1_RX_PIN,
.baudrate = NRF_UARTE_BAUDRATE_19200,
.parity = NRF_UARTE_PARITY_EXCLUDED,
.hwfc = NRF_UARTE_HWFC_DISABLED,
.timeout_us = 1000*50,
.int_prio = APP_IRQ_PRIORITY_LOW
};
I have read that maybe the timeout comes back during the NRF_LIBUARTE_ASYNC_EVT_RX_DATA event but I'm unsure and I'm also unsure what triggers the timeout begin.
void uart1_event_handler(void * context, nrf_libuarte_async_evt_t * p_evt)
{
nrf_libuarte_async_t * p_libuarte = (nrf_libuarte_async_t *)context;
ret_code_t ret;
switch (p_evt->type)
{
...
case NRF_LIBUARTE_ASYNC_EVT_RX_DATA:
if (p_evt->data.rxtx.length == 0)
{
printf("Receive Timeout Occured\n");
}
else
{
//We received data, do something with it.
printf("%s", p_evt->data.rxtx.p_data);
}
...
Kind regards.