{"id":972,"date":"2022-05-28T15:00:01","date_gmt":"2022-05-28T15:00:01","guid":{"rendered":"https:\/\/blog.embeddedexpert.io\/?p=972"},"modified":"2022-05-28T15:00:04","modified_gmt":"2022-05-28T15:00:04","slug":"working-with-stm32f7-and-adc-part-4-timer-triggered-adc-with-dma","status":"publish","type":"post","link":"https:\/\/blog.embeddedexpert.io\/?p=972","title":{"rendered":"Working with STM32F7 and ADC part 4: Timer triggered ADC with DMA."},"content":{"rendered":"\n<p><\/p>\n\n\n\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_-1-1024x323.png\" alt=\"\" class=\"wp-image-225\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2021\/07\/1200px-ADC_Symbol.svg_-1-1024x323.png 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2021\/07\/1200px-ADC_Symbol.svg_-1-300x95.png 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2021\/07\/1200px-ADC_Symbol.svg_-1-768x243.png 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2021\/07\/1200px-ADC_Symbol.svg_-1-1150x363.png 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2021\/07\/1200px-ADC_Symbol.svg_-1-750x237.png 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2021\/07\/1200px-ADC_Symbol.svg_-1-400x126.png 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2021\/07\/1200px-ADC_Symbol.svg_-1-250x79.png 250w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2021\/07\/1200px-ADC_Symbol.svg_-1.png 1200w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n\n<p>In the previous guide (<a rel=\"noreferrer noopener\" href=\"https:\/\/blog.embeddedexpert.io\/?p=949\" data-type=\"URL\" data-id=\"https:\/\/blog.embeddedexpert.io\/?p=949\" target=\"_blank\">here<\/a>), we took a look how to configure the ADC to use DMA with multiple channel. In this guide, we shall use timer to trigger the ADC each 2 second and display the result on serial terminal.<\/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>ADC Configuration.<\/li><li>Timer Configuration.<\/li><li>DMA Configuration.<\/li><li>Code.<\/li><li>Demo.<\/li><\/ul>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1. ADC configuration:<\/h2>\n\n\n\n<p>The ADC configuration is similar to the ADC in DMA. However, the Continuous mode shall be disabled. Hence, the configuration is similar to the previous guide 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\/*Enable clock access to GPIOA and GPIOC*\/\n\tRCC-&gt;AHB1ENR|=RCC_AHB1ENR_GPIOAEN|RCC_AHB1ENR_GPIOCEN;\n\t\/*Configure the pins in ADC mode*\/\n\tGPIOA-&gt;MODER|=GPIO_MODER_MODER3;\n\tGPIOC-&gt;MODER|=GPIO_MODER_MODER0;\n\n\t\/*Enable clock access to ADC1*\/\n\tRCC-&gt;APB2ENR|=RCC_APB2ENR_ADC1EN;\n\t\/*Enable scan mode*\/\n\tADC1-&gt;CR1|=ADC_CR1_SCAN;\n\t\/*Enable continuous\/ DMA and DDS*\/\n\tADC1-&gt;CR2|=ADC_CR2_DDS|ADC_CR2_DMA;\n\t\/*Set length to 2 channels*\/\n\tADC1-&gt;SQR1|=(1&lt;&lt;20);\n\t\/*Set ch3 first first and ch10 second in the conversion sequence*\/\n\tADC1-&gt;SQR3|=(3&lt;&lt;0)|(10&lt;&lt;5);<\/pre><\/div>\n\n\n\n<p>Note that the continuous mode is disable since the timer shall trigger the ADC conversion not the internal clock of the ADC.<\/p>\n\n\n\n<p>For timer trigger ADC, we shall set the trigger to be rising edge and the source as TIM2 TRGO:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"330\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/05\/Screen-Shot-2022-05-28-at-5.43.15-PM-1024x330.png\" alt=\"\" class=\"wp-image-973\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/05\/Screen-Shot-2022-05-28-at-5.43.15-PM-1024x330.png 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/05\/Screen-Shot-2022-05-28-at-5.43.15-PM-300x97.png 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/05\/Screen-Shot-2022-05-28-at-5.43.15-PM-768x247.png 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/05\/Screen-Shot-2022-05-28-at-5.43.15-PM-1536x494.png 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/05\/Screen-Shot-2022-05-28-at-5.43.15-PM-2048x659.png 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/05\/Screen-Shot-2022-05-28-at-5.43.15-PM-1150x370.png 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/05\/Screen-Shot-2022-05-28-at-5.43.15-PM-750x241.png 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/05\/Screen-Shot-2022-05-28-at-5.43.15-PM-400x129.png 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/05\/Screen-Shot-2022-05-28-at-5.43.15-PM-250x80.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;}\">\/*Select TIMER2_CH2 as trigger source*\/\n\tADC1-&gt;CR2\t\t\t|=ADC_CR2_EXTEN_0;\n\tADC1-&gt;CR2\t\t\t|=ADC_CR2_EXTSEL_3|ADC_CR2_EXTSEL_1|ADC_CR2_EXTSEL_0;<\/pre><\/div>\n\n\n\n<p>Note: Don&#8217;t enable the ADC (ADON) yet.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">2. Timer Configuration:<\/h2>\n\n\n\n<p>Since the timer used is Time2, we need to enable clock access to timer2 and set prescaler to 16000-1 and ARR value to 2000-1. Hence those value shall give trigger each second:<\/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\/*Configure the timer*\/\n\tRCC-&gt;APB1ENR\t\t|=RCC_APB1ENR_TIM2EN;\n\tTIM2-&gt;PSC\t\t\t =16000-1;\n\tTIM2-&gt;ARR\t\t\t =2000-1;<\/pre><\/div>\n\n\n\n<p>Now, we shall set the Master mode selection to Update &#8211; The update event is selected as trigger output (TRGO):<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"316\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/05\/Screen-Shot-2022-05-28-at-5.50.31-PM-1024x316.png\" alt=\"\" class=\"wp-image-974\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/05\/Screen-Shot-2022-05-28-at-5.50.31-PM-1024x316.png 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/05\/Screen-Shot-2022-05-28-at-5.50.31-PM-300x93.png 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/05\/Screen-Shot-2022-05-28-at-5.50.31-PM-768x237.png 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/05\/Screen-Shot-2022-05-28-at-5.50.31-PM-1536x474.png 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/05\/Screen-Shot-2022-05-28-at-5.50.31-PM-2048x633.png 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/05\/Screen-Shot-2022-05-28-at-5.50.31-PM-1150x355.png 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/05\/Screen-Shot-2022-05-28-at-5.50.31-PM-750x232.png 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/05\/Screen-Shot-2022-05-28-at-5.50.31-PM-400x124.png 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/05\/Screen-Shot-2022-05-28-at-5.50.31-PM-250x77.png 250w\" 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;}\">\tTIM2-&gt;CR2\t\t\t|=TIM_CR2_MMS_1;<\/pre><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">3. DMA configuration:<\/h2>\n\n\n\n<p>The DMA configuration is similar to part 3 except that there will be interrupt when transfer is completed.<\/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;}\">\/*Enable clock access to DMA2*\/\n\tRCC-&gt;AHB1ENR|=RCC_AHB1ENR_DMA2EN;\n\t\/*Disable the strsam*\/\n\tDMA2_Stream0-&gt;CR&amp;=~DMA_SxCR_EN;\n\t\/*Wait until the stream is disabled *\/\n\twhile(DMA_SxCR_EN==(DMA2_Stream0-&gt;CR&amp;DMA_SxCR_EN));\n\t\/*Set memory size to half-word*\/\n\tDMA2_Stream0-&gt;CR|=DMA_SxCR_MSIZE_0;\n\t\/*Set peripheral size to half word*\/\n\tDMA2_Stream0-&gt;CR|=DMA_SxCR_PSIZE_0;\n\t\/*Enable memory increment*\/\n\tDMA2_Stream0-&gt;CR|=DMA_SxCR_MINC;\n\t\/*Enable circular mode*\/\n\tDMA2_Stream0-&gt;CR|=DMA_SxCR_CIRC;\n\t\/*Enable Transfer complete interrupt*\/\n\tDMA2_Stream0-&gt;CR|=DMA_SxCR_TCIE;\n\tNVIC_EnableIRQ(DMA2_Stream0_IRQn);\n\t\/*Set number of transfer to 2*\/\n\tDMA2_Stream0-&gt;NDTR=2;\n\t\/*Set peripheral address to ADC1-&gt;DR*\/\n\tDMA2_Stream0-&gt;PAR=(uint32_t)&amp;(ADC1-&gt;DR);\n\t\/*Set memory address to adc_data*\/\n\tDMA2_Stream0-&gt;M0AR=(uint32_t)&amp;(adc_data);<\/pre><\/div>\n\n\n\n<p>Finally, enable DMA stream, ADC and timer in this order:<\/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;}\">\/*Enable the DMA stream*\/\n\tDMA2_Stream0-&gt;CR|=DMA_SxCR_EN;\n\t\/*Enable the ADC*\/\n\tADC1-&gt;CR2|=ADC_CR2_ADON;\n\t\/*Start the timer *\/\n\tTIM2-&gt;CR1\t\t\t|=TIM_CR1_CEN;<\/pre><\/div>\n\n\n\n<p>For interrupt handler:<\/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;}\">\nvoid DMA2_Stream0_IRQHandler(void)\n\t\t{\n\n\t\tif(((DMA2-&gt;LISR)&amp;DMA_LISR_TCIF0))\n\t\t\t\t{\n\t\t\t\tfinished=1;\n\t\t\t\tGPIOB-&gt;ODR^=GPIO_ODR_OD7;\n\t\t\t\tDMA2-&gt;LIFCR=DMA_LIFCR_CTCIF0;\n\t\t\t\t}\n\t\tNVIC_ClearPendingIRQ(DMA2_Stream0_IRQn);\n\t\t}\n<\/pre><\/div>\n\n\n\n<p>For main.c :<\/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;stm32f7xx.h&quot;\n#include &quot;uart.h&quot;\n#include &quot;stdlib.h&quot;\n#include &quot;adc_dma.h&quot;\nuint16_t data[2];\n\nvolatile int finished;\nint main()\n\t{\n\t SCB-&gt;CPACR |= ((3UL &lt;&lt; 10*2)|(3UL &lt;&lt; 11*2));\n\t RCC-&gt;AHB1ENR|=RCC_AHB1ENR_GPIOBEN;\n\tGPIOB-&gt;MODER|=GPIO_MODER_MODER7_0;\n\tGPIOB-&gt;MODER&amp;=~GPIO_MODER_MODER7_1;\n\tSCB_EnableDCache();\n\tSCB_EnableICache();\n\tuart3_tx_init();\n\tprintf(&quot;uart is ready\\r\\n&quot;);\n\tadc_dma_2ch_timer_init();\n\twhile(1)\n\t\t{\n\t\t\tif(finished==1)\n\t\t\t\t{\n\t\t\t\t\tfinished=0;\n\t\t\t\t\tdata[0]=ReadChannel(A0);\n\t\t\t\t\tdata[1]=ReadChannel(A1);\n\t\t\t\t\tprintf(&quot;ADC values A0=%d, A1=%d\\r\\n&quot;,data[0],data[1]);\n\n\t\t\t\t}\n\t\t}\n\n\t}\n\nvoid DMA2_Stream0_IRQHandler(void)\n\t\t{\n\n\t\tif(((DMA2-&gt;LISR)&amp;DMA_LISR_TCIF0))\n\t\t\t\t{\n\t\t\t\tfinished=1;\n\t\t\t\tGPIOB-&gt;ODR^=GPIO_ODR_OD7;\n\t\t\t\tDMA2-&gt;LIFCR=DMA_LIFCR_CTCIF0;\n\t\t\t\t}\n\t\tNVIC_ClearPendingIRQ(DMA2_Stream0_IRQn);\n\t\t}\n<\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">4. Code:<\/h2>\n\n\n\n<p>You may the download the source code from here:<\/p>\n\n\n\n<div class=\"wp-block-file\"><a href=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/05\/ADC_DMA_Timer.zip\">ADC_DMA_Timer<\/a><a href=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/05\/ADC_DMA_Timer.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\">5. Results:<\/h2>\n\n\n\n<p>After compiling and upload the code, open serial terminal application and set the baudrate to 115200<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"515\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/05\/Screen-Shot-2022-05-28-at-5.54.52-PM-1024x515.png\" alt=\"\" class=\"wp-image-976\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/05\/Screen-Shot-2022-05-28-at-5.54.52-PM-1024x515.png 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/05\/Screen-Shot-2022-05-28-at-5.54.52-PM-300x151.png 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/05\/Screen-Shot-2022-05-28-at-5.54.52-PM-768x386.png 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/05\/Screen-Shot-2022-05-28-at-5.54.52-PM-1150x578.png 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/05\/Screen-Shot-2022-05-28-at-5.54.52-PM-750x377.png 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/05\/Screen-Shot-2022-05-28-at-5.54.52-PM-400x201.png 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/05\/Screen-Shot-2022-05-28-at-5.54.52-PM-250x126.png 250w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2022\/05\/Screen-Shot-2022-05-28-at-5.54.52-PM.png 1320w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>The values shall be update each 2 seconds<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>Happy coding \ud83d\ude42 <\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the previous guide (here), we took a look how to configure the ADC to use DMA with multiple channel. In this guide, we shall use timer to trigger the ADC each 2 second and display the result on serial terminal. In this guide, we shall cover the following: ADC Configuration. Timer Configuration. DMA Configuration. [&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-972","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\/972"}],"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=972"}],"version-history":[{"count":1,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/posts\/972\/revisions"}],"predecessor-version":[{"id":977,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/posts\/972\/revisions\/977"}],"wp:attachment":[{"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=972"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=972"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=972"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}