cancel
Showing results for 
Search instead for 
Did you mean: 

ADC Conversion Time STM32H563

mccabehm
Associate III

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?

13 REPLIES 13
BarryWhit
Senior III

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.

- If a post has answered your question, please acknowledge the help you received by clicking "Accept as Solution".
- Once you've solved your issue, please consider posting a summary of any additional details you've learned. Your new knowledge may help others in the future.
TDK
Guru

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.

If you feel a post has answered your question, please click "Accept as Solution".
BarryWhit
Senior III

That fits. (8/65000000) * (640.5+12.5) * 7* 256 *1000 = 144.02 = 37*4 

- If a post has answered your question, please acknowledge the help you received by clicking "Accept as Solution".
- Once you've solved your issue, please consider posting a summary of any additional details you've learned. Your new knowledge may help others in the future.
mccabehm
Associate III

Where is the factor of 4 from? As in 144 ~= 37 * 4

mccabehm_0-1720616679302.png

 

 

mccabehm_2-1720616765808.png

 

mccabehm_4-1720616857794.png

 

mccabehm_5-1720616903171.png

 

mccabehm_6-1720616925853.png

 

BarryWhit
Senior III

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.

- If a post has answered your question, please acknowledge the help you received by clicking "Accept as Solution".
- Once you've solved your issue, please consider posting a summary of any additional details you've learned. Your new knowledge may help others in the future.
mccabehm
Associate III

mccabehm_0-1720626821635.png

 

mccabehm
Associate III

Verified HSE is 26 MHz

BarryWhit
Senior III

Also, what happens if you switch to the Synchro clock mode (which uses the the AHB clock)? 

- If a post has answered your question, please acknowledge the help you received by clicking "Accept as Solution".
- Once you've solved your issue, please consider posting a summary of any additional details you've learned. Your new knowledge may help others in the future.
mccabehm
Associate III

Synchronous clock mode divided by 4 results in 18 ticks (ms) for the same conversions.