{"id":1665,"date":"2023-03-31T05:46:23","date_gmt":"2023-03-31T05:46:23","guid":{"rendered":"https:\/\/blog.embeddedexpert.io\/?p=1665"},"modified":"2023-03-31T05:46:26","modified_gmt":"2023-03-31T05:46:26","slug":"getting-started-with-stm32f103-dma-in-memory-to-memory-mode","status":"publish","type":"post","link":"https:\/\/blog.embeddedexpert.io\/?p=1665","title":{"rendered":"Getting Started with STM32F103: DMA in Memory to Memory Mode"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"683\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/03\/AdobeStock_111938559-1024x683.jpeg\" alt=\"\" class=\"wp-image-1666\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/03\/AdobeStock_111938559-1024x683.jpeg 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/03\/AdobeStock_111938559-300x200.jpeg 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/03\/AdobeStock_111938559-768x512.jpeg 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/03\/AdobeStock_111938559-1536x1024.jpeg 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/03\/AdobeStock_111938559-2048x1365.jpeg 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/03\/AdobeStock_111938559-1150x767.jpeg 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/03\/AdobeStock_111938559-750x500.jpeg 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/03\/AdobeStock_111938559-400x267.jpeg 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/03\/AdobeStock_111938559-250x167.jpeg 250w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>In this guide, we shall configure the DMA to transfer data from one memory location to another.<\/p>\n\n\n\n<p>This can save tone of CPU cycles compare to using traditional memcpy where it uses cpu rather than DMA.<\/p>\n\n\n\n<p>In this guide, we shall cover the following:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>DMA configuration for memory to memory transfer.<\/li><li>Code.<\/li><li>Results.<\/li><\/ul>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1. DMA Configuration for Memory to Memory transfer:<\/h2>\n\n\n\n<p><\/p>\n\n\n\n<p>The DMA can be triggered to transfer data without a request from a peripheral as following:<\/p>\n\n\n\n<p>Within main.c, declare a function that will enable clock access to DMA1:<\/p>\n\n\n\n<p>From the datasheet, we can find that DMA1 is connected to AHB bus, hence we can enable clock access to DMA1 as following (STM32F103C8T6 has only single DMA):<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"416\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/03\/Screenshot-2023-03-31-at-8.22.22-AM-1024x416.png\" alt=\"\" class=\"wp-image-1667\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/03\/Screenshot-2023-03-31-at-8.22.22-AM-1024x416.png 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/03\/Screenshot-2023-03-31-at-8.22.22-AM-300x122.png 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/03\/Screenshot-2023-03-31-at-8.22.22-AM-768x312.png 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/03\/Screenshot-2023-03-31-at-8.22.22-AM-1536x623.png 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/03\/Screenshot-2023-03-31-at-8.22.22-AM-1150x467.png 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/03\/Screenshot-2023-03-31-at-8.22.22-AM-750x304.png 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/03\/Screenshot-2023-03-31-at-8.22.22-AM-400x162.png 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/03\/Screenshot-2023-03-31-at-8.22.22-AM-250x101.png 250w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/03\/Screenshot-2023-03-31-at-8.22.22-AM.png 1804w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-csrc&quot;,&quot;theme&quot;:&quot;dracula&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;C&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;c&quot;}\">void DMA1_CLK_Enable()\n{\n\tRCC-&gt;AHBENR|=RCC_AHBENR_DMA1EN;\n}<\/pre><\/div>\n\n\n\n<p>declare a volatile variable to be used as flag:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-csrc&quot;,&quot;theme&quot;:&quot;dracula&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;C&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;c&quot;}\">volatile uint8_t done;<\/pre><\/div>\n\n\n\n<p>Declare two array to to hold the send and received data:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-csrc&quot;,&quot;theme&quot;:&quot;dracula&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;C&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;c&quot;}\">uint32_t data_send[5];\nuint32_t data_rece[5];<\/pre><\/div>\n\n\n\n<p>Now, we need to configure the DMA as following:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"361\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/03\/Screenshot-2023-03-31-at-8.27.48-AM-1024x361.png\" alt=\"\" class=\"wp-image-1668\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/03\/Screenshot-2023-03-31-at-8.27.48-AM-1024x361.png 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/03\/Screenshot-2023-03-31-at-8.27.48-AM-300x106.png 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/03\/Screenshot-2023-03-31-at-8.27.48-AM-768x271.png 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/03\/Screenshot-2023-03-31-at-8.27.48-AM-1536x541.png 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/03\/Screenshot-2023-03-31-at-8.27.48-AM-1150x405.png 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/03\/Screenshot-2023-03-31-at-8.27.48-AM-750x264.png 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/03\/Screenshot-2023-03-31-at-8.27.48-AM-400x141.png 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/03\/Screenshot-2023-03-31-at-8.27.48-AM-250x88.png 250w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/03\/Screenshot-2023-03-31-at-8.27.48-AM.png 1970w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>M2M Mode.<\/li><li>Peripheral and Memory size to word (32-bit).<\/li><li>Memory and peripheral increment.<\/li><li>Transfer complete interrupt.<\/li><\/ul>\n\n\n\n<p>Note: Circular mode in not valid in this configuration.<\/p>\n\n\n\n<p>Declare a function that will transfer between two memory location using DMA as following:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-csrc&quot;,&quot;theme&quot;:&quot;dracula&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;C&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;c&quot;}\">void DMA1_M2M_Transfer(uint32_t *src, uint32_t *dest, uint16_t len)<\/pre><\/div>\n\n\n\n<p>The function takes three parameters:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Source array.<\/li><li>Destination array.<\/li><li>Length of the array.<\/li><\/ul>\n\n\n\n<p>Within thins function put the DMA configuration:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-csrc&quot;,&quot;theme&quot;:&quot;dracula&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;C&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;c&quot;}\">\tDMA1_Channel1-&gt;CCR|=DMA_CCR_MEM2MEM|DMA_CCR_MINC|DMA_CCR_PINC|DMA_CCR_TCIE\n\t\t\t|DMA_CCR_MSIZE|DMA_CCR_PSIZE;<\/pre><\/div>\n\n\n\n<p>Enable the DMA1_Channle1 interrupt in NVIC:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-csrc&quot;,&quot;theme&quot;:&quot;dracula&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;C&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;c&quot;}\">NVIC_EnableIRQ(DMA1_Channel1_IRQn);<\/pre><\/div>\n\n\n\n<p>Set the peripheral address to be the source:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-csrc&quot;,&quot;theme&quot;:&quot;dracula&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;C&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;c&quot;}\">DMA1_Channel1-&gt;CPAR= (uint32_t) src;<\/pre><\/div>\n\n\n\n<p>Memory address to be the destination:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-csrc&quot;,&quot;theme&quot;:&quot;dracula&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;C&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;c&quot;}\">DMA1_Channel1-&gt;CMAR= (uint32_t)dest;<\/pre><\/div>\n\n\n\n<p>Set number of transfer to be the required length:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-csrc&quot;,&quot;theme&quot;:&quot;dracula&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;C&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;c&quot;}\">DMA1_Channel1-&gt;CNDTR = len;<\/pre><\/div>\n\n\n\n<p>Finally launch the DMA:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-csrc&quot;,&quot;theme&quot;:&quot;dracula&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;C&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;c&quot;}\">DMA1_Channel1-&gt;CCR|=DMA_CCR_EN;<\/pre><\/div>\n\n\n\n<p>For the interrupt handler:<\/p>\n\n\n\n<p>Check if the source is interrupt transfer complete:<\/p>\n\n\n\n<p>If it is, set done to 1, clear the flag and disable the DMA.<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-csrc&quot;,&quot;theme&quot;:&quot;dracula&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;C&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;c&quot;}\">void DMA1_Channel1_IRQHandler (void)\n{\n\tif((DMA1-&gt;ISR &amp; DMA_ISR_TCIF1)==DMA_ISR_TCIF1)\n\t{\n\t\tdone=1;\n\t\tDMA1-&gt;IFCR=DMA_IFCR_CTCIF1;\n\t\tDMA1_Channel1-&gt;CCR&amp;=~DMA_CCR_EN;\n\t}\n\n}<\/pre><\/div>\n\n\n\n<p>Hence, the entire code as following:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-csrc&quot;,&quot;theme&quot;:&quot;dracula&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;C&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;c&quot;}\">#include &quot;stm32f1xx.h&quot;\n#include &quot;stdlib.h&quot;\n\nuint32_t data_send[5];\nuint32_t data_rece[5];\n\n\nvolatile uint8_t done;\n\n\nvoid DMA1_CLK_Enable()\n{\n\tRCC-&gt;AHBENR|=RCC_AHBENR_DMA1EN;\n}\n\n\nvoid DMA1_M2M_Transfer(uint32_t *src, uint32_t *dest, uint16_t len)\n{\n\n\tDMA1_Channel1-&gt;CCR|=DMA_CCR_MEM2MEM|DMA_CCR_MINC|DMA_CCR_PINC|DMA_CCR_TCIE\n\t\t\t|DMA_CCR_MSIZE|DMA_CCR_PSIZE;\n\n\tNVIC_EnableIRQ(DMA1_Channel1_IRQn);\n\n\tDMA1_Channel1-&gt;CPAR= (uint32_t) src;\n\n\tDMA1_Channel1-&gt;CMAR= (uint32_t)dest;\n\n\tDMA1_Channel1-&gt;CNDTR = len;\n\n\tDMA1_Channel1-&gt;CCR|=DMA_CCR_EN;\n\n\n}\n\n\n\nint main(void)\n{\n\tDMA1_CLK_Enable();\n\n\twhile(1)\n\t{\n\n\t\tfor(int i=0;i&lt;5;i++)\n\t\t{\n\t\t\tdata_send[i]=random()%256;\n\t\t}\n\n\t\tDMA1_M2M_Transfer(data_send,data_rece,5);\n\n\t\twhile(done==0);\n\t\tdone=0;\n\n\t\tfor (int i=0;i&lt;10000;i++);\n\t}\n}\n\nvoid DMA1_Channel1_IRQHandler (void)\n{\n\tif((DMA1-&gt;ISR &amp; DMA_ISR_TCIF1)==DMA_ISR_TCIF1)\n\t{\n\t\tdone=1;\n\t\tDMA1-&gt;IFCR=DMA_IFCR_CTCIF1;\n\t\tDMA1_Channel1-&gt;CCR&amp;=~DMA_CCR_EN;\n\t}\n\n}\n<\/pre><\/div>\n\n\n\n<p>For testing purposes, we shall fill the 5 elements of the array with random values from 0 to 255 as following:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;showPanel&quot;:true,&quot;languageLabel&quot;:&quot;language&quot;,&quot;fullScreenButton&quot;:true,&quot;copyButton&quot;:true,&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-csrc&quot;,&quot;theme&quot;:&quot;dracula&quot;,&quot;lineNumbers&quot;:false,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;fileName&quot;:&quot;&quot;,&quot;language&quot;:&quot;C&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;c&quot;}\">\t\tfor(int i=0;i&lt;5;i++)\n\t\t{\n\t\t\tdata_send[i]=random()%256;\n\t\t}<\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">2. Code:<\/h2>\n\n\n\n<p>You may download the code from here:<\/p>\n\n\n\n<div class=\"wp-block-file\"><a href=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/03\/DMA_M2M.zip\">DMA_M2M<\/a><a href=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2023\/03\/DMA_M2M.zip\" class=\"wp-block-file__button\" download>Download<\/a><\/div>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">3. Results:<\/h2>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"Memory to Memory transfer using DMA on STM32F103\" width=\"1170\" height=\"658\" src=\"https:\/\/www.youtube.com\/embed\/SVuGjBVm-As?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>Happy coding \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this guide, we shall configure the DMA to transfer data from one memory location to another. This can save tone of CPU cycles compare to using traditional memcpy where it uses cpu rather than DMA. In this guide, we shall cover the following: DMA configuration for memory to memory transfer. Code. Results. 1. DMA [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,11,12],"tags":[],"class_list":["post-1665","post","type-post","status-publish","format-standard","hentry","category-embedded-systems","category-peripheral-drivers","category-stm32"],"_links":{"self":[{"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/posts\/1665"}],"collection":[{"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1665"}],"version-history":[{"count":1,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/posts\/1665\/revisions"}],"predecessor-version":[{"id":1670,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/posts\/1665\/revisions\/1670"}],"wp:attachment":[{"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1665"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1665"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1665"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}