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.

ADS8688 flow chart

Other Parts Discussed in Thread: ADS8688

Hi,

I'm trying to utilize the ADS8688 to measure the analog voltage. 

Could you provide a programming flowchart for using AUTO_RST mode and MAN_Ch_N mode.

Thanks. 

  • Hello,

    Figure76 of the ADS8688 data sheet has the state transition diagram which explains how you can transition between the various device modes including AUTO_RST and MAN-Ch_N modes.

    If you need the exact command words to be programmed, those are available in register maps section 8.5.

    Else, you can share which channels you plan to use along with expected range selection & we will suggest the commands for the same.

    Thanks & Regards,
    Shridhar.
  • Hi,

    I see the state diagram just showing how to switch between modes. I would like see how to make the ADS8688 works from the start. After reading the datasheet, I have the code sequence flow as follow:

    First, 

    1. Sending reset 8500h to command register

    Second, initialize the ADS8688. write to program register with commands

    1. The auto scan seq is left default to scan through all channels .
    2. Channel power down is left default to enable all ADC channels.
    3. Feature select is left default.
    4. Range select for all ADC channels = 0 to 0.25V x Vref
    • Writing to Channel 0. Data  = 0505h. Adding 1 for write to the 8th bit, the data send to SDI is 0B05h

    .

    .

    • Writing to Channel 7. Data  = 0C05h. Adding 1 for write to the 8th bit, the data send to SDI is 1905h

    Third, sending command to command register.

    1.  Following figure 82, page 41 datasheet, sending A000h to the command register for AUTO_RST mode.
    2. sending a dummy bytes (FFFFh) to the SDI in order to receive data from the SDO.
    3. Sending the NO_OP (0000h) to the command register.
    4. Sending a dummy bytes (FFFFh) to the SDI in order to receive ADC conversion data from channel 0.

    Repeat 4 and 5 until channel 7.

    I use 8 bit 8051 MCU to interface with the ADS8688. following is some of the code sequences

    // CS = chip select bit

    // SPI0DAT = SPI buffer

    // SPIF = SPI interupt flag

    // NOP = no operation 

    CS = 0;                              //Enable the slave select

     //Sending command to program register to config the channel 0 range = 0.25V x Vref

    SPI0DAT = 0x0B;           // First byte

    while(SPIF == 0);           //Wait for the transmission complete

    SPIF = 0;                         //Reset the flag

    SPI0DAT = 0x05;           // Second byte

    while(SPIF == 0);           //Wait for the transmission complete

    SPIF = 0;                         //Reset the flag

    // Sending a dummy byte to complete 24 clocks
    SPI0DAT = 0xFF;         
    while (SPIF==0);          //Wait for the transmission complete
    SPIF = 0;                        //Reset the flag

    CS = 1;                           //Deselect CS

    NOP  = 0;                       // Adding few ns delay before activate the slave select

    NOP  = 0;

    CS = 0;                           // Select CS

    // Repeat previous code (different data according to table 15 datasheet) to complete range setting for all channels

    CS = 1;                           // Deselect CS

    // sending command to command register to select AUTO_RST (according to state diagram)

    CS = 0;                           // select CS

    SPI0DAT = 0x85;
    while (SPIF==0);
    SPIF = 0;
    SPI0DAT = 0x00;
    while (SPIF==0);
    SPIF = 0;

    // Sending dummy bytes to complete the 32nd clocks cycle
    SPI0DAT = 0xFF;
    while (SPIF==0);
    SPIF = 0;
    SPI0DAT = 0xFF;
    while (SPIF==0);
    SPIF = 0;

    CS = 1;                           // Deselect CS

    NOP  = 0;                       // Adding few ns delay before activate the slave select

    NOP  = 0;

    // sending command to command register with NO_OP to continue sequence control

    CS = 0;                           // select CS

    SPI0DAT = 0x00; 
    while (SPIF==0); 
    SPIF = 0; 
    SPI0DAT = 0x00; 
    while (SPIF==0); 
    SPIF = 0;

    // Sending dummy bytes to complete the 32nd clocks cycle with interrupt enable to read data at the SDO line

    EIE1 |= 1;                              // Enable SPI interrupt
    SPI0DAT = 0xFF; 
    while (SPIF==0); 
    SPIF = 0; 
    SPI0DAT = 0xFF; 
    while (SPIF==0); 
    SPIF = 0;

    CS = 1;                           // Deselect CS

    //repeat with NO_OP until all the channel ADC count are acquired.

      The data for ADC channels receives  is not right and not consistence. Please advise if you have any recommendation. This is the first time I deal with this ADS8688.

    Thanks.

  • Hello Dong,

    Thanks for sharing the requirement in detail. My understanding of the requirement is as mentioned below.

    1. Power up the device.
    2. Reset the device.
    3. Program the device all channel for input range = 0 to 2.5*Vref
    4. Capture all channel data in Auto RST mode.

    Please find the recommended flow of SPI transactions as mentioned below.

    1. Power up the device.
    2. Once the device is properly powered up, RESET the device registers by sending command 0x8500 on the SDI line.
    3. Program the input channel ranges using following program register commands
    a. Send 0x0B05 on SPI lines (Program Channel 0 for range 0 to 2.5*Vref)
    b. Send 0x0D05 on SPI lines (Program Channel 1 for range 0 to 2.5*Vref)
    c. Send 0x0F05 on SPI lines (Program Channel 2 for range 0 to 2.5*Vref)
    d. Send 0x1105 on SPI lines (Program Channel 3 for range 0 to 2.5*Vref)
    e. Send 0x1305 on SPI lines (Program Channel 4 for range 0 to 2.5*Vref)
    f. Send 0x1505 on SPI lines (Program Channel 5 for range 0 to 2.5*Vref)
    g. Send 0x1705 on SPI lines (Program Channel 6 for range 0 to 2.5*Vref)
    h. Send 0x1905 on SPI lines (Program Channel 7 for range 0 to 2.5*Vref)
    4. Capture data using the AUTO_RST & NO-OP commands
    a. Send 0xA000FFFF on SPI lines (Ignore data on SDO line from 16th clock onwards)
    b. Send 0x0000FFFF on SPI lines ( CH0 data on SDO line from 16th clock onwards)
    c. Send 0x0000FFFF on SPI lines ( CH1 data on SDO line from 16th clock onwards)
    d. Send 0x0000FFFF on SPI lines ( CH2 data on SDO line from 16th clock onwards)
    e. Send 0x0000FFFF on SPI lines ( CH3 data on SDO line from 16th clock onwards)
    f. Send 0x0000FFFF on SPI lines ( CH4 data on SDO line from 16th clock onwards)
    g. Send 0x0000FFFF on SPI lines ( CH5 data on SDO line from 16th clock onwards)
    h. Send 0x0000FFFF on SPI lines ( CH6 data on SDO line from 16th clock onwards)
    i. Send 0x0000FFFF on SPI lines ( CH7 data on SDO line from 16th clock onwards)
    5. If you want to capture the channel data again, repeat steps 4.b to 4.i


    Based on your code, it appears you are programming all channel range programming & then resetting the device registers. That may be the cause for incorrect ADC data. Please check on the same.

    It will be good if you can try a register readback to confirm the SPI transaction are correct.

    Thanks & Regards,
    Shridhar.
  • Hi Shridhar,

    I did try the flow you recommended. The received data on the SDO line does not relevant with the voltage input. I have almost the same data every time I try to read the ADC register but the 16 bit count is way up somewhere, not even near the calculated value. For example, there is 1V at the ADC input, The converted data I receive is 22785 counts instead of 6400 counts. When I increase the input voltage to 2V, the count is drop instead of increase.

    I think the problem I have is similar to another thread "ADS8688 Problem". I monitoring that thread but have not seen any solution yet.

    Also, there is another thread I create "ADS8688 SPI Clock" showing another problem I have when trying to read the content of a register. 

    The MCU always read the last bit on the SDO line with the value of 0. e.g. register 01h if default is equal to FFh. when I try to read it, the data I receive always = FEh (11111110)

  • I finally got it something positive from this ADS8688. However, the received data is shifted left by 1.

    For example, I set the range = 0 to 5.12V. I adjust the ADC input  =  2.084V. The 16 bit count supposed to be equal to 2.084 / 78.125uV = 26675 counts. However, the data I receive is 53350 count.

    Also, I notice that, the receive count = 65534 @ half of full range (2.56V). If I increase the input voltage pass 2.56V, the ADC count start over from 0 and reach 65534 when input voltage reach full range.

    Is there a faster way to get help from TI ? 

  • Hello Dong,

    It appears that the SPI communication mode may not be correct here (as mentioned by Mr. Dale in another post).

    Every data read is shifted left by 1 bit. Once this is addressed, everything should fall in place.

    Thanks & Regards,
    Shridhar.
  • It could be my 8051 board. I have try 2 different C8051F120-DK from Sillicon Labs but the result is the same.
    As the 16th clock goes low, SDO line response almost immediately thus, D15 is read on the MISO and keep going until D0 is read at the 31st clock. At the 32th clock MISO always see 0. Therefore, I have to read 3 bytes and then shift right by 1 to get the full 16 bit data.
  • I think the SPI logic of the ADS8688 has a bug because it samples the SDI line AND clocks data on the SDO line on the same falling edge! Which is not correct SPI behavior.  Correct behavior for CPOL = 0 CPHA=1 according to wikipedia:

    en.wikipedia.org/.../Serial_Peripheral_Interface_Bus

    At CPOL=0 the base value of the clock is zero

    • For CPHA=0, data are captured on the clock's rising edge (low→high transition) and data is output on a falling edge (high→low clock transition).
    • For CPHA=1, data are captured on the clock's falling edge and data is output on a rising edge.

    At CPOL=1 the base value of the clock is one (inversion of CPOL=0)

    • For CPHA=0, data are captured on clock's falling edge and data is output on a rising edge.
    • For CPHA=1, data are captured on clock's rising edge and data is output on a falling edge.

  • Actually, as it turns out it is not true that the ADS8688 clocks out exactly on the falling edge. It holds the signal for another 10ns (minimum) giving the master a chance to sample before clocking out the next bit. There is no bug, just make sure the hold time is long enough for your SPI master.

    Sorry about the false alarm.