Hi guys,
I'm using the ADS1231 for a school project that will collect data from a sensor and then send it wirelessly to a phone. The ADS1231 interfaces with the EZ430 RF2560. I have almost everything working except the ADS1231 values are incorrect. They seem to be for the most part negative. When I tested it at my school's lab, I got negative values going to I think -10mV when I inputted a 20mV sine wave at 5 Hz. I don't have access to my school's lab over the weekend and I unfortunately forgot to take pictures at the lab when I was testing, but I know that I was getting an SCLK signal and DRDY/DOUT signal on the oscope.
Now, I'm testing at home so I don't have a function generator or an oscope. I have my Ainn and Ainp connected to nothing so it just reads noise but it seems all the data is negative. Here is my setup at home. I'm using 2 double AA's for my AVDD & DVDD so I'm inputting approximately 3V. This also goes to my Vrefp. I had my MSP430 interfacing with the ADS1231 via SPI with an SCLK freq of 1MHz (I also tried 4 MHz). I've ran my MSP430 through a debugger and I know that it reaches all the correct initializations and I've used LED's as well to verify it. However, I do get a positive value when I place a AAA battery across the Ain's. I get 7FFFFFh and when I flip the polarity of the AAA battery, I get 800000h which corresponds to the given values in the data sheet for the ADS1231: http://focus.ti.com/lit/ds/symlink/ads1231.pdf .
This is the function that's called when DRDY is low (using a polling method to collect data):
void halADCRead(unsigned char *coord)
{
int data3;
UCB0CTL1 |= UCSWRST; // Put I2C state machine in reset to set SA
UCB0CTL1 &= ~UCSWRST; // Start I2C state machine
if(UCB0CTL0 == UCMSB + UCMST + UCSYNC)
P1OUT ^= LED_2;
while (!(UCB0IFG&UCTXIFG)); // USCI_B0 TX buffer ready?
UCB0TXBUF = 0x00; // Dummy write to start SPI
while (!(UCB0IFG&UCRXIFG)); // USCI_B0 TX buffer ready?
*(coord + 0) = UCB0RXBUF; // R15 = 00|MSB
if(UCB0RXBUF < 128)
P1OUT ^= LED_1;
while (!(UCB0IFG&UCTXIFG)); // USCI_B0 TX buffer ready?
UCB0TXBUF = 0x00;
while (!(UCB0IFG&UCRXIFG)); // USCI_B0 TX buffer ready?
*(coord + 1) = UCB0RXBUF;
while (!(UCB0IFG&UCTXIFG)); // USCI_B0 TX buffer ready?
UCB0TXBUF = 0x00;
while (!(UCB0IFG&UCRXIFG)); // USCI_B0 TX buffer ready?
*(coord + 2) = UCB0RXBUF;
UCB0TXBUF = 0x00;
while (!(UCB0IFG&UCRXIFG)); // reading a 4th byte so that the DRDY goes high
data3 = UCB0RXBUF;
}
As you can see, I've used LED's to try and debug this.... LED1 never lights indicating I never get a positive value and LED2 always toggles indicating my SPI is setup correctly. One more thing, my VREFP wire fell off during the middle of my testing and I noticed that my results didn't really change. Does this behavior seem correct?
Other details on how I set up my ADS1231 (besides the ~3v for my AVDD, DVDD, and Vrefp): A cap is placed across DVDD and gnd to prevent noise; a cap is placed across AVDD and gnd to prevent noise. CLKIN is grounded. A cap is placed across the specified CAP pins. PWDN is held high. PSW is connected to nothing (I did try putting ground on this but nothing changed in my results). SCLK is tied to its respective pin on the MSP430. DRDY/DOUT is connected to two pins on the MSP430 (one is selected as the SOMI and the other is just input pin checking whether DRDY is low).
Can someone explain why I'm only getting negative readings? Appreciate any help. I've attached pictures of my ADC readings of noise(so nothing between AINN and AINP) that I streamed from my computer.
