9 years, 6 months ago.

F401RE Analog In Oddness part deux

I had an issue trying to read external voltage using a voltage divider to the analog inputs (http://developer.mbed.org/questions/5279/F401RE-Analog-In-oddness/). I've distilled it down further to the basics.

The problem I'm seeing is different results with different analog input lines on a F401RE. A0 is significantly different than A1-A5. I read that this chip has a single ADC, and the various inputs are multiplexed to it. Thus they should all have very similar results.

So one of three things is going on:

  1. My expectation of how AnalogIn works is wrong, and this kind of diversity between pins is expected.
  2. Something is wrong with my F401RE (unfortunately I only have one at this time).
  3. The way the F401RE mbed library is interfacing with the ADC is wrong in some way.

Here are the results of testing A0-A5 with a simple resistor to either Ground or AVdd. The raw values from AnalogIn are multiplied by 100, so the range is 0-100 instead of 0.0 to 1.0. My testing procedure is to display the values of all A0-A6 inputs at once on an LCD display, and then I switch from one input to another using the same resistor / test lead. Every time I test I get the same steady results for each respective input.

100k (98.0k actual)
To ground:
A0: 12.8
A1: 8.0
A2: 7.6
A3: 7.7
A4: 8.0
A5: 8.1

To AVDD
A0: 92.4 
A1: 91.4
A2: 89.0
A3: 89.0
A4: 91.5
A5: 91.5

1M (993k actual)
To ground:
A0: 21.4
A1: 13.4
A2: 12.2
A3: 12.5
A4: 12.9
A5: 13.3

To AVDD
A0: 86.6
A1: 85.3
A2: 81.3
A3: 80.9
A4: 85.9
A5: 85.6

The manifestation of this is that I can't read external voltages using a voltage divider accurately at all. Even if I try and calibrate around it, the problem seems to not be linear.

The datasheet lists the maximum impedance used as 50kOhm, and it also gives an equation (which I cannot easily copy) to calculate it depending on the settings. But tbh I would then expect the 100kOhm to still work quite fine. It might also be related to the PCB design, although 10% would be alot.

And tbh they aren't that different, with one or two exceptions, the main difference is that if you tie it to GND/VDD it doesn't return 0/100.

posted by Erik - 29 Nov 2014
Be the first to answer this question.