CC2500不熟悉.
430和CC2500,哪一个是SPI时的MASTER?
430收到CC2500的一个准备好的信号后,发起SPI通讯读CC2500的数据吗?
下面是MSP430F123中SPI MASTER方式中的初始化部份,仅供参考:
void SPI_Init( void )
{
P3SEL |= SIMO + SOMI + UCLK ; ///*1--module function
U0CTL |= SWRST ;
U0CTL = CHAR + //Character length = 8-bits
SYNC + //Synchronous mode ena××e = SPI mode
//MM=0 , USART is sl××e
SWRST ; //Software Reset . When set, the SWRST bit resets the URXIEx, UTXIEx, URXIFGx, OE, and
//FE bits and sets the UTXIFGx flag.
#ifdef SPI_MASTER
U0CTL |= MM ; //MM=1 , USART is master
U0TCTL = SSEL0 + //BRCLK source clock = ACLK (valid for master mode only)
STC ; //Sl××e transmit control.3-pin SPI mode: STE disa××ed.
#else
U0TCTL = STC ; //Sl××e transmit control.3-pin SPI mode: STE disa××ed.
#endif
U0BR0 = 0x002 ; // SPICLK = ACLK/2 , Unpredicta××e SPI operation occurs if UxBR < 2.
U0BR1 = 0x000 ;
U0MCTL = 0x000 ; //The modulation control register is not used for SPI mode
//and should be set to 000h.
ME2 |= USPIE0 ; // Module ena××e
U0CTL &= ( ~SWRST ) ; // SPI ena××e, ready to receive
#ifdef SPI_MASTER
IE2 |= UTXIE0 ; // master transmit interrupt ena××e
#endif
IE2 |= URXIE0 ; // sl××e Receive interrupt ena××e
}