2025-11-13 10:01 PM
Hello,
I am trying to configure my STM32H723ZG to be able to read the value of a few current sensors. My main concern at the moment is the speed at which I need to read these. I'm hoping to be reading upwards of rate of 20kHz.
My questions are about which method might be best, the standard way of reading the ADCs seems insufficient, I've seen online some methods are DMA and injected conversions. If anyone could provide some insight into what might be best and how to go about implementing them that would be great.
Additionally, I wanted to ask how to determine an appropriate sampling time of the ADC.
Thank you in advance for your help!
2025-11-14 12:44 AM
Hi @evanpol,
Here's a detailed explanation and solution to help you achieve fast and efficient ADC readings on your STM32H723ZG, targeting a sampling rate of around 20 kHz for multiple current sensors.
How to Implement DMA + Timer Trigger ADC Sampling on STM32H7
Configure ADC:
Configure Timer:
Configure DMA:
Start timer and ADC:
Data Processing:
The ADC sampling time is the time the ADC input is connected to the sampling capacitor before conversion starts. It affects:
Check sensor output impedance:
Calculate total conversion time:
Tconv = Tsampling+12.5×TADCclock
Since you want 20 kHz per channel, even with multiple channels, this is achievable with ample margin.
Good luck,
Aime
2025-11-14 12:46 AM
Hi @evanpol,
Here's a detailed explanation and solution to help you achieve fast and efficient ADC readings on your STM32H723ZG, targeting a sampling rate of around 20 kHz for multiple current sensors.
How to Implement DMA + Timer Trigger ADC Sampling on STM32H7
Configure ADC:
Configure Timer:
Configure DMA:
Start timer and ADC:
Data Processing:
The ADC sampling time is the time the ADC input is connected to the sampling capacitor before conversion starts. It affects:
Check sensor output impedance:
Calculate total conversion time:
Tconv = Tsampling+12.5×TADCclock
Since you want 20 kHz per channel, even with multiple channels, this is achievable with ample margin.
Good luck,
Aime
2025-11-14 12:50 AM
Hi @evanpol,
Here's a detailed explanation and solution to help you achieve fast and efficient ADC readings on your STM32H723ZG, targeting a sampling rate of around 20 kHz for multiple current sensors.
How to Implement DMA + Timer Trigger ADC Sampling on STM32H7
Configure ADC:
Configure Timer:
Configure DMA:
Start timer and ADC:
Data Processing:
The ADC sampling time is the time the ADC input is connected to the sampling capacitor before conversion starts. It affects:
Check sensor output impedance:
Calculate total conversion time:
Tconv = Tsampling+12.5×TADCclock
Since you want 20 kHz per channel, even with multiple channels, this is achievable with ample margin.
Good luck,
Aime
2025-11-14 1:05 AM
Hello @evanpol ,
You can check the example for using the ADC peripheral to perform a single conversion on the internal temperature sensor and calculate the temperature in degrees Celsius at this link:
This example uses the polling method and shows basic ADC configuration and reading. You can follow its structure as a starting point for your own application.
You can also check our other examples demonstrating ADC with different programming models such as DMA and interrupt-based methods in this link below :
STM32CubeWB/Projects/P-NUCLEO-WB55.Nucleo/Examples_LL/ADC at master · STMicroelectronics/STM32CubeWB · GitHub
Br