0x00020001 embedded communication_error ai_generated true

UART: CTS flow control timeout, transmission stalled on USART2

ID: embedded/uart-cts-flow-control-timeout

Also available as: JSON · Markdown · 中文
89%Fix Rate
84%Confidence
1Evidence
2023-08-14First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
STM32F405 HAL 1.8.0 active
Zephyr RTOS 3.6.0 active

Root Cause

UART CTS (Clear to Send) line held high by remote device or stuck due to hardware fault, causing transmitter to wait indefinitely.

generic

中文

UART CTS(清除发送)线被远程设备拉高或因硬件故障卡住,导致发送器无限期等待。

Official Documentation

https://www.st.com/resource/en/reference_manual/dm00031020-stm32f405-415-l4-series-reference-manual-stmicroelectronics.pdf

Workarounds

  1. 87% success Implement CTS timeout in firmware: if (HAL_UART_GetState(&huart2) == HAL_UART_STATE_BUSY_TX) { HAL_UART_Abort(&huart2); HAL_UART_Transmit_IT(&huart2, pData, Size); }
    Implement CTS timeout in firmware: if (HAL_UART_GetState(&huart2) == HAL_UART_STATE_BUSY_TX) { HAL_UART_Abort(&huart2); HAL_UART_Transmit_IT(&huart2, pData, Size); }
  2. 92% success Add a pull-down resistor on CTS line to force low in case of floating signal; measure CTS voltage with oscilloscope.
    Add a pull-down resistor on CTS line to force low in case of floating signal; measure CTS voltage with oscilloscope.

中文步骤

  1. Implement CTS timeout in firmware: if (HAL_UART_GetState(&huart2) == HAL_UART_STATE_BUSY_TX) { HAL_UART_Abort(&huart2); HAL_UART_Transmit_IT(&huart2, pData, Size); }
  2. Add a pull-down resistor on CTS line to force low in case of floating signal; measure CTS voltage with oscilloscope.

Dead Ends

Common approaches that don't work:

  1. 75% fail

    Disabling hardware flow control entirely may cause data loss; it is not a fix for CTS timeout but a workaround that changes protocol.

  2. 90% fail

    Increasing UART baud rate does not resolve CTS line stuck high; the issue is external signal, not internal timing.