Other Parts Discussed in Thread: ADS1259, CC2500, MSP430F5508
Hi,
I am using the MSP430 in the ez430-RF2500 development kit to communicate with an ADS1259 via SPI.
I am trying to initialize the ADC with the following Code Composer code, but it doesn't seem to work. The MSP430 gets stuck during "while (!(IFG2 & UCB0RXIFG));" as if it can't receive anything.
Notes:
-The SPI is shared with the CC2500 radio, so it has to be disabled first as shown in the code.
-The ADC's SPI CS pin is connected to MSP430's P4.4 GPIO.
-After the communication, the ADC SPI is disabled and the radio SPI is re-enabled.
-I am assuming that "UCB0CTL0 = b10101001" for the ADC.
=======
char junk;
P3OUT |= b00000001; // turn off radio SPI
UCB0CTL1 |= UCSWRST; // set SPI to ADC's SPI protocol
UCB0CTL0 = b10101001;
UCB0CTL1 &= ~UCSWRST;
P4OUT = b11101111; // P4.4 is set low, ADC SPI is on
// stop read data continuous mode
while((IFG2 & UCB0TXIFG) == 0);
UCB0TXBUF = b00010001;
while (!(IFG2 & UCB0RXIFG)); //MSP430 seems to get stuck here
junk = UCB0RXBUF;
// specify address to be CONFIG1
while((IFG2 & UCB0TXIFG) == 0);
UCB0TXBUF = b01000001;
while (!(IFG2 & UCB0RXIFG));
junk = UCB0RXBUF;
// write to only 1 register
while((IFG2 & UCB0TXIFG) == 0);
UCB0TXBUF = b00000000;
while (!(IFG2 & UCB0RXIFG));
junk = UCB0RXBUF;
// write register, set to use internal reference
while((IFG2 & UCB0TXIFG) == 0);
UCB0TXBUF = b00000000;
while (!(IFG2 & UCB0RXIFG));
junk = UCB0RXBUF;
P4OUT = b00010000; // P4.4 is set high, ADC SPI is off
UCB0CTL1 |= UCSWRST; // set SPI to radio's SPI protocol
UCB0CTL0 = b10101001;
UCB0CTL1 &= ~UCSWRST;
P3OUT &= b11111110; // turn on radio SPI
======
Thank you very much for your help!
David
