Other Parts Discussed in Thread: CC2500, SIMPLICITI, MSP430F2274
Hello,
I have been trying to interface between the MSP430f2274 MCU and the CC2500 RF chip for some time now and I simply can not make it work. Also, please note I really do not want to use SimpliciTI for various reasons I will not get into. I have tried bitbanging, but that only produces erroneous results. Below I have attached my test code. This code should simply set up the SPI hardware and request that the CC2500 return the part number and several other registers. The problem is it only returns the status byte and then gets stuck. I have read over the documentation for the CC2500, the MSP430, and the board as a whole several times, but I can not find the problem. Any help would be appreciated. Also I am using CCE 3.1 with the usb debugger if it matters.
Thanks,
Ben
#include "msp430x22x4.h" #include "CC2500.h" void main(void) { unsigned char partNum = 0; unsigned char version = 0; unsigned char freq = 0; unsigned char status = 0; unsigned char command = 0; volatile unsigned int i = 0; volatile unsigned int j = 0; WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer P1DIR |= 0x03; // P1.0 output for LED P2DIR |= 0x00; // P2.6,7 are inputs P3SEL |= 0x0E; // P3.1,2,3 USCI_B0 option select P3DIR |= 0x0B; // P3.0 output direction UCB0CTL0 = 0x29; // Phase = 0, Pulse is inactive low, MSB first, 8-bit, Master mode, 3 pin SPI, SPI sync UCB0CTL1 = 0x81; // Use SMCLK and stop the USCI UCB0BR0 = 0x04; // Clock divide low byte UCB0BR1 = 0x00; // Clock divide high byte UCB0CTL1 &= ~UCSWRST; // **Initialize USCI state machine** P1OUT = 0x00; while (1) { partNum = 0; version = 0; freq = 0; status = 0; command = PARTNUM + READ_BURST; // Read the partnum register P3OUT |= 0x01; // Toggle CSn for (i = 0; i < 0xFFFF; i ++); // wait P3OUT &= ~0x01; // for clean reset while (!(IFG2 & UCB0TXIFG)); //Check to see if the send buffer is empty UCB0TXBUF = command; //send the command while (!(IFG2 & UCB0RXIFG)); // USCI_B0 RX buffer ready? status = UCB0RXBUF; // Recieve response while (!(IFG2 & UCB0RXIFG)); partNum = UCB0RXBUF; while (!(IFG2 & UCB0RXIFG)); version = UCB0RXBUF; while (!(IFG2 & UCB0RXIFG)); freq = UCB0RXBUF; P3OUT |= 0x01; // Stop the burst read, disable communication P1OUT |= 0x01; // Turn LED on while (1) ; //Stop for review }
}