Using ADC to read voltage divider value

5 posts / 0 new
Last post
motred
Offline
Last seen: 4 years 11 months ago
Expert
Joined: 2014-01-20 21:48
Using ADC to read voltage divider value

I'm using a resistive divider to measure a voltage from a LiPo battery. When I connect a voltage divider with ratio 4:1 to P0_0, I read only about 0x20 from the ADC regardless of what voltage I put into the resistor divider. This is much lower than the expected value.

If I probe the input to the ADC with a multimeter, the ADC starts working and measuring values that match what I expect. When I stop probing with a multimeter, the ADC stops working again. I have tried dropping the total impedance of the divider from 10Mohms to 200kOhms, and I get the same behavior.

If I feed a specific voltage to the ADC pin from a DC power supply, the ADC seems to work correctly.

This behavior seems similar to the problems that hrg has been having here: http://support.dialog-semiconductor.com/adc-interfacing-problem

Is there anything special that I need to do to use the ADC with a standard resistor based voltage divider?
Have you done this succesfully?
Is there a maximum load impedance that should be used for the divider?

JE_Dialog
Offline
Last seen: 8 hours 21 min ago
Staff
Joined: 2013-12-05 14:02
Hello Motred,

Hello Motred,

our datsheet is not very good at describing the ADC input :

Do you have the internal attenuator set ? GP_ADC_ATTN3X

(Without an attenuator, the max input is 1.2V and the input is high impedance : with attenuator set, the max input is 3.6V and ther is a 200K/100K attenuator in front of the ADC .)

BR JE_Dialog

 

motred
Offline
Last seen: 4 years 11 months ago
Expert
Joined: 2014-01-20 21:48
I haven't explicitly set that

I haven't explicitly set that, but that would definitely cause the problem that I"m seeing. How do I turn off the attenuator? I searched for GP_ADC_ATTN3X in the SDK, but I only find it defined in datasheet.h with no discussion about its use.

Thanks.

JE_Dialog
Offline
Last seen: 8 hours 21 min ago
Staff
Joined: 2013-12-05 14:02
Hello Motred, please look at

Hello Motred, please look at table 212 in the datsheet : this tells you what bits you need to set as part of control register GP_ADC_CTRL2_REG  to turn on/off the attenuator.

If you then take a look in the peripheral_example project in the SDK, you will find this in the adc.c section (line 39)

BR JE_Dialog

motred
Offline
Last seen: 4 years 11 months ago
Expert
Joined: 2014-01-20 21:48
Thanks JE_Dialog. I turned

Thanks JE_Dialog. I turned off the attenuator and that fixed the problem.

Topic locked