pausing RX LibUARTE async with HWFC

Hiya,

I was recently looking into using libuarte (alongside SD related functionality) and while trying to pump as much data as I could over UART noticed some missing bytes on BLE notifications. On further inspection I realized that libuarte async simply keeps passing my application RX data so long as the device on the other end keeps supplying said data. Compared to UART, BLE is awfully slow of course, so I decided I should just deassert CTS/RTS to stop incoming RX until I have space to store the incoming RX buffers again.

So in essence, async provides buffers with data, I place this data in my own buffer, to make sure async has plenty of space in it's RX pool. When my own buffer is full, I want to stop RX temporarily

I found nrf_libuarte_async_rts_clear() and nrf_libuarte_async_rts_set(), but I thought this was for TX. I have tried it, but it doesn't appear to do anything for RX.

I tried doing it behind libuarte async's back, by doing it with nrf_libuarte_drv_rx_stop() and nrf_libuarte_drv_rx_start(), making sure to set p_ctrl_blk->rx_halted to true and false, and doing things similar to async's internals. However, it usually ends up with some APP_ERROR_CHECK.. call, resulting in failure.

Am I misunderstanding something? Have I defined my pins incorrectly (i.e. swapped CTS/RTS). Does async have this capability of briefly pausing RX, or should I look to use lower level interfaces such as nrf_libuarte_drv, or even nrf_uarte directly?

Edit: this concerns NRF SDK 17.1.0 (the newest), and im testing it on an nRF52840.

KR,

doowl

Related