Using STM32CubeIDE project and MCU STM32H750. After calling HAL_DMA_Start() data is transferring, but the hdma_memtomem_dma2_stream1.State is still in HAL_DMA_STATE_BUSY. So calling the abort HAL_DMA_Abort() and transferring the next set of data
// Following is the DMA Initialization.
DMA_HandleTypeDef hdma_memtomem_dma2_stream1;
main(){
:
:
:
/* Initialize all configured peripherals */
MX_DMA_Init();
HAL_DMA_Start(&hdma_memtomem_dma2_stream1, (uint32_t)&g_aui16SourceVal[0], (uint32_t)&g_auc16DestVal[0], 16);
if (HAL_DMA_STATE_READY != hdma_memtomem_dma2_stream1.State){
HAL_DMA_Abort(&hdma_memtomem_dma2_stream1);
}
:
:
:
} /* End of main */
static void MX_DMA_Init(void)
{
/* DMA controller clock enable */
__HAL_RCC_DMA1_CLK_ENABLE();
__HAL_RCC_DMA2_CLK_ENABLE();
/* Configure DMA request hdma_memtomem_dma2_stream1 on DMA2_Stream1 */
hdma_memtomem_dma2_stream1.Instance = DMA2_Stream1;
hdma_memtomem_dma2_stream1.Init.Request = DMA_REQUEST_MEM2MEM;
hdma_memtomem_dma2_stream1.Init.Direction = DMA_MEMORY_TO_MEMORY;
hdma_memtomem_dma2_stream1.Init.PeriphInc = DMA_PINC_ENABLE;
hdma_memtomem_dma2_stream1.Init.MemInc = DMA_MINC_DISABLE;
hdma_memtomem_dma2_stream1.Init.PeriphDataAlignment = DMA_PDATAALIGN_HALFWORD;
hdma_memtomem_dma2_stream1.Init.MemDataAlignment = DMA_MDATAALIGN_HALFWORD;
hdma_memtomem_dma2_stream1.Init.Mode = DMA_NORMAL;
hdma_memtomem_dma2_stream1.Init.Priority = DMA_PRIORITY_LOW;
hdma_memtomem_dma2_stream1.Init.FIFOMode = DMA_FIFOMODE_ENABLE;
hdma_memtomem_dma2_stream1.Init.FIFOThreshold = DMA_FIFO_THRESHOLD_1QUARTERFULL;
hdma_memtomem_dma2_stream1.Init.MemBurst = DMA_MBURST_SINGLE;
hdma_memtomem_dma2_stream1.Init.PeriphBurst = DMA_PBURST_SINGLE;
if (HAL_DMA_Init(&hdma_memtomem_dma2_stream1) != HAL_OK)
{
Error_Handler( );
}
:
:
}
