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.

ADS1256evm

Other Parts Discussed in Thread: ADS1256

Hello,

 

I am using the ads1256 evaluation module, and all the analog, serial and power pins are correctly connected. I am trying to read the data on DOUT, unfortunately, the pin DRDY never goes low so the data are never available.

Do you have an idea where the problem could be ?

 

Thank you very much.

 

Hakim Khennouf

  • Hakim,

    Could you let us know your register settings and your command sequence? Otherwise it is hard to decide what is going on.

    Regards,

    Richard

  • Dear Richard,

     

    Thank you for your email.

    Here is my command sequence :

     

    #include "stdio.h"

    #include "stdlib.h"

    #include "unistd.h"

    #include "sys/ioctl.h"

    #include "fcntl.h"

    #include "time.h"

    #include "string.h"

    #include "linux/gpio_syscalls.h"

     

    #define DIN_HI gpiosetbits(PORTG,PG1)      //data in pin, used to command the CAN

    #define DIN_LO gpioclearbits(PORTG,PG1)

     

    #define RST_LO gpioclearbits(PORTG,PG3)//reset

    #define RST_HI gpiosetbits(PORTG,PG3) 

     

    #define SCK_HI gpiosetbits(PORTG,PG2)      //serial clock, used to clock data on DOUT

    #define SCK_LO gpioclearbits(PORTG,PG2)

     

    #define CS_LO gpioclearbits(PORTG,PG4)

    #define DGND gpioclearbits(PORTG,PG5)

     

    #define DOUT gpiogetbits(PORTG,PG8)      //data out pin, from 800000h to 7FFFFFh


    #define DRDY gpiogetbits(PORTG, PG10)      //data ready signal, goes low when the data is available

     


    void SPI_write(unsigned char);

     

    void SPI_init(void)

    {

     

          CS_LO;       //Garder le chip select sur niveau bas

          DGND;

     

          RST_LO;

          sleep(1);

          RST_HI;

     

         

     

          SCK_LO;

          DIN_LO;

     

          SPI_write(0x53);              // 1st command byte : 5=write to register, 3=register Data Rate

         

          SCK_HI;

          SCK_LO;

     

          SPI_write(0x00);             

     

          SCK_HI;

          SCK_LO;

     

          SPI_write(0xB0);              // Data Rate setting : 2,000 SPS (cf p.32)

     

          SCK_HI;

          SCK_LO;

     

          if (DRDY==0)

          {

                SPI_write(0x03);         // Read data continously (cf p.34)  

          }

     

          SCK_HI;

          SCK_LO;

     

    }

     

     

    //Write a byte to the CAN

     

    void SPI_write (unsigned char value)

    {

          int i;

          for (i=7;i>=0;i--)

          {

                if (value&(1<<i))

                {

                      DIN_HI;

                } 

                else

                {

                      DIN_LO;

                }

               

                SCK_HI;

                SCK_LO;

          }

    }

     

     

     

    //Read a byte from the CAN

     

     

     

    static long int Readbyte()

    {

          long int tempbyte;

          int k;

         

          tempbyte=0;

         

          for (k=0x800000; k>0;k/=2)

          {

                SCK_HI;

                if (DRDY==0)

                      tempbyte|=DOUT;

                SCK_LO;

          }

     

          return tempbyte;

     

    }

     

     

     

    int main (int argc, int **argv)

    {

     

    SPI_write(0xAB);

     

    sleep(30);              // Attente de 30 secondes pour être en régime

    // permanent

     

     

    printf("initialisation du CAN en cours...");

     

    SPI_init();

     

    long int result[96001];

    int i;

    FILE* f;

    f=fopen("/tmp/test.txt", "w");

    for (i=0; i<=96000;i++)

    {

    result[i]=Readbyte();

     

         

          fprintf (f, "%d", result[i]);

          fprintf (f, "\n");

               

    }

     

    fclose(f);

     

    printf("fin de la conversion");

     

    return(0);

     

    }

     

  • Hakim,

    The command sequence looks OK, but a couple of suggestions:

    • You might want to issue a SYNC command after setting the data rate
    • And, I would suggest to perform a self-calibration after the SYNC; but this is optional.
    • From your code, I cannot tell if the CS\ of the device stays low during the time the three bytes for the data rate registers are sent. This would be mandatory for proper initialization.

    And, as the command sequence is not the likely cause for the DRDY not been seen, I want you to perform a quick sanity check on the hardware settings in order to further narrow the possible failure causes:

    • Switch S1 in the left position
    • Switch S2 in the left position
    • Switch S3 in the upper position
    • Switch S4 in the left position (XTAL, i.e. use the on-board oscillator and not an external clock)
    • Jumper J4: Besides the 1.8V bridge, all are closed
    • Jumper J5: All open
    • Jumper J6 (SYNC/PDWN) in the left position (DVDD)
    • Jumper J7 (RESET) in the left position (DVDD)
    • Jumper J8 in the upper position (GND)

    Now, if all voltages are applied to the EVM (+5VA on pin 3 of J3, +3.3VD on pin 9 of J3), DRDY should start to toggle with the default sampling frequency of 30kHz (see below). This would prove that the EVM itself is working.

    Regards,

    Richard