Electronics > Projects, Designs, and Technical Stuff

ADC reading high when sampling too fast

(1/2) > >>

danie1:
I'm working on a motor driver and have found an interesting (maybe?) issue with my ADC setup.

I copied the config from the open source VESC firmware which runs the F405 at 168MHz and the ADC at 42MHz which is actually out of spec - the datasheet says 36MHz max. However, this does seem to work and is used in one of the STM32 examples for that chip.

The VESC also configures the ADC for the minimum sampling time of 3 Cycles.

I suppose it's a surprise this works at all - the ADC is running above spec and sampling for a tiny amount of time.

This config works for me ONLY if I've got an external filtering capacitor attached. I've got a switchable low pass filter that uses either 220pf (off) or 220nf (on) and when "off" the voltage is wrong.

Increasing the ADC sample time to > 54 cycles or enabling my low pass filter result in the same reading which agrees with my mutli meter, scope and psu.

The odd bit, and the reason for posting, is the wrong reading is higher than the input voltage and I can't think how that could happen. The adc connects the sample and hold cap to the DC signal and if it's connecting for too short a time it reads ~20% high???

I wouldn't be surprised if the VESC hardware has similar quirks but ultimately it doesn't really matter because the absolute voltages don't really matter as long as they are self-consistent and more or less linear.

So, the question is, how can an ADC read higher than the highest DC in the system when the sampling period is too short?

I've attached the schematic for the switchable low pass filter for clarity.

mikerj:
Possibly inductance in the input circuit is causing overshoot on the sampling cap when it's switched in inside the ADC.

bson:
I assume the ADC is differential internally and samples relative to a reference even if it's internal.  A high reading might indicate a drop in the reference voltage.  Not sure how an unfiltered input could make that happen though, but having a charge cap on the input is generally good practice for many reasons.

DaJMasta:
Could it be that the sample and hold cap charges faster than it discharges, so you're seeing some residual offset charge left in the capacitor after shorter discharge cycles that are not fully discharging it?


You could probably test by varying the input DC voltage and seeing whether the reduced voltage follows a standard capacitor discharge curve on the ADC output.

danie1:
I figured it out - if the previous sample in the sequence was higher it takes too long to drain the sample and hold cap. Initially I discounted it because VCC voltage is the highest in the circuit but of course I'm not shoving that directly into the ADC - the scaled VCC is less than the scaled current measurements because the current measurements have a 50% offset so you can read positive and negative.

I feel like there should be method for the chip to attach the sample and hold cap to ground to drain it between samples but I doubt it. I'll take a look in the reference manual. Maybe I can insert a sample of a GPIO I'm not using that's grounded in between.

Cheers for the suggestions anyway!

Navigation

[0] Message Index

[#] Next page

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod