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.
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.
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,
Second, initialize the ADS8688. write to program register with commands
.
.
Third, sending command to command register.
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.
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 ?
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
At CPOL=1 the base value of the clock is one (inversion of CPOL=0)