Associate III
September 11, 2025
Question
STM32H7 UART7 DMA ReceiveToIdle appending responses instead of restarting or rewriting
- September 11, 2025
- 4 replies
- 516 views
Hello ST Community,
I am working with STM32H750VBTx on STM32CubeIDE. I use UART7 + DMA with HAL_UARTEx_ReceiveToIdle_DMA()
to receive responses from a GSM modem.
Problem:
- GSM responses are stored in my gsm_response_buffer[] incrementally
- For example: first "RDY", then "AT OK", then "ATE0 OK" → all get appended
- I expected each new DMA reception to start at buffer[0].
Debug screenshots are attached.
Could you please advise how to properly useDMA reception so each new response starts from
gsm_response_buffer[0]?
Thanks in advance!




Refer the code in the Test_GSM.c file also if needed
in the main.c file i call
```c
/* USER CODE BEGIN 2 */
#if (ENABLE_006_GSM_Folder == 1)
HAL_UARTEx_ReceiveToIdle_DMA( &huart7, gsm_response_buffer, GSM_RESPONSE_BUFFER_SIZE );
__HAL_DMA_DISABLE_IT(&hdma_uart7_rx, DMA_IT_HT);
#endif```
```c
/* USER CODE BEGIN 0 */
void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size)
{
if(huart->Instance == UART7){
HAL_UARTEx_ReceiveToIdle_DMA(&huart7,
gsm_response_buffer,
GSM_RESPONSE_BUFFER_SIZE);
__HAL_DMA_DISABLE_IT(&hdma_uart7_rx, DMA_IT_HT);
}
}
/* USER CODE END 0 */```
Edited to apply proper source code formatting - please see How to insert source code for future reference.
