Skip to main content
Associate
Nov 12, 2026 1:39 PM UTC
Solved

STM32WB5MM:HAL_UARTEx_ReceiveToIdle_DMA reports IDLE event with Size=256 although the logic analyzer shows continuous data (USART1, DMA Normal)

The STM32 sends an HTTP GET with the AT command AT#XHTTPCREQ. The modem answers with the HTTP header, a #XHTTPCRSP:<len>,<state> line and the body. The complete response is about 4432 bytes. I start reception with:

HAL_UART_AbortReceive(&huart1);
while (HAL_UART_GetState(&huart1) != HAL_UART_STATE_READY);
HAL_UARTEx_ReceiveToIdle_DMA(&huart1, (uint8_t*)rx_buffer, 4500); // buffer is 4500 bytes

Problem
HAL_UARTEx_RxEventCallback is called with huart->RxEventType == HAL_UART_RXEVENT_IDLE and Size = 256, and the reception ends. The value is always exactly 256, and the rest of the response is not received!!


Setup:

  • MCU: STM32WB5MMGH
  • IDE / CubeMX / HAL package version 6.15.0
  • Peer device: nRF9160 running Serial LTE Modem (AT commands over UART)

Cube configuration:

  • USART1: asynchronous, 115200 baud, 8N1, oversampling 16, FIFO mode disabled, hardware flow control disabled, overrun enabled, DMA on RX error enabled
  • USART1_RX: DMA1 Channel 3, peripheral to memory, Normal mode, byte/byte, memory increment on, priority High
  • USART global interrupt and DMA1 channel 3 interrupt enabled

Observation:

  1. Without breakpoints: RxEvent type=2 (IDLE) Size=256.
  2. With a breakpoint placed right after the HAL_UARTEx_ReceiveToIdle_DMA call, the callback reports type=1 (HT) Size=4432, then type=2 (IDLE) Size=4432. I assume this is because the CPU was halted while the DMA kept filling the buffer.
  3. A logic analyzer on the modem TX line shows no idle gap at the 256-byte position!!

Questions

  1. Under what conditions can the USART IDLE flag be set while the line is carrying continuous data? For example: a clock, baud or sampling issue, noise on RX, or a very short gap (about one frame time, 87 µs) that a logic analyzer misses.
  2. Is there any configuration I missed, or any USART/DMA interaction on the STM32WB, that could produce an IDLE event at a fixed position such as 256 bytes?
Saket_OmBest answer
ST Technical Moderator
Nov 13, 2026 10:31 AM UTC

Hello ​@Youssef Harby 

Under what conditions can the USART IDLE flag be set while the line is carrying continuous data? 

The USART recognizes an idle character as the RX line remaining at logic 1 for an entire frame period, including the stop-bit time.

Please see the RM0434;

 

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Saket_Om

1 reply

Saket_OmBest answer
ST Technical Moderator
Nov 13, 2026 10:31 AM UTC

Hello ​@Youssef Harby 

Under what conditions can the USART IDLE flag be set while the line is carrying continuous data? 

The USART recognizes an idle character as the RX line remaining at logic 1 for an entire frame period, including the stop-bit time.

Please see the RM0434;

 

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Saket_Om