Various uses of Delay in STM32
This is to document various uses of delays like HAL_Delay() in STM32 code.
I have found 2 decent uses
1. Put at the start of /* USER CODE BEGIN 2 */ to stop the code from executing when we are reprogramming the board.
2. Put at the start of /* USER CODE BEGIN 2 */ to give time to properly initialize DMA related functionality.
/* USER CODE BEGIN 2 */
HAL_Delay(2000);
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 2 */
without the delay the DMA reception was not working.
Please put any other / any modification anyone find / know here to make it as a central repository.
Edited by ST moderator to be inline with the community rules especially with the code sharing. In next time please use </> button to paste your code. Please read this post: How to insert source code
