cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7 UART7 DMA ReceiveToIdle appending responses instead of restarting or rewriting

vishnu_illikkal
Associate III

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!

image.png

image (1).png

image (2).png

image (3).png

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.

2 REPLIES 2
vishnu_illikkal
Associate III

vishnu_illikkal_0-1757576470605.png

vishnu_illikkal_1-1757576490705.png

vishnu_illikkal_2-1757576504559.png

 

these are my ioc settings

 

Guenael Cadier
ST Employee

Hi @vishnu_illikkal 

It looks like the Rx Complete callback is only called once, at the end of all reception sequence.
In other words could it happen that all received data are sent in sequence without sufficient time between some cars to trig the IDLE event ?
A test you could make is to add a counter in HAL_UARTEx_RxEventCallback() to check how many times it is called, and try to check what is the value of Size when called.

Hope this helps