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 LED3.
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.
STM32C0116-DISCO’s LED3 can be used to monitor the transfer status:
System, DMA, Data Transfer, Memory to memory, Flash, SRAM
This example runs on STM32C011F6Ux devices.
This example has been tested with STM32C0116-DISCO board and can be easily tailored to any other supported device and development board.
In order to make the program work, you must do the following :