2023-12-05 04:29 AM - edited 2023-12-05 04:44 AM
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
2023-12-06 01:59 AM - edited 2023-12-06 05:25 AM
Hi,
This program is an example of ST it doesn't come from me. As I say before, the program it executes only once so how can it encounter an error because it must be able to at least a second time. Right ? unless the ST program contains an error.
When the program starts LED4 is off, and I put
I put 2 breakpoints at this level, Error_Handler and transferErrorDetected. And I never enter this breakpoint in DEBUG mode.
I pause and put a breakpoint at that level and the program never stops, that's why I say the program only transmits once. And I would like the sending and receiving to be continuous.
To switch to circular DMA mode it's impossible since I have no choice