Skip to main content
Oliver Sedlacek
Senior
February 8, 2023
Solved

Weird ADC failure STM32F091, any ideas

  • February 8, 2023
  • 41 replies
  • 6043 views

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?

This topic has been closed for replies.
Best answer by Oliver Sedlacek

I really appreciate the help I've had on this problem, so thanks to you all.

So what was the problem down to? Why were so many micros working before this problem started to appear?

Mechanical stress! The boards are bolted to a heatsink, so there's a thermal pad under most of it. Recently a thicker pad was being fitted and where the PCB overhangs the pad (not ideal with hindsight), pulling down the bolts was bowing the PCB. The chips don't like it!

41 replies

waclawek.jan
Super User
February 8, 2023

Boards running continuously/long-term? If yes, does the "self-healing" relate to reset? Possible temperature excurses?

The ADC has calibration for a reason.

JW

Oliver Sedlacek
Senior
February 8, 2023

The boards haven't had much running, and work at office temperatures. The one that came back did so after a power cycle, not just a reset.

ONadr.1
Senior III
February 8, 2023

I would try replacing the mcu with a new one. This would show whether the problem is in the MCu or in the external measuring channel. It would also be good to check if the MCu's internal measurement channel and the calibration of the converter (against the internal reference source and zeroing) are set correctly.

Oliver Sedlacek
Senior
February 9, 2023

Hard to get the MCUs at the moment and not sure that would prove. I'm measuring the ADC input voltage at the MCU pin, so there's no external measurement channel involved.

Measuring the internal reference should throw some light on the problem but will involve significant code changes, which might in turn affect the problem. Ideally I'd like to know the meaning of the calibration register values so I can sanity check them, but I didn't find any description of their contents.

Now waiting for the next faulty board to cross my desk.

waclawek.jan
Super User
February 9, 2023

> Ideally I'd like to know the meaning of the calibration register values

IMO in 'F0 you don't have the calibration register available to the user, i.e. it's internal.

According to the Calibration subchapter of ADC chapter of RM0091:

Calibration should be performed before starting A/D conversion. It removes the offset error

which may vary from chip to chip due to process variation.

According to RM0091 ADC_DR description:

Just after a calibration is complete, DATA[6:0] contains the calibration factor.

JW

Oliver Sedlacek
Senior
February 13, 2023

Nothing is making much sense :unamused_face:. The DR calibration results are 0, 1, 3 and 63 (-1 perhaps), but so what! If I include the measurement of the internal reference and use that to calculate the ADC VCC reference voltages I get 2.748V, 2.776V, 2.760V and 2.491V, all a long way off my actual 3.3V.

S.Ma
Principal
February 13, 2023

You could check what happens if the sample and hold time for a conversion is changed significantly.

Also, measuring Vref voltage will tell you the Vdd. You could put by SW a range detection every 10 minutes to make sure there is no drift.

Oliver Sedlacek
Senior
February 13, 2023

Not sure what you mean bya SW range detection. Results are stable over a couple of hours, just wrong.

ONadr.1
Senior III
February 13, 2023

If the measurement results are unstable like this, I would look at the quality of the supply voltage (ripple, interference)

Oliver Sedlacek
Senior
February 13, 2023

Measurements are completely stable (+/- a few counts) just wrong by 30%. ADC reference is 3.3V VCC, which looks very nice, LDO regulated.

ONadr.1
Senior III
February 14, 2023

And when you measure an internal reference source, are the readings stable and correct? Is the measured reference voltage within the range given in the specification? If not and the supply voltage is fine, the MCU must be faulty.

Oliver Sedlacek
Senior
February 14, 2023

The internal reference comes back as 2022 +/- a few codes. This isn't what I expect, because it implies an ADC VRef of 2.49V. Apart from being a really weird failure mode, on one of my PCBs the fault 'went away', so I'm not convinced it's a hardware fault.

Piranha
Principal III
February 14, 2023

But have your measured the VDDA/VREF+ voltage when the device is in failure mode? VSSA/VREF- state? Maybe soldering quality problems.

Oliver Sedlacek
Senior
February 14, 2023

VDDA is 3.302V. Soldering is always a consideration but the PCBs were professionally assembled and I'm seeing the same problem on several chips.

waclawek.jan
Super User
February 14, 2023

> The internal reference comes back as 2022 +/- a few codes. This isn't what I expect, because it implies an ADC VRef of 2.49V.

But that's then 30% *higher* than expected. In the initial post you've said the measured (external voltages) values are 30% *lower* than expected.

I don't doubt your words, just that this somewhat increases the mystery.

We don't know how exactly do you perform conversions. So, for example, as S.Ma said above, too short sampling time may have impact - in that case, if you convert in sequence, preceding channel may influence measurement of the subsequent one.

JW

Oliver Sedlacek
Senior
February 14, 2023

The way the ADC scale calibration works is rather ar$e about face in the 091. VDDA is always the fullscale reference, and if you can't trust it implicitly you measure an internal 1.23V reference and get the ratio of VDD to 1.23V. You can scale unknown voltages either to the internal 1.23V or to the inferred VDD.

ADC clocking and sampling times are all set up in the CubeMX synthesised code, so that's on my 'to investigate' list.