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.

ADS1248 Read data problem

Other Parts Discussed in Thread: ADS1248, MSP430F2274

Hello Support,

I ve got some problems to read out the three bytes of the ADS1248 conversion buffer.
To read and write the registers works fine.

If i try to read out the register i get the right output code. But if i read out the conversion results, i allways get three times the same byte value.
I supose that normaly i would get different byte values?!
This causes a resolution of only 2^7 =128.This leads with a reference signal Ref=2.048V  to a readout value of only 0.016V per bit.
It seems i can only read the MSB. (Page 52 Datasheet Figure 75)

MCU= MSP430f2274

To read 3 bytes i programed the following code (readADbuf()):

    unsigned char datab[3];
    volatile long shift;
    int x;

       for(x=0;x<=3;x++){
        while(!(IFG2&UCB0TXIFG))
        UCB0TXBUF=0xFF;            //dummy NOP
        datab[x]=UCB0RXBUF;
        }
       
        shift= ((long)datab[0]<<16)+((long)datab[1]<<8)+((long)datab[2]);

the result of this example is as followed:

datab[0]=0xFE
datab[1]=0xFE
datab[2]=0XFE

If i change the input voltage i always get 3 times the same Hex output.

The SPI clock = 250kHz

To  initialze the system.
I do it as followed (main()):

    P2DIR |= Start+MR;
    P2DIR &= ~0x04;
    P2OUT = Start+MR;  //Start and Reset Pin High
    P3OUT &= ~CS;   // CS LOW

systemCTL(RESET); // sent RESET
systemCTL(SDATAC); // stop reading data continuosly
systemCTL(SYSOCAL);// Offset system calibration

while(1){
    systemCTL(RDATA); //sent SPI command Read Data
    readADbuf(&data); //read AD conversion buffer
    voltconvert(data);
    timer(1500);
  }

i dont know what is going wrong.

 

Best regards

Patrick B.

  • Patrick,

    In your readADbuf() try this sequence instead:

    UCB0TXBUF=0xFF;
     while(!(IFG2&UCB0RXIFG));

    Best regards,

    Bob B

  • Thank you for your reply,

    your advice works.

    But i had a strange problem. It only works with the command RDATAC instead of RDATA.
    Otherwise i get false values. 
    If  i externally set the input to zero and use the command SYSOCAL and start the program i get the right output code. But when i use instead of SYSOCAL  the command SELFOCAL, i get false values. I don't short in this case  the input because the device do it self.

    Did i misunderstood the datasheet?

    Best regards,

    Patrick B.

     

  • Patrick,

    Are there two questions?  You need to run the RDATA command between DRDY pulses or you get invalid data, as new data will be in the process of updating the data register. 

    SELFOCAL does do an internal short when it runs the calibration routine, but if there is any offset due to your system, then that offset will not be taken into account.

    Best regards,

    Bob B