Monday, 19 August 2019

ADC data.. Is something fishy?


Folks,



I have been playing with STM32F2 (probably the most advanced ARM Cortex M3 in the market). This is not a processor specific question nonetheless.


I have a set up where I have 0V sampled by several ADC pins. I read and dump the values. When I examine the values, I expect to see all zeros, instead I see mostly zeros but bunch of values up to 100. (i.e. this is a 12 bit ADC with 4096 levels, so 100 is roughly means ~3.3/4096*100 = 80mV)


I know for a fact, my 0 volt is really 0V (i.e. ground).. So, 100 out of 4096.. Is this expected? I have never fiddled with other ADC enabled chips so I cannot gauge this much error is expected or not. Any insights?



Answer



In addition to what stevenvh said, make sure you are running the A/D correctly inside the processor. I am not familiar with that processor, but the ones I have seen all have a sample and hold in front of the internal A/D. Often there is one or a small number of actual A/D converters, with a mux in front of the sample and hold to select the single channel to read that time. The sample and hold takes some finite time to settle. You have to make sure it has been given sufficient time after the mux is changed before the sample and hold goes into hold mode and the A/D does the conversion.


Another possible error is the impedance of the signal driving the A/D pin. The datasheet should have a spec for that, and it might be a lot lower than you think. To avoid offset errors, there is generally no amplifier in the chip. The sample and hold is just a capacitor with a FET that connects it to the input pin in sample mode. The impedance driving the pin needs to be below some value to get the specified accuracy and minimum sample time.


Also check what exactly the A/D is using for its voltage references, particularly the low side reference in your case. The default is probably the regular processor ground. However, it could also have a separate analog ground pin, and sometimes a separate analog input pin can be used as the negative reference. Check to make sure this is all set up as you intended it.


As stevenvh said, 80mV is way too high for any normal error. At most you would expect one count or maybe two when it really should be reading 0. Something is definitely wrong with your setup. Keep in mind this includes the setup of use of the A/D by the firmware.


No comments:

Post a Comment

arduino - Can I use TI's cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...