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

Parents
  • Hi,

    I think nrf_libuarte_async_rts_clear()/nrf_libuarte_async_rts_set() should have worked here. Did you set 

    NRF_LIBUARTE_DRV_HWFC_ENABLED to 1 in sdk_config.h ?
  • Hiya,

    I did not end up getting it working by swapping pins around, but eventually it did end up working, not entirely sure what happened. Maybe it worked already but the problem was on the opposing side of the serial connection. Regardless, these functions do what they should. Albeit I have to use nrf_libuarte_async_rts_set() to deassert, and nrf_libuarte_async_rts_clear() to assert. Perhaps I misconfigured something else, but the functions definitely perform the required functionality!

    Thanks for the confirmation and help!

    KR

Reply
  • Hiya,

    I did not end up getting it working by swapping pins around, but eventually it did end up working, not entirely sure what happened. Maybe it worked already but the problem was on the opposing side of the serial connection. Regardless, these functions do what they should. Albeit I have to use nrf_libuarte_async_rts_set() to deassert, and nrf_libuarte_async_rts_clear() to assert. Perhaps I misconfigured something else, but the functions definitely perform the required functionality!

    Thanks for the confirmation and help!

    KR

Children
No Data
Related