cancel
Showing results for 
Search instead for 
Did you mean: 

ADC sampling bleeding

MrAzn69
Associate II

I have a timer with an interrupt every 1ms to create time stamps for my later algorithm developement. I flag for the adc to sample once every 5 seconds, but I see that the ADC bleeds over or it changes multiple times before stopping. Is there anyway to stop this? I only want one sample.

 

Is APB1 Timer clocks or APB1 peripheral clocks the clock that determines the speed of my timer? I am counting internally, I want to scale and set up count accordingly to get an interrupt every 1 ms. I would very much appreciate an explanation as I am new.

1 REPLY 1
TDK
Guru

If the timer is in APB1, the relevant clock is the APB1 Timer clock. Different timers are on different buses. Look at the CubeMX clock page for a graphical explanation of how clocks are configured in your system.

The most common error in ADC accuracy is caused by low sampling time. Increase it to max if you want the most accurate results. This and other general ADC accuracy is addressed here:

https://www.st.com/resource/en/application_note/an2834-how-to-optimize-the-adc-accuracy-in-the-stm32-mcus-stmicroelectronics.pdf

 

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