cancel
Showing results for 
Search instead for 
Did you mean: 

Weird ADC failure STM32F091, any ideas

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?

41 REPLIES 41

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

ONadr.1
Senior III

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.

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?

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.

I think we'll have to see if we can source replacement parts and swap them. Curse the chip shortage!

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!

ONadr.1
Senior III

You can write a short test program that will verify individual analog channels with different parameters.

True of course, but no so easy on hardware where most pins are used for something.

ONadr.1
Senior III

For measurement internal Vref or Temp channel, you can let them unassigned. Cube Mx can set them all as analog automaticaly.

> 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