Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

libUARTE (SDK15.3) HWFC does not look fully supported.

Hi, 
I'm trying to implement UART interface with HW flow control on nRF52832. After some investigation I found libUARTE is the most advanced option.

During testing I found that RTS/CTS lines are always active (low) even at high data load. So I suspected wrong HW flow control operation.    
PS says: 
"If HW flow control is enabled the RTS signal will be deactivated when the receiver is stopped via the STOPRX task or when the UARTE is only able to receive four more bytes in its internal RX FIFO." 
For first case I found only 

nrf_libuarte_rx_stop();
that implemented in nrf_libuarte.c but never called. 
For second case libUARTE has double buffering so it handled i think. 

My question is: How to prevent host from sending any data in case when nordic application stop consuming received data (and stop calling nrf_libuarte_async_rx_free())? This can happen when peer send request that need to be processed on Nordic in time longer than 3*MTU_SIZE/baudrate. I suggest deactivating CTS once rx buffers are full and activate it again once buffers are free.  

Thanks

Parents
  • Hi Valerii,

    HWFC support is added to libuarte. Feature by default is disabled (NRF_LIBUARTE_DRV_HWFC_ENABLED flag enables it). RTS line is controlled by GPIOTE which is connected to TIMER which counts RX bytes. Whenever new RX buffer is setup then compare value is updated to be further in time. If RX buffer is not setup on time then compare event occurs which sets RTS pin. Additionally, it's possible to control RTS pin manually through API. It can be used to explicitly pause the transmission.

    Additionally, libuarte has detection of RX buffer not being set on time (may occur when HWFC is not used). Libuarte_async will report that as an event  (NRF_LIBUARTE_ASYNC_EVT_OVERRUN_ERROR). Event will contain number of dropped bytes.

     libuarte_hwfc2.zip

Reply
  • Hi Valerii,

    HWFC support is added to libuarte. Feature by default is disabled (NRF_LIBUARTE_DRV_HWFC_ENABLED flag enables it). RTS line is controlled by GPIOTE which is connected to TIMER which counts RX bytes. Whenever new RX buffer is setup then compare value is updated to be further in time. If RX buffer is not setup on time then compare event occurs which sets RTS pin. Additionally, it's possible to control RTS pin manually through API. It can be used to explicitly pause the transmission.

    Additionally, libuarte has detection of RX buffer not being set on time (may occur when HWFC is not used). Libuarte_async will report that as an event  (NRF_LIBUARTE_ASYNC_EVT_OVERRUN_ERROR). Event will contain number of dropped bytes.

     libuarte_hwfc2.zip

Children
Related