Question
How to perform continuous sending and reading with DMA ?
Hello,
I looked at an example of DMA on CubeMX and I got this code :
/* Infinite loop */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
if (transferErrorDetected == 1)
{
/* Toggle LED4 with a period of 200 ms */
BSP_LED_Toggle(LED4);
HAL_Delay(200);
}
if (transferCompleteDetected == 1)
{
/* Turn LED4 on*/
BSP_LED_On(LED4);
transferCompleteDetected = 0;
}
}
/* USER CODE END 3 */
}
It only works once, how to repeat this sending infinitely ?
/* Configure the source, destination and buffer size DMA fields and Start DMA Channel/Stream transfer */
/* Enable All the DMA interrupts */
if (HAL_DMA_Start_IT(&hdma_memtomem_dma1_channel1, (uint32_t)&aSRC_Const_Buffer, (uint32_t)&aDST_Buffer, BUFFER_SIZE) != HAL_OK)
{
/* Transfer Error */
Error_Handler();
}
Do I have to stop the DMA, recover the data and restart the DMA each time ?
Thank you for your answer
