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.

ADS1248 resolution

Other Parts Discussed in Thread: ADS1248, ADS1216, ADS1243, ADS1241

Hi Guys,

I am using ADS1248 to read analog data. There is a couple of milivolt drift in my conversion values. Given the high resolution of this chip I was expecting solid values. I can read the 24 bit data registers, look at the last 23 bit and come up with the voltege, yet the number is not very accurate. I wonder if reading data registers immediately after DRDY goes low is OK in the following fasion. 

 

 

// start reading data    

 if (!DRDY0)        

spi.write(RDATAC);    

DATA1reads = spi.write(NOP);              

DATA2reads = spi.write(NOP);                 

 DATA3reads = spi.write(NOP);    

 spi.write(SDATAC);                  // to read other registers than data, stop readining data continously

  V24b = V24b | DATA1reads;               // bit masking to get the 24bit data MSB first    

 V24b = V24b << 16;     

DATA2reads = DATA2reads << 8;   

V24b = V24b + float(DATA2reads);    

 V24b = V24b + float(DATA3reads);    

V24b = V24b >> 1;   // write shift by one bit to get the 23 bit positive input only.    

 Vdec= V24b / 8388608.0 * Vref;         // v = count / 2^23 * Vref    

Vdec = Vdec *  2.0;    

wait(0.0009);               // this delay needed for processing, without it we get erronous converstion.    

 return Vdec;

 

  • Hi Hamid,

    High resolution and precision alone does not guarantee success. As you didn't give any details about the registers settings you are using or the amount of fluctuation in readings that you are seeing it is a little hard to tell if you are just seeing noise or if you have some other issue.

    Most likely you are trying to resolve to some voltage in the nV region.  These are really small measurements.  Air currents, lights, cell phones, etc., all effect the measurement.  If you are using a prototyping system (as opposed to an actual PCB) it will be really hard to achieve the level of performance that you are probably seeking.  If you send me your schematic/layout I may be able to point to some possible issues.

    On to the code snippet.  Is there something missing, such as brackets?  For the 'if' statement at the beginning, what gets executed?  Is it all of the remaining code?  How are you capturning DRDY?  Are you polling the DRDY pin?

    As you are attending to strip out the most significant bit anything that could be close to zero volts differential and could potentially slip negative will appear as a near full-scale reading if you do not properly account for the sign bit.  The output result is binary two's complement.  You cannot just strip the most significant bit.  For example, 0xffffff is a -1 code, but if you strip the msb it becomes 0x7fffff which is positive full scale.

    You must also be careful about making single ended measurements.  As the ADS1248 has an integrated input buffer it cannot accurately represent voltages close to the rails.  There is a common mode input restriction.

    As I only see a snippet of your code I can't tell if you are calling functions, or if your variables are volatile.  You must also make sure that the variable V24b is initialized properly.  You must make sure that the contents is empty  before you '|' any contents.  If there is anything in the variable prior to 'OR' the result will be incorrect.

    If you are trying to get rid of the msb, then your acutal code is wrong.  You should not use a shift, especially right shift as that gets rid of the lsb and not the msb which is the sign bit.  You must make sure you handle negative values appropriately.  Also, the total number of available codes in the positive direction is from 0 to 8388607 so to more accurately represent the value you should alter your equation so that the divisor is 8388607.0.

    You should not need a delay in your code.  I also think there may be a slight misunderstanding as to the use of SDATAC and RDATAC.  The ADS1248 initializes in RDATAC mode.  This means that the result is automatically posted in the output register so that it can be directly read out of the device when DRDY transitions from high to low.  No command is necessary for the contents to be read.  If you issue a SDATAC command, the automatic posting of results to the output register will discontinue after the current conversion completes.  That means it will post one more time.  If you intend to read other register contents, you must make sure you wait for the current conversion cycle to complete before attempting to read data or the read will be corrupted by the automatic posting of the conversion results.

    If you look at your code again, you will see that the issuing of RDATAC and SDATAC really doesn't make much sense.  I would suggest that you try to get things working in SDATAC mode only.  In this case you only need to issue SDATAC once when you first initialize your program.  Then in your code instead of issuing RDATAC, issue RDATA and read out the results.

    One other thing I'm not clear about is why you are multiplying your results by two?  Is this to regain your bit you shifted out?  This is not a good way to handle your data, and the results will always be incorrect if the result is negative.

    Best regards,

    Bob B

  • Hi Bob,

    These are many good points and questions in your e-mail. Let's look into some of the qeustions you asked first before looking at the code.  

    • The input voltages are always positive in this application.
    • The circuit is built on a breadboard at this point.
    • We do initialze V24b to 0 in the funciton I showed partially.
    • The multiplication by 2 was to make up for the missing bit.
    • The readings fluctuate by 3-4 mV.
      • For instace ch1  hooked up to a 0.7 volte source  reads  between. 0.728 - 0.732 V
      • The datasheet says if you don't have bipolar input then the resolution drops to 23bit
      • I removed the sign bit thinking that was the reason for not getting the good resolution, but that didn't help as you pointed out.

    Is there something missing, such as brackets?  For the 'if' statement at the beginning, what gets executed?  Is it all of the remaining code?

    If, true, we just excute the one line in the if statement, but I have added braces for clarity.

      How are you capturning DRDY?  Are you polling the DRDY pin? 

    Yes.

    Please see the function and the schematic that follows, and do let me know what you think.

     

    Regards,

    Hamid

     

     

     

     

     

  • Hi Bob,

    I made more changes in the code based on your feedback and the result improved to some extent (2mV fluctuation now). There is no delay at the end of conversion function. I know this readings can be much more stable tough. The numbers are looking up but I am still trying to get a better understanding of the chip. There are 2 major issues as it is right now.

    • The most significant byte (DATA1reads in my function) is always 0 with this configuration, so I am not fully utilizing the a2d's capacity.
    • The second if statment is not really doing anying. I was just trying to see when the DRDY goes high. The problem is that, when I remove this statment the last 8 bits will be 0 this time and the conversion does not work.

    Thanks again for your feedback.

    Regards,

    Hamid

     

     

     

     

     

     

     

  • Hi Hamid,

    As I mentioned in my earlier post, there is a common mode input restriction that prevents measurements closer that 0.1V from the rails.  As the ADS1248 always measures differentially (the assigned AINP input relative to the AINN) you will have a problems with connecting one of the inputs to ground unless AVSS is below ground.  Please take a look at this information regarding the input restrictions:

    http://e2e.ti.com/support/data_converters/precision_data_converters/w/design_notes/1370.input-voltage-range-requirements-for-the-ads1248-and-ads1148-families.aspx

    Breadboards can be very noisy and can affect your measurement as you will not have a good ground area.  Also, how stable is your input source?

    Regarding your code, I still do not understand why you have the 2 'if' commands.  What is the definition for DRDY0?  Is this where you are doing the polling?  In either case you are trying to read out the data.  Why are you turning on and off RDATAC?  As I said earlier, just turn off RDATAC (in other words use SDATAC mode.)  Even with SDATAC, DRDY will still work and has no dependence on the mode of operation as long as the START pin is high.  SDATAC should be issued early in your program.

    For your function you could do something like:

    while (DRDY0);                                  // wait while DRDY is high and when low read out the data        

    spi.write(RDATA);    

    DATA1reads = spi.write(NOP);              

    DATA2reads = spi.write(NOP);                 

    DATA3reads = spi.write(NOP);    

    V24b = V24b | DATA1reads;               // bit masking to get the 24bit data MSB first    

    V24b = V24b << 16;     

    DATA2reads = DATA2reads << 8;   

    V24b = V24b + float(DATA2reads);    

    V24b = V24b + float(DATA3reads);    

    Vdec= V24b / 8388607.0 * Vref;         // v = count / (2^23 - 1) * Vref    

    return Vdec;

    Best regards,

    Bob B 

     

  •  

    Hi Bob,

    What is the definition for DRDY0? Is this where you are doing the polling?  Yes we are polling DRDY as I mentioned earlier. The schematic also shows, pin 25 (DRTDY) of the A2D  hooked up to an I/O pin. We have called this pin  DRDY0 in the definitions at the top of my code. (The image couldn't capture the entier code.)

    DigitalIn DRDY0(p9);

    The link was very helpful. What A2D chip would you recommend that provides us with high resolution (24bit) and does not need differential input. The voltage range that I normally need to capture is in 0-5 V range. It would be ideal to have 7 or 8 high resolution a2d channels with low response time.

    Thank you again  for your response.

    Kind regards,

    Hamid

  • Hi Hamid,

    We have a couple of different possibilities. Take a look at the ADS1216, ADS1241 and ADS1243.  These devices can turn the input buffer off allowing for 0 to 5V input measurement.

    Best regards,

    Bob B

  • Thank you Bob!

     

    Kind regards,

    Hamid