This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

A2d value out by a factor of 3

I have a2d code working on the 28027 for retrieving an anolog input voltage on ADCINA4.  The voltage on the pin is 2.5 volts.

On the 28027 I get a digital value of around 3000.

If I run the same code on the 28034 with 2.5V on ADCIN4 the raw value is out by a factor of 3.  I read a digital value of about 

1000.   Can someone suggest what may be causing this? Our how I might debug why it is different?

  • Hi James,

    For the working F28027 I would measure the exact voltage on the pin using a DMM and then calculate the expected conversion result.  Compare the actual and expected conversion results and compare this error to the DS specifications.  It should certainly be within the ADC gain + offset error, and probably should be well within this because you are operating under nominal supply voltage and temperature conditions.

    Now repeat this with one or more additional voltages on the same pin to ensure that you are indeed measuring the intended pin.

    You should also look at the errata and make sure you are accounting for all ADC errata in your sampling code.

    Now that you have the '02x code working, port it to the '03x.  If you still see the '03x off by quite a bit with a 2.5V input, try a different input voltage.  Does the voltage scale with the input (indicating that there is some issue with the sampling) or does it stay the same (indicating that maybe you aren't sampling the pin you think you are)? 

  • When I ground the pin I get a digital value 0.
    When I tie the pin to 3.3V I get 1836
    Do you have any other suggestions as to why I cannot read the full range?
  • Is the 1836 value pretty consistent run-to-run, or does it vary erratically?
  • Pretty strange then. Are you using internal or external reference mode? In external reference mode you would need to drive almost 5V to get the conversion results to look like this, which I think would probably destroy the device.

    What board are you using for the F2805? Is this a ControlCard or a custom board?
  • Thanks for all your help. I have it working now. The solution was to tie the VREFhi pin to 3.3V and the VREFLO pin to ground. The thing that is confusing is I have the a2ds setup to use and internal reference. I guess the internal reference is really external.