{"id":3460,"date":"2025-05-17T13:09:04","date_gmt":"2025-05-17T13:09:04","guid":{"rendered":"https:\/\/blog.embeddedexpert.io\/?p=3460"},"modified":"2025-05-17T13:21:21","modified_gmt":"2025-05-17T13:21:21","slug":"stm32-adc-application-part-3-read-multiple-channels-using-polling-mode","status":"publish","type":"post","link":"https:\/\/blog.embeddedexpert.io\/?p=3460","title":{"rendered":"STM32 ADC Application Part 3: Read Multiple Channels Using Polling 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\/2025\/05\/ChatGPT-Image-May-17-2025-at-03_41_34-PM-1024x683.png\" alt=\"\" class=\"wp-image-3461\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/ChatGPT-Image-May-17-2025-at-03_41_34-PM-1024x683.png 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/ChatGPT-Image-May-17-2025-at-03_41_34-PM-300x200.png 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/ChatGPT-Image-May-17-2025-at-03_41_34-PM-768x512.png 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/ChatGPT-Image-May-17-2025-at-03_41_34-PM-1150x767.png 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/ChatGPT-Image-May-17-2025-at-03_41_34-PM-750x500.png 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/ChatGPT-Image-May-17-2025-at-03_41_34-PM-400x267.png 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/ChatGPT-Image-May-17-2025-at-03_41_34-PM-250x167.png 250w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/ChatGPT-Image-May-17-2025-at-03_41_34-PM.png 1536w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>In this third part of the STM32 ADC series, we explore how to use discontinuous mode to read multiple ADC channels efficiently. This mode allows precise control over channel sampling by breaking a regular conversion sequence into smaller steps, each triggered manually or by events.<\/p>\n\n\n\n<p>In this guide, we shall cover the following:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Introduction to discontinuous mode and usage to read multiple channels.<\/li>\n\n\n\n<li>Firmware setup.<\/li>\n\n\n\n<li>Firmware Development.<\/li>\n\n\n\n<li>Connection.<\/li>\n\n\n\n<li>Results.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">1. Introduction to Discontinuous Mode and Usage to Read Multiple Channels:<\/h2>\n\n\n\n<p>The&nbsp;<strong>Analog-to-Digital Converter (ADC)<\/strong>&nbsp;on STM32 microcontrollers is highly flexible and capable of reading multiple analog inputs through its multiplexer and configurable conversion sequence. One powerful yet often underutilized feature is&nbsp;<strong>Discontinuous Mode<\/strong>, which provides fine-grained control over how and when multiple ADC channels are converted. This mode is particularly useful in scenarios where sampling all channels in one burst is undesirable due to timing constraints, power concerns, or the need for more deterministic control over sampling order and timing.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h4 class=\"wp-block-heading\">What is Discontinuous Mode?<\/h4>\n\n\n\n<p>In&nbsp;<strong>Regular Group conversion<\/strong>, ADC channels can be arranged into a sequence of conversions (called ranks), and the ADC can convert them either in one go (<strong>scan mode<\/strong>) or in segments.&nbsp;<strong>Discontinuous Mode<\/strong>&nbsp;allows this conversion sequence to be split into smaller chunks\u2014converting only one or a few channels per trigger event.<\/p>\n\n\n\n<p>Here&#8217;s how it works:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A conversion sequence is defined with multiple channels (e.g., Channel 0, 1, 2, 3).<\/li>\n\n\n\n<li>The\u00a0<strong>Scan Mode<\/strong>\u00a0must be\u00a0<strong>enabled<\/strong>, and the number of conversions (ranks) specified.<\/li>\n\n\n\n<li>When\u00a0<strong>Discontinuous Mode<\/strong>\u00a0is enabled with\u00a0<code>N<\/code>\u00a0discontinuous conversions, each trigger (software or external) will start only\u00a0<code>N<\/code>\u00a0conversions out of the full sequence.<\/li>\n\n\n\n<li>The next\u00a0<code>N<\/code>\u00a0conversions will occur with the next trigger, continuing until the full sequence is completed.<\/li>\n<\/ul>\n\n\n\n<p>If&nbsp;<code>N = 1<\/code>, then one channel from the sequence is converted per trigger.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h4 class=\"wp-block-heading\">Why Use Discontinuous Mode?<\/h4>\n\n\n\n<p>Using Discontinuous Mode has several advantages:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Precise Sampling Control<\/strong>: It allows sampling individual channels at distinct time intervals instead of sampling all at once. This can help align ADC sampling with real-world events or sensor timings.<\/li>\n\n\n\n<li><strong>Lower Instantaneous Power Draw<\/strong>: Converting one or two channels at a time reduces peak current demand from the analog front-end, which is useful in power-sensitive designs.<\/li>\n\n\n\n<li><strong>Efficient Resource Management<\/strong>: Discontinuous mode enables spreading out ADC conversions to avoid CPU or DMA bottlenecks when many peripherals are active simultaneously.<\/li>\n\n\n\n<li><strong>Ideal for Multiplexed Inputs<\/strong>: If analog inputs are shared via external analog switches or multiplexers, Discontinuous Mode allows switching the input between triggers without racing against the ADC sampling window.<\/li>\n\n\n\n<li><strong>Better Scheduling in RTOS<\/strong>: In FreeRTOS or similar environments, it integrates well into periodic tasks by converting only part of the sequence at a time per timer-based or task-based trigger.<\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<h4 class=\"wp-block-heading\">Practical Use Case: Reading Multiple ADC Channels<\/h4>\n\n\n\n<p>Suppose you want to read 3 analog sensors (e.g., temperature, battery voltage, and potentiometer). Instead of sampling all three in a single ADC conversion trigger (which could be power-hungry or conflict with other tasks), you can:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Enable\u00a0<strong>Scan Mode<\/strong>\u00a0and define the sequence with 3 ranks: Channel 0, 1, and 2.<\/li>\n\n\n\n<li>Enable\u00a0<strong>Discontinuous Mode<\/strong>\u00a0with\u00a0<code>Discontinuous Rank Count = 1<\/code>.<\/li>\n\n\n\n<li>Trigger the ADC (via software or timer) every few milliseconds.<\/li>\n<\/ul>\n\n\n\n<p>Each trigger will sequentially convert one channel in the sequence:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>First trigger: Channel 0<\/li>\n\n\n\n<li>Second trigger: Channel 1<\/li>\n\n\n\n<li>Third trigger: Channel 2<\/li>\n\n\n\n<li>Fourth trigger: Channel 0 again, and so on\u2026<\/li>\n<\/ol>\n\n\n\n<p>This behavior gives the system more breathing room between conversions, provides scheduling flexibility, and reduces overall power usage while maintaining synchronized acquisition across multiple channels.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Disadvantages of Using Polling Mode with Discontinuous ADC Mode<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Increased CPU Idle Time<\/strong><br>Since polling requires the CPU to continuously check the End of Conversion (EOC) flag, it leads to wasted processing time\u2014especially when waiting for each individual channel to convert in a discontinuous sequence.<\/li>\n\n\n\n<li><strong>Low Efficiency for Multi-Channel Systems<\/strong><br>In discontinuous mode, only a subset (often just one) of the channels is converted per trigger. If you&#8217;re using polling, the CPU must repeatedly handle multiple software triggers and corresponding wait loops, making the whole acquisition process inefficient.<\/li>\n\n\n\n<li><strong>High Power Consumption<\/strong><br>Because the CPU remains active during each polling cycle, it prevents the microcontroller from entering low-power sleep modes between conversions, which is particularly problematic in energy-sensitive applications.<\/li>\n\n\n\n<li><strong>Complex Timing Management<\/strong><br>When manually triggering each conversion step and waiting for completion, precise timing between channels becomes harder to manage. This could lead to jitter or inconsistent sampling intervals, especially without the help of timers or interrupts.<\/li>\n\n\n\n<li><strong>Poor Responsiveness and System Scalability<\/strong><br>Polling ties up the CPU, reducing its availability for other tasks like communication, real-time control, or UI updates. As more channels or peripherals are added to the system, the polling overhead scales poorly.<\/li>\n\n\n\n<li><strong>Risk of Missing Events or Data<\/strong><br>If the CPU is stuck waiting for ADC completion and a higher-priority event (like a UART interrupt or real-time input) occurs, that event could be delayed or missed, harming system responsiveness.<\/li>\n\n\n\n<li><strong>Cumbersome Software Design<\/strong><br>The control flow for polling each discontinuous step and channel requires more manual logic and careful sequencing, which complicates your firmware and makes debugging harder.<\/li>\n<\/ol>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">2. Firmware Setup:<\/h2>\n\n\n\n<p>From the setup of the previous guide from&nbsp;<a href=\"https:\/\/blog.embeddedexpert.io\/?p=3409\" target=\"_blank\" rel=\"noreferrer noopener\">here<\/a>.<\/p>\n\n\n\n<p>Open.ioc file and STM32CubeMX window shall appear.<\/p>\n\n\n\n<p>From left side menu, Analog and select ADC1 as following:<\/p>\n\n\n\n<p>Enable IN1, IN2 and IN4 as single ended input (Not all STM32 has this feature).<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"430\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-17_15-49-15-1024x430.jpg\" alt=\"\" class=\"wp-image-3462\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-17_15-49-15-1024x430.jpg 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-17_15-49-15-300x126.jpg 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-17_15-49-15-768x323.jpg 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-17_15-49-15-1536x645.jpg 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-17_15-49-15-2048x860.jpg 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-17_15-49-15-1150x483.jpg 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-17_15-49-15-750x315.jpg 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-17_15-49-15-400x168.jpg 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-17_15-49-15-250x105.jpg 250w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>This will translate to A0, A1 and A5 analog pins of Arduino in STM32F303RE Nucleo-64:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"534\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-17_15-54-46-1024x534.jpg\" alt=\"\" class=\"wp-image-3463\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-17_15-54-46-1024x534.jpg 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-17_15-54-46-300x156.jpg 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-17_15-54-46-768x400.jpg 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-17_15-54-46-1536x801.jpg 1536w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-17_15-54-46-2048x1068.jpg 2048w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-17_15-54-46-1150x600.jpg 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-17_15-54-46-750x391.jpg 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-17_15-54-46-400x209.jpg 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-17_15-54-46-250x130.jpg 250w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>Next, we shall configure the ADC as following:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>First, set Number of Conversion to 3, this will enable Scan Conversion Mode<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"892\" height=\"1024\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-17_15-58-58-892x1024.jpg\" alt=\"\" class=\"wp-image-3464\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-17_15-58-58-892x1024.jpg 892w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-17_15-58-58-261x300.jpg 261w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-17_15-58-58-768x881.jpg 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-17_15-58-58-750x861.jpg 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-17_15-58-58-400x459.jpg 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-17_15-58-58-250x287.jpg 250w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-17_15-58-58.jpg 1070w\" sizes=\"(max-width: 892px) 100vw, 892px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>Next, set the rand of the channels as following:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"589\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-17_16-02-46-1024x589.jpg\" alt=\"\" class=\"wp-image-3465\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-17_16-02-46-1024x589.jpg 1024w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-17_16-02-46-300x173.jpg 300w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-17_16-02-46-768x442.jpg 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-17_16-02-46-750x432.jpg 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-17_16-02-46-400x230.jpg 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-17_16-02-46-250x144.jpg 250w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-17_16-02-46.jpg 1046w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>By setting the rank as shown, the conversion sequence shall be like this:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Channel 1.<\/li>\n\n\n\n<li>Channel 2.<\/li>\n\n\n\n<li>Channel 6.<\/li>\n<\/ul>\n\n\n\n<p>Thats all for the Firmware setup.<\/p>\n\n\n\n<p>Save the project this will generate the project.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">3. Firmware Development:<\/h2>\n\n\n\n<p>After the code has been generated, main.c shall be generated.<\/p>\n\n\n\n<p>In main.c in user code begin PV (Private Variable), declare an array to hold the adc data of the three channels 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;C&quot;,&quot;language&quot;:&quot;C&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;c&quot;}\">uint16_t adcValue[3];<\/pre><\/div>\n\n\n\n<p>Next, in user code begin 0, declare the following channel:<\/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;C&quot;,&quot;language&quot;:&quot;C&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;c&quot;}\">void adc_read_multichannel(uint16_t adc_buff[], uint8_t len)\n{\n\n\tfor (int i=0;i&lt;len;i++)\n\t{\n\t\tHAL_ADC_Start(&amp;hadc1);\n\t\tHAL_ADC_PollForConversion(&amp;hadc1, 100);\n\t\tadc_buff[i]=HAL_ADC_GetValue(&amp;hadc1);\n\t}\n\tHAL_ADC_Stop(&amp;hadc1);\n\n}<\/pre><\/div>\n\n\n\n<p>The function <strong>adc_read_multichannel<\/strong> shall read multiple channels in polling and takes the following parameters:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Array to hold the measured ADC channels.<\/li>\n\n\n\n<li>Number of channels.<\/li>\n<\/ul>\n\n\n\n<p>With the function, the sequence to read multiple channels as following:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Start the ADC.<\/li>\n\n\n\n<li>Wait for the conversion to complete.<\/li>\n\n\n\n<li>Get the value.<\/li>\n\n\n\n<li>Repeat for the rest of the channels.<\/li>\n\n\n\n<li>Stop the adc after all channels have been converted.<\/li>\n<\/ul>\n\n\n\n<p>In user code begin 3, call the function each 300 milliseconds 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;C&quot;,&quot;language&quot;:&quot;C&quot;,&quot;maxHeight&quot;:&quot;400px&quot;,&quot;modeName&quot;:&quot;c&quot;}\">\t  adc_read_multichannel(adcValue,3);\n\t  HAL_Delay(300);<\/pre><\/div>\n\n\n\n<p><\/p>\n\n\n\n<p>Thats all for the firmware.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">4. Connection:<\/h2>\n\n\n\n<p>The connection is as follows:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"943\" height=\"1024\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-17_16-08-01-943x1024.jpg\" alt=\"\" class=\"wp-image-3468\" srcset=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-17_16-08-01-943x1024.jpg 943w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-17_16-08-01-276x300.jpg 276w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-17_16-08-01-768x834.jpg 768w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-17_16-08-01-1415x1536.jpg 1415w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-17_16-08-01-1150x1248.jpg 1150w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-17_16-08-01-750x814.jpg 750w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-17_16-08-01-400x434.jpg 400w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-17_16-08-01-250x271.jpg 250w, https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/2025-05-17_16-08-01.jpg 1544w\" sizes=\"(max-width: 943px) 100vw, 943px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">5. Results:<\/h2>\n\n\n\n<p>Start a debug session and add adcValue to live expression and you should the following:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"599\" src=\"https:\/\/blog.embeddedexpert.io\/wp-content\/uploads\/2025\/05\/ezgif-56256946e83106.gif\" alt=\"\" class=\"wp-image-3469\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>Next part, we shall use interrupt and DMA to acquire the three channels effectively.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>Happy coding \ud83d\ude09<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this third part of the STM32 ADC series, we explore how to use discontinuous mode to read multiple ADC channels efficiently. This mode allows precise control over channel sampling by breaking a regular conversion sequence into smaller steps, each triggered manually or by events. In this guide, we shall cover the following: 1. Introduction [&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-3460","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\/3460"}],"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=3460"}],"version-history":[{"count":2,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/posts\/3460\/revisions"}],"predecessor-version":[{"id":3470,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=\/wp\/v2\/posts\/3460\/revisions\/3470"}],"wp:attachment":[{"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3460"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3460"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.embeddedexpert.io\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3460"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}