2026-01-20 7:38 AM - edited 2026-01-20 7:40 AM
Doing the set up in MX
I have four ADC channels on APB2 with PCLK2 at 84 MHz sampling 4 microphones.
The recommended audio sampling rate stretch from 44.1 kHz up to 96 kHz, so initially I'm happy anywhere in that range for now.
I have set the clock pre-scaler to divide PCLK2 / 4 so the ADC clock is at 21 MHz
I have 12 bit resolution which takes 15 ADC cycles but then in the "rank" section of the parameter settings there is a pull down for sampling time for each channel. I'm guessing that the value I pass in the "rank" section is what I would use to get the final sampling rate.
e.g. if I chose 84 cycles for each channel then I would have a sample rate of 250 kHz per channel giving a sample rate for all conversions of 62.5 kHz?
Or do I add the sample time to the resolution time e.g. 84+15 giving a sample rate of ~212 kHz per channel?
Solved! Go to Solution.
2026-01-20 7:50 AM - edited 2026-01-20 8:18 AM
The total time to convert a channel is sampling time + conversion time.
I believe 12-bit resolution requires 12 cycles to convert, not 15. So your total time would be 84 + 12 cycles per sample.
2026-01-20 7:50 AM - edited 2026-01-20 8:18 AM
The total time to convert a channel is sampling time + conversion time.
I believe 12-bit resolution requires 12 cycles to convert, not 15. So your total time would be 84 + 12 cycles per sample.
2026-01-20 7:54 AM
Thanks, MX is saying "15 ADC clock cycles" for 12 bits which is an annoying number for sure.
2026-01-20 8:09 AM - edited 2026-01-20 8:09 AM
If you want a specific sampling time, it's easier to have them triggered from a timer rather than in continuous mode. Set up the conversions to complete at least as fast as the timer triggers.