2021-03-26 07:17 AM
Hello,
I'm using the ADC on a STM32G431 to read 5 voltages at 20kHz. Everything works well, but suddenly the 5 channels "get stuck" or freeze, i.e. the value they measure becomes constant even though the voltages on the input pins still fluctuate. Sometimes the measured values resume to being correct again by themselves after a little while (like after 200 samples for instance), other times the values remain constant until I manually cycle the MCU power.
Some more details about the code architecture:
Some info about my debugging so far:
NB: this is surprisingly similar to this question by @FChen.3 , but since no answer was given there I thought sharing my case still is useful.
Solved! Go to Solution.
2023-03-01 10:24 PM
2021-03-26 08:50 AM
Try configure MCU clock without PLL (HSI or HSE)
2021-03-31 01:22 AM
Thanks for you answer.
Sadly I can't do without the PLL (the MCU needs to be running at almost max speed), but still I've managed to reduce the PLL_N multiplication factor from 84 to 21. It looks like it's not helping though, the ADC still freezes.
Why do you point at the PLL? Is there some known bugs or undocumented limitations?
As suggested in the aforementioned thread, I've tried to restart the ADC + DMA when ADC freeze is detected. This indeed allows resuming ADC operation back to normal, but it's not really a solution.
Any other ideas of what could cause the observed ADC freezes?
2021-04-13 07:09 AM
2021-04-27 01:19 AM
Hi Igor,
Thanks for your input. VDDA/VSSA pins are indeed well decoupled using 1uF+100nF ceramic caps placed ~1mm from the pins, but the caps are on the other side. I'll try and move them to the same side just in case.
Best,
ikrosoft
2021-04-27 01:36 AM
Hi ikrosoft (Community Member),
What is the ADC clock? What is the "constant" ADC value (output word from ADC)? Which device revision are you using? Try to replace DMA with interrupt or polling method - to identify if the problem is in the DMA or not.
Regards
Igor
2023-02-28 04:08 AM
Hi All.
I am trying to use STM32F103 devices ADC channel number 0 and 1.
I checked the voltage over the pin IN0 and IN1 is 0.8V to 0.99V without giving any input to the pin due to this I am getting wrong value.
Could you please tell me the cause for this??
Thanks
2023-02-28 05:14 AM
Hi jtron.1,
If ADC input pin is floating then the input voltage is undefined and if you are measuring this floating pin the voltage is some residual voltage on sampling capacitor.
Why are you not providing some voltage on IN0 and IN1 an measuring it?
Regards
Igor
2023-02-28 08:51 AM
Thanks for the reply Igor.
Will residual voltage affect the accuracy?
When I try to pull this voltage down then I got 0000 reading on my display.
Can I use external pull down resistor.??
My concern is this the floating pin voltage is about 900mV to 1V so if I apply voltage less than 900mV will it work?
Because I want to measure voltage less than 600mV.
I did not provide yet as I was stuck in floating voltages I am getting on IN0 and IN1.
Thanks...
2023-03-01 07:46 AM
Hi jtron.1,
The voltage on floating ADC input pin is very weak - so external signal easily force own voltage on pin. The source signal impedance must follow the datasheet requirements: impedance less than 50 kOhm.
Regarding the voltage on IN0 and IN1 : what is the ADC result (data from ADC) for those channels? Are they zero or another values? And is this value fixed also if input volatge is changing?
Regards
Igor