{"id":1152,"date":"2022-08-17T04:47:46","date_gmt":"2022-08-17T04:47:46","guid":{"rendered":"https:\/\/blog.embeddedexpert.io\/?p=1152"},"modified":"2022-08-17T04:47:49","modified_gmt":"2022-08-17T04:47:49","slug":"getting-started-with-stm32l053-adc-multi-channel-continuous-conversion-with-dma","status":"publish","type":"post","link":"https:\/\/blog.embeddedexpert.io\/?p=1152","title":{"rendered":"Getting started with STM32L053: ADC Multi Channel Continuous Conversion with DMA"},"content":{"rendered":"\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"323\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2021\/07\/1200px-ADC_Symbol.svg_-1024x323.png\" alt=\"\" class=\"wp-image-202\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2021\/07\/1200px-ADC_Symbol.svg_-1024x323.png 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2021\/07\/1200px-ADC_Symbol.svg_-300x95.png 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2021\/07\/1200px-ADC_Symbol.svg_-768x243.png 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2021\/07\/1200px-ADC_Symbol.svg_-1150x363.png 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2021\/07\/1200px-ADC_Symbol.svg_-750x237.png 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2021\/07\/1200px-ADC_Symbol.svg_-400x126.png 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2021\/07\/1200px-ADC_Symbol.svg_-250x79.png 250w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2021\/07\/1200px-ADC_Symbol.svg_.png 1200w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n\n<p><\/p>\n\n\n\n<p>In the previous guide (<a rel=\"noreferrer noopener\" href=\"https:\/\/blog.embeddedexpert.io\/?p=947\" data-type=\"URL\" data-id=\"https:\/\/blog.embeddedexpert.io\/?p=947\" target=\"_blank\">here<\/a>), we took a look at the continuous mode for ADC module of STM32L0. In this guide, we shall see how to configure the ADC to work in DMA mode with two channels enabled. (Can be expanded to the desired number of channels).<\/p>\n\n\n\n<p><\/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>What is DMA<\/li><li>Why should we use DMA when dealing with multiple channel in ADC<\/li><li>Configuring the ADC and DMA<\/li><li>Required parts and schematics<\/li><li>Code<\/li><li>Result<\/li><\/ul>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1. What is DMA<\/h2>\n\n\n\n<p>DMA which stands for Direct Memory Access is part of MCU that handle data transfer from peripheral to memory without invoking CPU at all which relief cpu to do something else, like processing the acquired adc vlaue for dsp processing etc<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2021\/08\/d5573030-464f-4801-8de7-75c126d7f9a2-1024x576.jpeg\" alt=\"\" class=\"wp-image-321\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2021\/08\/d5573030-464f-4801-8de7-75c126d7f9a2-1024x576.jpeg 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2021\/08\/d5573030-464f-4801-8de7-75c126d7f9a2-300x169.jpeg 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2021\/08\/d5573030-464f-4801-8de7-75c126d7f9a2-768x432.jpeg 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2021\/08\/d5573030-464f-4801-8de7-75c126d7f9a2-1536x864.jpeg 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2021\/08\/d5573030-464f-4801-8de7-75c126d7f9a2-1150x647.jpeg 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2021\/08\/d5573030-464f-4801-8de7-75c126d7f9a2-750x422.jpeg 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2021\/08\/d5573030-464f-4801-8de7-75c126d7f9a2-400x225.jpeg 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2021\/08\/d5573030-464f-4801-8de7-75c126d7f9a2-250x141.jpeg 250w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2021\/08\/d5573030-464f-4801-8de7-75c126d7f9a2.jpeg 1920w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption>DMA (From digikey)<\/figcaption><\/figure><\/div>\n\n\n\n<p>DMA can be operate in three different mode, Memory to Memory (moving one variable from one location to another), memory to peripheral (send string from memory to PC through UART) and peripheral to memory like in our case acquiring data from adc.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">2. Why should we use DMA when dealing with multiple channel in ADC<\/h2>\n\n\n\n<p>Let say you want ti acquire data from adc from 3-channel in continuous mode. Since each conversion requires 15 cycles for 12-bit since the adc clock is the core frequency over (16MHz\/2=8MHz), thats means generating interrupts at rate near half mega hertz which will effect the performance of the mcu. Hence, using DMA in such case makes sense.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">3. Configure the ADC and DMA:<\/h2>\n\n\n\n<p>Create aa new source file with name of adc.c<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>We start off by enabling clock access to GPIOA and set PA0 and PA1 to analog mode:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"646\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.17.16-AM-1024x646.png\" alt=\"\" class=\"wp-image-1154\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.17.16-AM-1024x646.png 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.17.16-AM-300x189.png 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.17.16-AM-768x484.png 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.17.16-AM-1536x968.png 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.17.16-AM-2048x1291.png 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.17.16-AM-1150x725.png 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.17.16-AM-750x473.png 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.17.16-AM-400x252.png 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.17.16-AM-250x158.png 250w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\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\/*Enable clock access to GPIOA*\/\n\tRCC-&gt;IOPENR |=RCC_IOPENR_IOPAEN;\n\n\t\/*Set pa4 mode to analog mode*\/\n\tGPIOA-&gt;MODER |=GPIO_MODER_MODE0|GPIO_MODER_MODE1;<\/pre><\/div>\n\n\n\n<p>Enable clock access to ADC1:<\/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\/*Enable clock access to ADC*\/\n\tRCC-&gt;APB2ENR |= RCC_APB2ENR_ADC1EN;<\/pre><\/div>\n\n\n\n<p>Configure the operation to be continuous mode:<\/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;}\">    \/*Set Continuous conversion mode*\/\n\tADC1-&gt;CFGR1 |=ADC_CFGR1_CONT;<\/pre><\/div>\n\n\n\n<p>Select the operation channel to be channel 0 and channel 1:<\/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\/*Set sequencer channel*\/\n\tADC1-&gt;CHSELR |=ADC_CHSELR_CHSEL0|ADC_CHSELR_CHSEL1;<\/pre><\/div>\n\n\n\n<p>Set clock to be CLK\/2:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"464\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.19.48-AM-1024x464.png\" alt=\"\" class=\"wp-image-1155\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.19.48-AM-1024x464.png 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.19.48-AM-300x136.png 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.19.48-AM-768x348.png 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.19.48-AM-1536x696.png 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.19.48-AM-2048x928.png 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.19.48-AM-1150x521.png 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.19.48-AM-750x340.png 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.19.48-AM-400x181.png 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.19.48-AM-250x113.png 250w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\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\/*Set clock to be CLCK\/2*\/\n\n\tADC1-&gt;CFGR2|=ADC_CFGR2_CKMODE_0;<\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<p>Now, enable DMA for ADC:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"334\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.23.19-AM-1024x334.png\" alt=\"\" class=\"wp-image-1156\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.23.19-AM-1024x334.png 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.23.19-AM-300x98.png 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.23.19-AM-768x250.png 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.23.19-AM-1536x501.png 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.23.19-AM-2048x668.png 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.23.19-AM-1150x375.png 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.23.19-AM-750x244.png 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.23.19-AM-400x130.png 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.23.19-AM-250x81.png 250w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\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\/*Enable ADC DMA*\/\n\tADC1-&gt;CFGR1|=ADC_CFGR1_DMAEN;<\/pre><\/div>\n\n\n\n<p>Since STM32L053 has only single DMA and it is connected to AHB Bus, we can enable clock access to DMA1 as following:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"642\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.26.00-AM-1024x642.png\" alt=\"\" class=\"wp-image-1157\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.26.00-AM-1024x642.png 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.26.00-AM-300x188.png 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.26.00-AM-768x482.png 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.26.00-AM-1536x963.png 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.26.00-AM-2048x1284.png 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.26.00-AM-1150x721.png 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.26.00-AM-750x470.png 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.26.00-AM-400x251.png 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.26.00-AM-250x157.png 250w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"642\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.26.00-AM-1-1024x642.png\" alt=\"\" class=\"wp-image-1158\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.26.00-AM-1-1024x642.png 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.26.00-AM-1-300x188.png 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.26.00-AM-1-768x482.png 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.26.00-AM-1-1536x963.png 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.26.00-AM-1-2048x1284.png 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.26.00-AM-1-1150x721.png 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.26.00-AM-1-750x470.png 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.26.00-AM-1-400x251.png 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.26.00-AM-1-250x157.png 250w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\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;}\">RCC-&gt;AHBENR|=RCC_AHBENR_DMA1EN;<\/pre><\/div>\n\n\n\n<p>From table below which represents the DMA request channels, we can see that DMA1_Channel1 and channel2 can be used with the ADC. Hence, we shall use channel1.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"378\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.29.14-AM-1024x378.png\" alt=\"\" class=\"wp-image-1159\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.29.14-AM-1024x378.png 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.29.14-AM-300x111.png 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.29.14-AM-768x283.png 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.29.14-AM-1536x567.png 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.29.14-AM-2048x756.png 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.29.14-AM-1150x424.png 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.29.14-AM-750x277.png 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.29.14-AM-400x148.png 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.29.14-AM-250x92.png 250w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Now, we shall configure the DMA:<\/p>\n\n\n\n<p>The configuration as following:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Memory size to 16-bit.<\/li><li>Peripheral size to 16-bit.<\/li><li>Memory Increment.<\/li><li>Circular Mode<\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"499\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.31.01-AM-1024x499.png\" alt=\"\" class=\"wp-image-1160\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.31.01-AM-1024x499.png 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.31.01-AM-300x146.png 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.31.01-AM-768x374.png 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.31.01-AM-1536x748.png 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.31.01-AM-2048x997.png 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.31.01-AM-1150x560.png 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.31.01-AM-750x365.png 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.31.01-AM-400x195.png 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.31.01-AM-250x122.png 250w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\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_MSIZE_0|DMA_CCR_PSIZE_0|DMA_CCR_MINC|DMA_CCR_CIRC;<\/pre><\/div>\n\n\n\n<p>We shall set number of transfer as the size of the array:<\/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=sizeof(adc_dma_data)\/sizeof(adc_dma_data[0]);<\/pre><\/div>\n\n\n\n<p>Set the peripheral address to be ADC1-&gt;DR and memory address to the array:<\/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;CPAR= (uint32_t)(&amp;ADC1-&gt;DR);\n\tDMA1_Channel1-&gt;CMAR=(uint32_t)(&amp;adc_dma_data);<\/pre><\/div>\n\n\n\n<p>Finally enable 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>Configure the ADC_DMA in circular mode:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"384\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.37.59-AM-1024x384.png\" alt=\"\" class=\"wp-image-1161\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.37.59-AM-1024x384.png 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.37.59-AM-300x112.png 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.37.59-AM-768x288.png 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.37.59-AM-1536x575.png 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.37.59-AM-2048x767.png 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.37.59-AM-1150x431.png 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.37.59-AM-750x281.png 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.37.59-AM-400x150.png 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.37.59-AM-250x94.png 250w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\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;}\">ADC1-&gt;CFGR1|=ADC_CFGR1_DMACFG;<\/pre><\/div>\n\n\n\n<p>Launch ADC calibration:<\/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;}\">\tADC1-&gt;CR |= ADC_CR_ADCAL;\n\twhile(ADC1-&gt;CR &amp; ADC_CR_ADCAL);<\/pre><\/div>\n\n\n\n<p>Enable the ADC:<\/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;}\">ADC1-&gt;CR |= ADC_CR_ADEN;<\/pre><\/div>\n\n\n\n<p>Start the conversion:<\/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;}\">ADC1-&gt;CR |= ADC_CR_ADSTART;<\/pre><\/div>\n\n\n\n<p>For getting the adc 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;}\">uint16_t get_adc_value (adc_Channel channel)\n\t{\n\treturn adc_dma_data[channel];\n\n\t}<\/pre><\/div>\n\n\n\n<p>For the header file of adc.h:<\/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;}\">#ifndef ADC_H_\n#define ADC_H_\n\ntypedef enum {\nChannel0=0,\nChannel1\n}adc_Channel;\n\n#include &lt;stdint.h&gt;\n\nvoid adc_dma_init(void);\n\n\nuint16_t get_adc_value (adc_Channel channel);\n\n#endif \/* ADC_H_ *\/\n<\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<p>In main.c file:<\/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;uart.h&quot;\n#include &quot;adc.h&quot;\n#include &quot;stdio.h&quot;\n\nint main(void)\n{\n\tadc_dma_init();\n\tuart_init();\n\n\twhile(1)\n\t{\n\n\n\t\tprintf(&quot;Channel 0=%d\\t Channel 1=%d\\r\\n&quot;,get_adc_value(Channel0),get_adc_value(Channel1));\n\t\tfor (int i=0;i&lt;1000;i++);\n\n\n\t}\n\n}\n<\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">4. Connection:<\/h2>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"879\" height=\"1024\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2021\/08\/Screen-Shot-2021-08-12-at-8.53.29-AM-879x1024.png\" alt=\"\" class=\"wp-image-324\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2021\/08\/Screen-Shot-2021-08-12-at-8.53.29-AM-879x1024.png 879w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2021\/08\/Screen-Shot-2021-08-12-at-8.53.29-AM-257x300.png 257w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2021\/08\/Screen-Shot-2021-08-12-at-8.53.29-AM-768x895.png 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2021\/08\/Screen-Shot-2021-08-12-at-8.53.29-AM-1318x1536.png 1318w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2021\/08\/Screen-Shot-2021-08-12-at-8.53.29-AM-1150x1340.png 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2021\/08\/Screen-Shot-2021-08-12-at-8.53.29-AM-750x874.png 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2021\/08\/Screen-Shot-2021-08-12-at-8.53.29-AM-400x466.png 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2021\/08\/Screen-Shot-2021-08-12-at-8.53.29-AM-250x291.png 250w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2021\/08\/Screen-Shot-2021-08-12-at-8.53.29-AM.png 1526w\" sizes=\"(max-width: 879px) 100vw, 879px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">5. 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\/2022\/08\/ADC_UART.zip\">ADC_UART<\/a><a href=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/ADC_UART.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\">6. Results:<\/h2>\n\n\n\n<p>Open serial monitor program and set the baudrate to 9600 and rotate the pot. you should see the values changes<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"731\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.45.59-AM-1024x731.png\" alt=\"\" class=\"wp-image-1163\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.45.59-AM-1024x731.png 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.45.59-AM-300x214.png 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.45.59-AM-768x548.png 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.45.59-AM-1150x821.png 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.45.59-AM-750x535.png 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.45.59-AM-400x285.png 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.45.59-AM-250x178.png 250w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/08\/Screen-Shot-2022-08-17-at-7.45.59-AM.png 1166w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>Happy coding \ud83d\ude42<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the previous guide (here), we took a look at the continuous mode for ADC module of STM32L0. In this guide, we shall see how to configure the ADC to work in DMA mode with two channels enabled. (Can be expanded to the desired number of channels). In this guide, we shall cover the following: [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,2,11,12],"tags":[],"class_list":["post-1152","post","type-post","status-publish","format-standard","hentry","category-data-structures","category-embedded-systems","category-peripheral-drivers","category-stm32"],"_links":{"self":[{"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/posts\/1152"}],"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=1152"}],"version-history":[{"count":1,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/posts\/1152\/revisions"}],"predecessor-version":[{"id":1164,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/posts\/1152\/revisions\/1164"}],"wp:attachment":[{"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1152"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1152"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1152"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}