2024-07-09 07:55 AM
ADC1 clocked @ 65 MHz, pre-scaler of 8, 7 channels active, 640.5 cycles/conversion, 256 oversampling, interrupts, scan mode. The numbers suggest all channels will be converted 1x in (8/65000000) * 640.5 * 7 * 256 = 141 ms. But when I look at uwTick before HAL_ADC_Start_IT() and after 7 conversions complete, I get 37 ms. Why the discrepancy?
2024-07-09 04:49 PM
I have no idea. But 65*(141/37)=247Mhz =~ 250Mhz, the max Freq for this chip.
Are you sure the ADC clock is running at 65Mhz and not 250Mhz? If you're using cube, can you share a screenshot of your clock configuration? and ADC peripheral as well.
2024-07-09 05:19 PM
> Why the discrepancy?
Probably the clock is not what you think it is. Impossible for us to tell here. Math otherwise seems okay, except:
Note that the 640.5 cycles is only for sampling. There is an additional 12.5 cycles/sample for conversion at 12 bits.
2024-07-09 05:32 PM - edited 2024-07-09 05:33 PM
That fits. (8/65000000) * (640.5+12.5) * 7* 256 *1000 = 144.02 = 37*4
2024-07-10 06:10 AM
Where is the factor of 4 from? As in 144 ~= 37 * 4
2024-07-10 08:03 AM - edited 2024-07-10 09:17 AM
I don't see anything obviously wrong with your configuration. Can you post the entire clock screen? (PLL sections, HCLK).
This might happen if you set the HSE crystal frequency to the wrong value (e.g. you tell Cube you're using a 4Mhz crystal when in fact it is 16Mhz), so the PLL input frequency is actually 4x.
Also, what happens if you switch to the Synchro clock mode (which uses the the AHB clock)?
Update: no reason to accept as solution yet. Feel free to unaccept until resolved.
2024-07-10 08:53 AM
2024-07-10 10:37 AM
Verified HSE is 26 MHz
2024-07-10 12:07 PM
> Also, what happens if you switch to the Synchro clock mode (which uses the the AHB clock)?
2024-07-11 03:19 PM
Synchronous clock mode divided by 4 results in 18 ticks (ms) for the same conversions.