Hello @MMARI.1 ,
Can you please share your DMA configuration ?
Here is an extract from the STM32CubeF1 FW under the root STM32Cube_FW_F1_V1.8.0\Projects\STM3210E_EVAL\Examples\DMA\DMA_FLASHToRAM :
static void DMA_Config(void)
{
/*## -1- Enable DMA1 clock #################################################*/
__HAL_RCC_DMA1_CLK_ENABLE();
/*##-2- Select the DMA functional Parameters ###############################*/
DmaHandle.Init.Direction = DMA_MEMORY_TO_MEMORY; /* M2M transfer mode */
DmaHandle.Init.PeriphInc = DMA_PINC_ENABLE; /* Peripheral increment mode Enable */
DmaHandle.Init.MemInc = DMA_MINC_ENABLE; /* Memory increment mode Enable */
DmaHandle.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD; /* Peripheral data alignment : Word */
DmaHandle.Init.MemDataAlignment = DMA_MDATAALIGN_WORD; /* memory data alignment : Word */
DmaHandle.Init.Mode = DMA_NORMAL; /* Normal DMA mode */
DmaHandle.Init.Priority = DMA_PRIORITY_HIGH; /* priority level : high */
/*##-3- Select the DMA instance to be used for the transfer : DMA1_Channel1 #*/
DmaHandle.Instance = DMA_INSTANCE;
/*##-4- Initialize the DMA stream ##########################################*/
if(HAL_DMA_Init(&DmaHandle) != HAL_OK)
{
/* Initialization Error */
Error_Handler();
}
/*##-5- Select Callbacks functions called after Transfer complete and Transfer error */
HAL_DMA_RegisterCallback(&DmaHandle, HAL_DMA_XFER_CPLT_CB_ID, TransferComplete);
HAL_DMA_RegisterCallback(&DmaHandle, HAL_DMA_XFER_ERROR_CB_ID, TransferError);
/*##-6- Configure NVIC for DMA transfer complete/error interrupts ##########*/
/* Set Interrupt Group Priority */
HAL_NVIC_SetPriority(DMA_INSTANCE_IRQ, 0, 0);
/* Enable the DMA STREAM global Interrupt */
HAL_NVIC_EnableIRQ(DMA_INSTANCE_IRQ);
/*##-7- Start the DMA transfer using the interrupt mode ####################*/
/* Configure the source, destination and buffer size DMA fields and Start DMA Channel transfer */
/* Enable All the DMA interrupts */
if (HAL_DMA_Start_IT(&DmaHandle, (uint32_t)&aSRC_Const_Buffer, (uint32_t)&aDST_Buffer, BUFFER_SIZE) != HAL_OK)
{
/* Transfer Error */
Error_Handler();
}
}
Have you respected the 7 steps ?
Best Regards,
Pierre