USART2_IRQHandler called continuously for DMA reception on STM32L031K6T6 with hardware flow control
- May 6, 2022
- 6 replies
- 2616 views
Hi. I am using UART with DMA for TX and RX on STM32L031. It communicates with nRF52833 over UART with hwfc enabled. My problem is, when I receive data from nRF52, USART2_IRQHandler is called continuously. Below is the screenshot of all the flags that are set. Transmission from ST to Nordic works properly(tested 65535+ times). I receive around 3 data packets from nordic to ST and then the communication stops because USART2_IRQHandler is called contiuously. Why is this happening? Is there any workaroound for this? I am using STM32CubeIDE and HAL libraries on linux.
(NOTE: without HWFC it was working properly but for more reliabilty, I need HWFC. It so happend that Nrodic would drop data packets whenever it was busy transmitting bluetooth beacon)
Below is the debug log from Nordic. You can see that CTS pin is toggling continuously.
<info> app: NRF_UARTE_EVENT_CTS...
<info> app_timer: RTC: initialized.
<info> app: Debug logging for UART over RTT started.
<info> app: NRF_UARTE_EVENT_RXSTARTED...
<info> app: tx_data[0] = 01
<info> app: EVT:NRF_UARTE_EVENT_TXSTARTED
<info> app: NRF_UARTE_EVENT_NCTS...
<info> app: NRF_UARTE_EVENT_CTS...
<info> app: NRF_UARTE_EVENT_NCTS...
<info> app: NRF_UARTE_EVENT_CTS...
<info> app: NRF_UARTE_EVENT_NCTS...
<info> app: NRF_UARTE_EVENT_CTS...
<info> app: NRF_UARTE_EVENT_NCTS...
<info> app: NRF_UARTE_EVENT_CTS...
<info> app: NRF_UARTE_EVENT_NCTS...
<info> app: NRF_UARTE_EVENT_CTS...
<info> app: NRF_UARTE_EVENT_NCTS...
<info> app: NRF_UARTE_EVENT_NCTS...
<info> app: NRF_UARTE_EVENT_CTS...
<info> app: NRF_UARTE_EVENT_NCTS...
<info> app: NRF_UARTE_EVENT_CTS...
<info> app: NRF_UARTE_EVENT_NCTS...
<info> app: NRF_UARTE_EVENT_CTS...
<info> app: tx_data[0] = 02
<info> app: EVT:NRF_UARTE_EVENT_TXSTARTED
<info> app: NRF_UARTE_EVENT_NCTS...
<info> app: NRF_UARTE_EVENT_CTS...
<info> app: NRF_UARTE_EVENT_NCTS...
<info> app: NRF_UARTE_EVENT_CTS...
<info> app: NRF_UARTE_EVENT_NCTS...
<info> app: NRF_UARTE_EVENT_CTS...
<info> app: NRF_UARTE_EVENT_NCTS...
<info> app: NRF_UARTE_EVENT_CTS...
<info> app: NRF_UARTE_EVENT_NCTS...
<info> app: NRF_UARTE_EVENT_CTS...
<info> app: NRF_UARTE_EVENT_NCTS...
<info> app: tx_data[0] = 03
<info> app: EVT:NRF_UARTE_EVENT_TXSTARTED
<info> app: NRF_UARTE_EVENT_NCTS...
<info> app: NRF_UARTE_EVENT_CTS...
<info> app: NRF_UARTE_EVENT_NCTS...
<info> app: NRF_UARTE_EVENT_CTS...
<info> app: NRF_UARTE_EVENT_NCTS...
<info> app: NRF_UARTE_EVENT_CTS...
<info> app: NRF_UARTE_EVENT_NCTS...
<info> app: NRF_UARTE_EVENT_CTS...
<info> app: NRF_UARTE_EVENT_NCTS...
<info> app: NRF_UARTE_EVENT_CTS...
<info> app: NRF_UARTE_EVENT_NCTS...
<info> app: NRF_UARTE_EVENT_CTS...
<info> app: NRF_UARTE_EVENT_NCTS...
<info> app: NRF_UARTE_EVENT_CTS...
<info> app: NRF_UARTE_EVENT_NCTS...
<info> app: NRF_UARTE_EVENT_CTS...
<info> app: NRF_UARTE_EVENT_NCTS...
<info> app: NRF_UARTE_EVENT_CTS...
<info> app: NRF_UARTE_EVENT_NCTS...
<info> app: NRF_UARTE_EVENT_CTS...
<info> app: NRF_UARTE_EVENT_NCTS...