ADS124S08: Issues when reading data by RDATA Command

Part Number: ADS124S08

Dear There,

I am using ads124s08 one channel in single-shot mode, and control it with a host PC running LabVIEW Code via COM.

If I Start the LabVIEW Code, ads124s08 with running the following SECTION I and SECTION 2 code: 

SECTION 1: (In Main function)

Set CS to the device low;
Delay for td(CSSC);


Send the RESET command (06h) to make sure the device is properly reset after power-up;
Delay for 4096 · tCLK;


Write the respective register configuration with the WREG command; (set Singe-shot; PGA; Sample Rate; Select One channel AI6+AI7)


Delay for td(SCCS);
Clear CS to high;


Set START/SYNC low;
Delay for a minimum of 24 · tCLK;
Set START/SYNC high;                           //First start ADC single-shot Conversion
Delay for a minimum of 28 · tCLK;
Set START/SYNC low;                            //ADC Conversion Complete, stop it for next conversion

SECTION 2: (In Interrupt Function)

Loop
{
  Wait for DRDY to transition low; (Interrupt)
  Take CS low;
  Delay for td(CSSC);


  Send the RDATA command;


  Send 24 SCLK rising edges to read out conversion data on DOUT/DRDY;


  Delay for td(SCCS);
  Clear CS to high;


  Set START/SYNC high;                                    //start ADC single-shot Conversion again
  Delay for a minimum of 28 · tCLK;
  Set START/SYNC low;                                     //ADC Conversion Complete, stop it for next conversion

                                                                           //Waiting for /DRDY interrupt
}

In this way, ads124s08 will acquire "continuously" in single-shot mode. Then I stop LabVIEW code, which will stop the loop in SECTION 2. Things goes very well up to now.

The issue is, if I restart the LabVIEW Code again, sometimes (perhaps 20% possibility) I can see the fist sample was obviously wrong(and the remaining samples are good). With further research, I found the wrong first sample was EXACTLY the last sample of previous acquisition , like the following graph.

        

Personally I think the problem may come from the internal data-holding register, since I was reading ads124s08 by RDATA Command. It looks like if I stop the loop in SECTION2, and restart SECTION 1, the last sample may be retain in data-holding register, and host LabVIEW will read it again in next acquisition.

My question is ,

1)  Is there a way I can clear the data in data-holding register completely, so that I will never read in future acquisition?

2)  In SECTION I, I DO send a reset COMMAND with 4096*tclk delay, trying to reset ads124s08. But result is not good, since I still can find the wrong first sample.  

3)  And further, from datasheet page 66, "The RESET command resets the digital filter and sets all configuration register values to default settings" . RESET has no effect on the data register?

4)  Of course, if I power off the device hardware and power on again, everything goes well. I never seen the wrong first sample.  But I cannot do that in my real work.

Could you help me with some suggestions about the RDATA Command? Thanks.

  • Hi Jun Liu,

    The description you are giving does not follow the device operation if you are reading the conversion data after the START/SYNC pin has toggled.  If you are reading the same data out twice, then most likely you have not actually started the next conversion which will reset the digital filter clearing the conversion buffer.  So this appears to be a timing issue in your code.  

    The best way to troubleshoot this type of situation is with a logic analyzer and monitoring the SPI communication, START/SYNC and DRDY pins.  Along with the possibility of the conversion register holding the same data, it is also possible that the Labview code is also holding the value and returning it improperly.  You really can't use a debugger in this type of scenario as it is not totally clear which code (firmware or GUI) is at fault.  So instead you need to verify that the communication and timing of the reading of the the conversion data is correct.

    1)  Is there a way I can clear the data in data-holding register completely, so that I will never read in future acquisition?

    The data in the conversion buffer should go to '0' anytime that the digital filter is reset.  This occurs on certain register writes and if the START/SYNC pin is toggled.

    2)  In SECTION I, I DO send a reset COMMAND with 4096*tclk delay, trying to reset ads124s08. But result is not good, since I still can find the wrong first sample.  

    Sending a RESET command should clear everything.  Also, if you write registers such as the MUX, PGA, REF, etc. registers the value should reset.  This is why I suspect there is an issue with the Labview code may be at fault.

    3)  And further, from datasheet page 66, "The RESET command resets the digital filter and sets all configuration register values to default settings" . RESET has no effect on the data register?

    Resetting the digital filter will reset the conversion buffer value that is read using the RDATA command.

    4)  Of course, if I power off the device hardware and power on again, everything goes well. I never seen the wrong first sample.  But I cannot do that in my real work.

    This starts everything in code to a fresh start.  Starting and stopping code in your application does not necessarily clear memory that has already been stored.  If a new conversion has completed, you should get the latest conversion result.  If you are getting '0' or some other data, then you are reading the conversion data before the result is ready.

    Best regards,

    Bob B

  • Thanks Bob for your reply. I will try to debug more details by monitoring the SPI communication, START/SYNC and DRDY pins.

    PS: May I have one more question:

    1) If I plan to read ads124s08 data directly (without RDATA command). What is the difference between "read data direct" and "by RDATA command" in my /DRDY interrupt service code? 

    In my understanding, according to page 16 of datasheet, Read Data Direct (Without an RDATA Command) Timing Requirements , just send 24 SCLKs (without STATUS and CRC) after /DRDY is enough?

    2) What is the meaning of "Read data direct requires that no serial activity occur from the falling edge of DRDY to the read back, or the data are invalid." in section of 9.5.4.1 of datasheet? 

  • Hi Jun Liu,

    1) If I plan to read ads124s08 data directly (without RDATA command). What is the difference between "read data direct" and "by RDATA command" in my /DRDY interrupt service code? 

    In my understanding, according to page 16 of datasheet, Read Data Direct (Without an RDATA Command) Timing Requirements , just send 24 SCLKs (without STATUS and CRC) after /DRDY is enough?

    When the ADC conversion completes, the new conversion result is automatically placed into the output buffer.  The falling edge of DRDY signals that the new conversion result is ready for you to read.  As long as you have completed reading the result before the next conversion result is posted, you should be fine.  The RDATA command allows you to read the data randomly and will block the automatic output of the next conversion data until he RDATA and read of conversion data completes.

    If you do read data direct, you just need to send NOPs for the number of bytes you wish to read.  3 bytes of data to just read the conversion data.  If you use STATUS and CRC you would need to adjust the number of bytes read to match the data to be transmitted.

    2) What is the meaning of "Read data direct requires that no serial activity occur from the falling edge of DRDY to the read back, or the data are invalid." in section of 9.5.4.1 of datasheet? 

    What this means is the data is in the output buffer, so if you try and issue a command or have some activity on SCLK, the conversion data will start to clock out of the device.  So you need to make sure that you clock out the data and capture it by intention.  The SPI is full-duplex, so you can issue WREG command, for example, at the same time as capturing the data.  But if you send out a WREG command (or some other command) without reading the conversion data at the same time, you will lose the conversion data and will need to use the RDATA command in this case.

    Best regards,

    Bob B