DMA_CopyFromFlashToMemory_Init Example Description

How to use a DMA channel to transfer a word data buffer from Flash memory to embedded SRAM. The peripheral initialization uses LL initialization functions to demonstrate LL init usage.

At the beginning of the main program the SystemClock_Config() function is used to configure the system clock (SYSCLK) to run at 48 MHz.

Then the LED_Init() function is used to initialize the LED1.

Then the Configure_DMA() function is used to configure the DMA1_Channel1 to transfer the contents of a 32-word data buffer stored in Flash memory to the reception buffer declared in RAM.

The start of transfer is triggered by software(LL_DMA_EnableChannel()). DMA1_Channel1 memory-to-memory transfer is enabled. Source and destination addresses incrementing is also enabled. The transfer is started by setting the channel enable bit for DMA1_Channel1. At the end of the transfer a Transfer Complete interrupt is generated since it is enabled and the callback function (customized by user) is called.

Finally, aSRC_Const_Buffer and aDST_Buffer are compared through Buffercmp() in order to check buffers correctness.

STM32C0316-DISCO’s LED1 can be used to monitor the transfer status:

Keywords

System, DMA, Data Transfer, Memory to memory, Flash, SRAM

Directory contents

Hardware and Software environment

How to use it ?

In order to make the program work, you must do the following :