This is my environment
- IDE: VSC
- SDK: NCS v2.2.0
- nRF52832 on custom hardware
I am running the Aysnc UART to receive commands from an external PC. I want the UART to remain active for at least 60 seconds after the last UART_RX_RDY has been received, but I'm having issues getting this to work as I would expect.
I've got a timer to take care of putting my device into idle mode if nothing is received for a period of 60 seconds, but the UART seems to be receiving a UART_RX_DISABLED event before this time, which means if the user attempts to send any more commands, then nothing happens.
I've set up the async uart as follows:
uart_rx_enable(uart, uart_double_buffer[0], UART_BUF_SIZE, UART_RX_TIMEOUT_MS);
Currently, UART_RX_TIMEOUT_MS (and I'm using v2.2.0 of NCS, so I think the number that is being passed is actually a usec value) is set to 1000. And what I am seeing is that it is taking ~ 20sec of inactivity on the UART RX before the UART_RX_DISABLED is called. This then disables the UART and I can no longer send any commands.
I read in one ticket that you can set the UART up using SYS_FOREVER_US for the timeout parameter, and the UART should not timeout. But when I use this, the UART RX function seems to stop working altogether.
Basically, what I want is for the UART to sit there in the background waiting for commands whilst the device is active. Then, when my idle timer expires and I put the device into low power idle mode, I will deactivate the UART myself. Is there another way of doing this rather than trying to use the timeout parameter in the uart_rx_enable() API?
Regards,
Mike