STM32 ADC Conversion Time: How to Calculate It
When an ADC result arrives later than expected, the cause is usually the conversion time, which is easy to misjudge because it depends on three separate settings. These are the sampling cycles chosen for the channel, the conversion cycles fixed by the resolution, and the ADC clock that comes out of the prescaler settings.
This tutorial works through the formula for the STM32F103, the STM32F446 and the STM32H750. For the F446 and the H750, the calculated values are then compared with a real measurement, which is made by toggling a GPIO pin after every conversion and reading the pulse width on a logic analyzer.
This is part 6 of the STM32 ADC series. The previous part covers reading multiple ADC channels without DMA, and the next part shows how to start conversions from a timer trigger, which depends on knowing how long a conversion takes. The measurement code here builds on ADC single channel mode with interrupt and DMA, and every lesson in the series is listed on the STM32 ADC tutorials page.
Table of contents
Why STM32 ADC Conversion Time Matters
STM32CubeMX makes it easy to configure an ADC and start reading values without thinking about timing. Every conversion still takes a fixed amount of time, and a wrong assumption about that time leads to wrong decisions about sampling speed, task scheduling and signal quality. Calculating the conversion time shows the real limits of the ADC before the firmware is built around it.
Sampling Speed and System Limits
Each conversion consists of a sampling phase followed by a conversion phase, and the sum of the two sets the highest sampling rate the ADC can reach. When the conversion takes longer than expected, fast signals are sampled too slowly, high-frequency content is lost and the effective sampling rate falls below what the application needs. Motor control, audio capture, power monitoring and sensor logging are typical applications where this timing matters.
The settings also work against each other. A longer sampling time improves accuracy with high-impedance sources, and a higher resolution needs more conversion cycles, but both choices reduce the maximum sampling rate.
Firmware Design and Debugging
ADC conversions are usually combined with timers, interrupts and DMA, so the conversion time has to fit inside the trigger period. If a timer starts conversions faster than the ADC can finish them, some triggers are missed, a multi-channel scan does not complete in time and the DMA buffer fills more slowly than planned. The timer-triggered ADC tutorial shows how to set up such a trigger, and the STM32 timer tutorials cover the timer side in more detail.
In polling mode, a long conversion also blocks the CPU for the whole conversion. When readings look slow or irregular, the cause is often a wrong clock prescaler, a long sampling time or an extra clock divider inside the device, and an expected conversion time makes these problems much easier to find.
STM32 ADC Conversion Time Formula
The reference manuals of the STM32 series describe the total conversion time with one relationship.
ADC conversion time = (Sampling cycles + Conversion cycles) / ADC clock frequencyThe result is the time from the start of sampling until the digital result is ready. When the ADC converts one channel continuously, the maximum sampling rate is the reciprocal of this time.
Sampling Cycles
The sampling cycles define how long the ADC samples the analog input, counted in ADC clock cycles. The value is set in CubeMX and can be different for each channel. A longer sampling time gives the internal sampling capacitor more time to charge, which helps when the source impedance is high or when stable readings matter more than speed. The price is a longer conversion time and a lower maximum sampling rate.
Conversion Cycles
The conversion cycles are the time the ADC needs to turn the sampled voltage into a digital number. This value cannot be changed by the user, because it depends on the selected resolution and on the STM32 series. Because it differs between series, it must always be taken from the reference manual of the device in use.
ADC Clock Frequency
The ADC clock is derived from a bus or kernel clock through one or more prescalers. A higher ADC clock shortens the conversion, but the frequency must stay within the limits given in the datasheet of the device. For example, the STM32F103 allows a maximum ADC clock of 14 MHz.
STM32F103 ADC Conversion Time
Conversion Cycles on the STM32F103
The STM32F103 has a 12-bit ADC with a fixed resolution, so the resolution cannot be changed in CubeMX. The reference manual gives 12.5 ADC clock cycles for the conversion phase, and this value is added to the sampling time. The sampling time can be selected for each channel from 1.5 up to 239.5 cycles, and the ADC clock is the APB2 clock divided by 2, 4, 6 or 8.
Example Calculation for the STM32F103
The example uses an ADC clock of 1 MHz, a sampling time of 239.5 cycles and the fixed 12.5 conversion cycles. The 1 MHz clock is far below the maximum and is used only to make the effect of the sampling time easy to see. The total number of cycles is:
Total cycles = 239.5 + 12.5 = 252 cyclesThe conversion time at 1 MHz follows from the formula:
Conversion time = 252 / 1,000,000 Hz = 252 µsThe maximum sampling rate for this configuration is about 1 / 252 µs = 3.97 kSPS. The long sampling time dominates the result, because 239.5 of the 252 cycles are spent sampling.
The opposite case shows how fast the same ADC can run. With a 72 MHz system clock and an APB2 clock of 72 MHz, an ADC prescaler of 6 gives a 12 MHz ADC clock. With the shortest sampling time of 1.5 cycles, the total is 14 cycles, and the conversion time becomes 14 / 12 MHz, which is about 1.17 µs.
STM32F446 ADC Conversion Time
Conversion Cycles by Resolution
The STM32F446 has a configurable ADC resolution, and the number of conversion cycles follows the resolution. The reference manual lists the values shown in the table below.
| ADC resolution | Conversion cycles |
|---|---|
| 12 bit | 12 |
| 10 bit | 10 |
| 8 bit | 8 |
| 6 bit | 6 |
CubeMX Clock Configuration for the F446
In this example the APB2 peripheral clock runs at 4 MHz. ADC1, ADC2 and ADC3 are all connected to the APB2 bus, so each of them receives the same input clock, and the ADC prescaler divides it further. The low clock keeps the conversion long enough to read easily on a logic analyzer.
CubeMX ADC Settings for the F446
The ADC clock prescaler is set to 6, which gives the following ADC clock:
f_ADC = 4,000,000 Hz / 6 = 666,666.67 Hz (about 666.67 kHz)The ADC resolution is 12 bit, so the conversion cycles are 12, and the sampling time is set to 480 cycles. DMA is enabled in circular mode, and both continuous conversion mode and DMA continuous requests are switched on. With these options the ADC converts back to back without any CPU involvement.
F446 Conversion Time and Sampling Rate
The total number of cycles and the resulting time are calculated as follows:
Total cycles = 480 + 12 = 492 cycles
Conversion time = 492 / 666,666.67 Hz = 738 µs
Sampling rate = 1 / 738 µs = about 1,355 samples per secondSTM32 ADC Conversion Time Measurement
The calculated times can be checked by toggling a GPIO pin each time a conversion finishes. Because the pin changes state at the end of every conversion, the high time and the low time of the signal both equal one conversion time.
GPIO Pin Setup for the Measurement
The measurement uses PA1 on the STM32F446 and PD8 on the STM32H750. Configure the pin as a GPIO output, set the output speed to Very High so the edges stay clean at the logic analyzer, and give the pin the user label ADC_TEST. CubeMX then generates the macros ADC_TEST_Pin and ADC_TEST_GPIO_Port, which lets the same code run on both boards. A beginner guide to GPIO outputs is available in the first STM32 project tutorial.
HAL Code to Toggle the Pin
The ADC is started in DMA mode from main, and the conversion complete callback toggles the pin. The result variable is a 32-bit value, which matches the pointer type that HAL_ADC_Start_DMA expects. The DMA data width in CubeMX can stay at Half Word.
/* USER CODE BEGIN PV */
volatile uint32_t adcValue; /* DMA writes the conversion result here */
/* USER CODE END PV */
/* USER CODE BEGIN 2 */
/* Start continuous ADC conversion with DMA, one channel */
if (HAL_ADC_Start_DMA(&hadc1, (uint32_t *)&adcValue, 1) != HAL_OK)
{
Error_Handler();
}
/* USER CODE END 2 */
/* USER CODE BEGIN 4 */
/* Called by HAL after every finished conversion */
void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef *hadc)
{
if (hadc->Instance == ADC1)
{
HAL_GPIO_TogglePin(ADC_TEST_GPIO_Port, ADC_TEST_Pin);
}
}
/* USER CODE END 4 */The last argument of HAL_ADC_Start_DMA is the number of conversions to transfer, which is 1 because only one channel is converted.
F446 Measurement Result
The logic analyzer capture shows PA1 staying high for about 738 µs, which closely matches the value calculated with the formula. The measurement confirms that the formula and the clock calculation are correct for this device.
STM32H750 ADC Conversion Time
Conversion Cycles on the STM32H7
The STM32H750 also has a configurable ADC resolution, and the reference manual lists the conversion cycles for each setting. The sampling time can be selected for each channel up to 810.5 cycles.
| ADC resolution | Conversion cycles |
|---|---|
| 16 bit | 8.5 |
| 14 bit | 7.5 |
| 12 bit | 6.5 |
| 10 bit | 5.5 |
| 8 bit | 4.5 |
CubeMX Configuration for the H750
The ADC clock source is set to 2 MHz in the clock configuration, and the ADC prescaler is set to 2.
The ADC clock after the prescaler is:
f_ADC = 2,000,000 Hz / 2 = 1,000,000 Hz = 1 MHzThe resolution is 16 bit, which needs 8.5 conversion cycles, and the sampling time is 810.5 cycles. DMA is enabled in circular mode, continuous conversion mode is on, and the conversion data management is set to DMA circular mode.
The pin PD8 is configured as a very high speed output with the label ADC_TEST, exactly as described in the measurement section above. The H7 ADC should also be calibrated before the first conversion, and the calibration does not change the conversion time. Add the following call before HAL_ADC_Start_DMA.
/* H7 only: offset calibration before the first conversion */
if (HAL_ADCEx_Calibration_Start(&hadc1, ADC_CALIB_OFFSET, ADC_SINGLE_ENDED) != HAL_OK)
{
Error_Handler();
}H750 Calculated Conversion Time
The formula gives the following result for this configuration:
Conversion time = (810.5 + 8.5) / 1,000,000 Hz = 819 µsH750 Measured Conversion Time
The logic analyzer shows PD8 staying high for 1.638 ms, which is twice the calculated 819 µs. The extra factor comes from a clock divider that exists only in some revisions of the STM32H7, and the next section explains it.
STM32H7 Revision V ADC Conversion Time
The reference manual describes an additional divide-by-2 stage in the ADC clock path of revision V devices. The stage sits after the prescaler, so the effective ADC clock is half of the value that CubeMX shows.
For revision V devices the conversion time formula therefore becomes:
Conversion time (rev V) = (Sampling cycles + Conversion cycles) / (f_ADC / 2)
= 2 x (Sampling cycles + Conversion cycles) / f_ADCFor the H750 example this gives 2 x 819 µs = 1,638 µs, which matches the measurement, and the maximum sampling rate drops to about 610 samples per second.
| STM32H7 revision | ADC clock behavior |
|---|---|
| Revision Y | The prescaled ADC clock is used directly, so the standard formula applies. |
| Revision V | The prescaled ADC clock is divided by 2, so the conversion time is doubled. |
For any other revision, check the ADC_CCR description in the reference manual of your device. The revision of a chip can be read in code with HAL_GetREVID(), and it is also shown in the device details of the debugger.
STM32 ADC Conversion Time Troubleshooting
The table below lists the most common reasons for a measured conversion time that differs from the calculated one.
| Symptom | Likely cause | What to check |
|---|---|---|
| The measured time is twice the calculated time on an STM32H7. | The device is revision V, which divides the ADC clock by 2. | Read the revision and apply the revision V formula. |
| The measured time is much longer than calculated. | The real ADC clock differs from the assumed one. | Compare the Clock Configuration tab in CubeMX with the ADC prescaler setting. |
| The time grows when more channels are added. | Each channel in a scan is converted with its own sampling time and conversion cycles. | Add the individual conversion times of all ranks. |
| Channels need different times. | The sampling time is set per channel. | Check the sampling time of every rank in CubeMX. |
| Timer-triggered samples are missing. | The trigger period is shorter than the conversion time. | Lengthen the period, or shorten the sampling time or the prescaler. |
| Each result takes longer when oversampling is on. | Hardware oversampling performs several conversions for every result. | Include the oversampling ratio, as described in the ADC oversampling tutorial. |
| The logic analyzer edges look slow or rounded. | The GPIO output speed is too low. | Set the output speed to Very High. |
Conclusion
The STM32 ADC conversion time is the sum of the sampling cycles and the conversion cycles divided by the ADC clock frequency. The sampling cycles and the clock are under your control, while the conversion cycles follow from the resolution and the series, so the reference manual is the source for that value. The F446 measurement matched the calculation, and the H750 measurement matched it after the revision V divider was included.
Knowing the conversion time helps to choose sampling settings, to size timer trigger periods and to find the cause when ADC data arrives more slowly than expected. The next part of the series shows how to trigger the ADC from a timer, which relies directly on these timing values.
Browse More STM32 ADC Tutorials

Arun is an embedded systems engineer with 10+ years of experience in STM32, ESP32, and AVR microcontrollers. He created ControllersTech to share practical tutorials on embedded software, HAL drivers, RTOS, and hardware design — grounded in real industrial automation experience.
Recommended Tools
Essential dev tools
Categories
Browse by platform















Why you mention about 12 cycle when docs state it is 15 cycles?
Where exactly, please explain in a little more detail.
No code download for this video???