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.

Corrupt data from dout,ads1298

Other Parts Discussed in Thread: ADS1298, ENERGIA

Hello,

I am trying to read the ID of ads1298.

My scope snaps for din + sclk (zoomed(fig 1) and the one showing 3 bursts (fig2) ) and dout + SCLK( fig 3) are shown below.

Please help me with this .

Fig 1

Fig 2

Fig 3 

Any help would be greatly appreciated.

Thanks so much,

Regards,

Harsh

  • Hello Harsh,

    Was this RREG preceded by an SDATAC command?

    Brian
  • Hi Brian,

    Thanks for your reply,

    Yes I did give an sdatac before this command

    My energia code is given below:

    #include <SPI.h>
    
    #define csbar P6_0
    #define resetbar P6_1
    #define start P6_2
    #define drdybar P6_3
    
    // system commands
    #define    WAKEUP  0x02
    #define    STANDBY  0x04
    #define    RESET 0x06
    #define    START 0x08
    #define    STOP 0x0a
    
    // read commands
    #define    RDATAC 0x10
    #define    SDATAC 0x11
    #define    RDATA 0x12
    
    void setup()
    {
      pinMode(csbar,OUTPUT);
      pinMode(resetbar,OUTPUT);
      pinMode(start,OUTPUT);
      pinMode(drdybar,INPUT);
      pinMode(RED_LED,OUTPUT);
      digitalWrite(RED_LED,LOW);
     
      SPI.begin();
      SPI.setDataMode(SPI_MODE1);
      SPI.setBitOrder(MSBFIRST);
      SPI.setClockDivider(SPI_CLOCK_
    DIV32);
     
      Serial.begin(115200);
     
      digitalWrite(resetbar,LOW);
      digitalWrite(start,LOW);
     
      delay(1000);
     
      digitalWrite(start,HIGH);
      digitalWrite(resetbar,HIGH);
      
      delay(1000);
      
      digitalWrite(resetbar,LOW);
     
      delay(150);
     
      digitalWrite(resetbar,HIGH);;
     
      delay(1000);
     
      digitalWrite(csbar,LOW);
      SPI.transfer(SDATAC);
      delayMicroseconds(2);
      digitalWrite(csbar,HIGH);
     
     
      delay(100);
     
     
    }
    
    void regWrite(uint8_t address, uint8_t data)
    {
      uint8_t x=(0x40) | (address);
      uint8_t y=0x00;
      digitalWrite(csbar,LOW);
      SPI.transfer(x);
      SPI.transfer(y);
      SPI.transfer(data);
      delayMicroseconds(2);
      digitalWrite(csbar, HIGH);
    }
    
    uint8_t regRead(uint8_t address)
    {
       uint8_t dump = 0xAA;
       uint8_t x = (0x20) | (address);
       uint8_t y = 0x00;
       digitalWrite(csbar,LOW);
       SPI.transfer(x);
       SPI.transfer(y);
       uint8_t buff = SPI.transfer(dump);
       delayMicroseconds(2);
       digitalWrite(csbar,HIGH);
       return buff;
    }

    void loop() { byte test = regRead(0x00); serial.println(test); }

    Regards,

    Harsh

  • Harsh,

    Are you able to see the DRDY signal toggling at the data rate?

    Brian