2023-02-08 08:50 AM
We've been building a PCB with four STM32F091s on each PCB and we've built about 50 units by now (over about 3 years). I have now seen three PCBs where the ADC readings are 'bad' on two of the four micros. By 'bad' I mean conversion values are 30% ish low.
With the design having been stable for quite a while, the chances of uncovering a new bug seem slim, but chip damage seems even more unlikely. The fault also 'went away' on one of the PCBs, so more evidence that it's not damage.
The ADC reference is VDD 3.3V on all the chips, and they all run the same code.
Anyone got any thoughts?
Solved! Go to Solution.
2023-02-14 04:58 AM
See my posting 3 up from yours. The measurement of the internal Vref is NOT consistent with actual measured VDD, so answering that question would probably crack the problem
2023-02-14 05:16 AM
There aren't many options here. If the voltage VDDA-VSSA is OK, then only check the sampling time of the analog channels and the frequency for the AD converter. If the value of AD conversion is not corrupted by the program, the MCU is faulty.
2023-02-14 05:55 AM
Okay.
In that post I see that you use CubeMX code.
I actually do the same for internal ADC, but as soon as any peripheral causes some trouble, I go through it register by register and throw out the Cube stuff.
Could you at least compare register settings between bad and good ones?
2023-02-14 06:47 AM
I also replace CubeMX and HAL code wherever I need performance. There's not that many registers to compare because the ADC clock source is hard wired to HSI 14MHz.
2023-02-14 06:49 AM
I think we'll have to see if we can source replacement parts and swap them. Curse the chip shortage!
2023-02-14 07:21 AM
So I finally tried fiddling with the sampling time, and the longer I make it the better the results are! I've re-checked the reference manual and data sheet and don't see any guidance other than RC settling time. I can live with slower ADC throughput so this may be the answer!
2023-02-14 10:22 PM
You can write a short test program that will verify individual analog channels with different parameters.
2023-02-15 12:24 AM
True of course, but no so easy on hardware where most pins are used for something.
2023-02-15 02:10 AM
For measurement internal Vref or Temp channel, you can let them unassigned. Cube Mx can set them all as analog automaticaly.
2023-02-15 02:50 AM
> You can scale unknown voltages either to the internal 1.23V or to the inferred VDD.
OK and which one do you use? Does that explain the +30% in case of VREFINT and simultaneously the -30% of external sources as given in initial post?
> ADC clocking and sampling times are all set up in the CubeMX synthesised code,
I don't know how Cube/CubeMX do things - I don't use them - but please note that contrary to most other STM32 families, the 'F0 has only one single sampling time register. So, if you perform a sequence of conversions (i.e. if ADC_CHSELR contains more than one one and ADC_CFGR1.DISCEN=0), all channels in that sequence use the same sampling time.
JW