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 Dale, Cynthia an all the others knowing about the ADS8694!
I am trying to use the ADS8694 in a custom board controlled by the F28379 Launchpad.
My idea was to use spi, but as I did not have any results, decided to check communication on a brute-force-step-by-setep way, to see if I could solve the problem of knowing if the chip is alive first.
Saddly, I cannot get any reaction from the part and I am wondering if I am not doing some (many) things wrong.
I tested two of them, soldered on two different boards.
From the one, I get nothing. No reaction at all.
From the other, I got only once an answer of ones by every command sent.
Could you please look at the following code I am using, to see if the timing is correct?
I am a bit confuse about the moment the clk signal has to be high at the start of a frame. Should it be high before CS goes low?
Anyway, I have tested both posibilities without success.
Thanks a lot
best regards,
Gustavo
Here is my code. It works in the spi example from C2000 ware
#include "F28x_Project.h"
// Function Prototypes
void delay_loop(void);
void initSerialPins(void);
void ADS8694_CMD(Uint16 a, Uint16 clkCycles);
Uint16 Cmd0,Cmd1,Cmd2,Cmd3,Cmd4,Cmd5;
Uint16 r,i,k;
Uint32 rdataADC;
void main(void)
{
// Initialize GPIO
InitGpio();
// Clear all interrupts and initialize PIE vector table
DINT;
InitPieCtrl();
IER = 0x0000;
IFR = 0x0000;
InitPieVectTable();
initSerialPins(); // This function uses the same pins I want to use for spi
Cmd0 = 0b10000101; // Reset program registers (RST) (1000 0101 00000000)
Cmd1 = 0b11000000; // Manual Channel n Select (MAN_Ch_0) (1100 0000 00000000)
Cmd2 = 0b00000000; // continue with last config (0000 0000 00000000)
Cmd3 = 0b00001010; // READ range channel 0 (0000 101 0 00000000)
Cmd4 = 0b00001011; // WRITE Channel 0 Input Range. I need 0x0110 (0000 101 1 00000000)
Cmd5 = 0b11010011; // 0b1000001011010011 This was for testing in loopback mode if everything comes back as wished
//Uncomment only what is to be sent to the ADC
ADS8694_CMD(Cmd0,33); // Reset program registers (0b10000101)
ADS8694_CMD(Cmd4,23); // WRITE Range Ch0 (MAN_Ch_0) (0b00001011) (dec 11)
ADS8694_CMD(Cmd3,23); // READ Range Ch0 (MAN_Ch_0) (0b00001010) (dec 10)
// ADS8694_CMD(Cmd1,33); // Manual Channel n Select (MAN_Ch_0) (0b11000000)
// ADS8694_CMD(Cmd2,33); // continue with last config (0b00000000)
/* continue to convert forever
for (;;)
{
ADS8694_CMD(Cmd2,33); // now measure channel 0 in loop.
measuringNr ++;
delay_loop();
}
*/
}
// END of main()
void ADS8694_CMD(Uint16 a, Uint16 clkCycles)
{
rdataADC = 0;
GpioDataRegs.GPBSET.bit.GPIO60 = 1; // set clk High to begin swapping with a known position
delay_loop();
GpioDataRegs.GPBCLEAR.bit.GPIO61 = 1; // set CS Low to start transmission
delay_loop();
for(i=0;i<8;i++) //Send CMD 8bit
{
if(a & 0b10000000) // if first character of a is a 1
GpioDataRegs.GPBSET.bit.GPIO58 = 1;
else
GpioDataRegs.GPBCLEAR.bit.GPIO58 = 1;
GpioDataRegs.GPBTOGGLE.bit.GPIO60 = 1; // SCLK LOW - ADC reads bit
delay_loop();
GpioDataRegs.GPBTOGGLE.bit.GPIO60 = 1; // SCLK HIGH
delay_loop();
a = a << 1;
}
r=0;
GpioDataRegs.GPBCLEAR.bit.GPIO58 = 1 ; // Put SPISIMO low for the rest of the time
for(i=8;i<16;i++) //Send the next eight bits = 0
{
GpioDataRegs.GPBTOGGLE.bit.GPIO60 = 1; // SCLK LOW - ADC reads bit
delay_loop();
GpioDataRegs.GPBTOGGLE.bit.GPIO60 = 1; // SCLK HI
delay_loop();
}
// At the 16th falling edge of the SCLK signal, (already happened)
// the MSB of the conversion data is output on the SDO line and can be read by the host processor on the subsequent (17) falling edge of the SCLK signal.
GpioDataRegs.GPBTOGGLE.bit.GPIO60 = 1; // SCLK LOW 17th falling edge (now we can read the MSB of the ADC18
delay_loop();
if(GpioDataRegs.GPBDAT.bit.GPIO59 == 1) //Check SDO 1 or 0 (read MSB of 8 bits ADC config)
rdataADC = 1;
else
rdataADC = 0;
GpioDataRegs.GPBTOGGLE.bit.GPIO60 = 1; // SCLK HI
delay_loop();
for(i=16;i<clkCycles;i++)
{
GpioDataRegs.GPBTOGGLE.bit.GPIO60 = 1; // SCLK LOW
delay_loop();
if(GpioDataRegs.GPBDAT.bit.GPIO59 == 1) //Check SDO 1 or 0
r = 1;
else
r = 0;
rdataADC = rdataADC << 1; // make 8 or 18 bits from received data MSB received first
rdataADC = rdataADC | r; // make 8 or 18 bits from received data MSB received first
GpioDataRegs.GPBTOGGLE.bit.GPIO60 = 1; // SCLK HI
delay_loop();
}
GpioDataRegs.GPBCLEAR.bit.GPIO60 = 1; // set clk low make sure, transmission stops
GpioDataRegs.GPBSET.bit.GPIO61 = 1; // set CS high to end transmission
return;
}
// delay_loop - Function to add delay
//
void delay_loop()
{
long k;
for (k = 0; k < 10000; k++) {}
}
void initSerialPins()
{
EALLOW;
GpioCtrlRegs.GPBGMUX2.bit.GPIO58 = 0; // GPIO58 = GPIO58 (SPISIMOA)
GpioCtrlRegs.GPBGMUX2.bit.GPIO59 = 0; // GPIO59 = GPIO59 (SPISOMIA)
GpioCtrlRegs.GPBGMUX2.bit.GPIO60 = 0; // GPIO60 = GPIO60 (SPICLKA)
GpioCtrlRegs.GPBGMUX2.bit.GPIO61 = 0; // GPIO61 = GPIO61 (SPISTEA)
GpioCtrlRegs.GPBMUX2.bit.GPIO58 = 0; // GPIO58 = GPIO58 (SPISIMOA)
GpioCtrlRegs.GPBMUX2.bit.GPIO59 = 0; // GPIO59 = GPIO59 (SPISOMIA)
GpioCtrlRegs.GPBMUX2.bit.GPIO60 = 0; // GPIO60 = GPIO60 (SPICLKA)
GpioCtrlRegs.GPBMUX2.bit.GPIO61 = 0; // GPIO61 = GPIO61 (SPISTEA)
GpioCtrlRegs.GPBPUD.bit.GPIO58 = 0; // Enable pull-up on GPIO58 (SPISIMOA)
GpioCtrlRegs.GPBPUD.bit.GPIO59 = 0; // Enable pull-up on GPIO59 (SPISOMIA)
GpioCtrlRegs.GPBPUD.bit.GPIO60 = 0; // Enable pull-up on GPIO60 (SPICLKA)
GpioCtrlRegs.GPBPUD.bit.GPIO61 = 0; // Enable pull-up on GPIO61 (SPISTEA)
GpioCtrlRegs.GPBDIR.bit.GPIO58 = 1; // configure GPIO58 as OUTPUT (SPISIMOA)
GpioCtrlRegs.GPBDIR.bit.GPIO59 = 0; // configure GPIO59 as INPUT (SPISOMIA)
GpioCtrlRegs.GPBDIR.bit.GPIO60 = 1; // configure GPIO60 as OUTPUT (SPICLKA)
GpioCtrlRegs.GPBDIR.bit.GPIO61 = 1; // configure GPIO61 as OUTPUT (SPISTEA)
// GPIO111 is used for the Hardware reset of the ADS8694.
//Must be HIGH to activate it
GpioCtrlRegs.GPDGMUX1.bit.GPIO111 = 0; // GPIO111 = GPIO111
GpioCtrlRegs.GPDMUX1.bit.GPIO111 = 0; // GPIO111 = GPIO111
GpioCtrlRegs.GPDDIR.bit.GPIO111 = 1; // configure GPIO111 as OUTPUT
GpioCtrlRegs.GPDPUD.bit.GPIO111 = 0; // Enable pull-up on GPIO111 (RST)
GpioDataRegs.GPDSET.bit.GPIO111 = 1; // Set GPIO111 HIGH !!!! to activate ADS8694
EDIS;
}
Hi Gustavo,
Thanks for your query.
I will look into your code, but screenshots for your digital timing is always better than code, and your schematic is required to check, also please describe how you checked (your analog input voltage, the conversion code your got etc.), all these information will be very helpful to address the issue. Thanks.
By the way, please try to keep the questions about same ADC into same thread on E2E, thanks.
Best regards
Dale
Hi Gustavo,
Thanks for update and I'm glad you have solved the issue, please let me know if you have any further question.
I have share it with you in Box, please check your email.
Best regards
Dale