Dear TI Experts,
I have a problem with configuring four-pin mode here for MSP430G2553 launchpad. I was able to transmit and receive data through UCA0 3-pin SPI channel, but I now need to use 4-pin SPI channel which includes UCA0STE. And when initializing the configuration with UCMODE1=1 ,UCMODE0 =0 (UCA0STE active low), transmission cannot be done and I found UCFE (Frame Error Flag) was set right after initialization. I understand UCFE indicates a bus conflict, but it was set as bit 1 even I did not connect the bus at all. My code was as follow: (Plus, when UCMODE1=0 ,UCMODE0 =1, UCFE remained normal as bit 0. )
void InitSpiBusA0(void)
{
//Pin function select
P1SEL |= BIT1 | BIT2 |BIT4;
P1SEL2 |= BIT1 | BIT2 |BIT4;
UCA0CTL1 |= UCSWRST | UCSSEL_2;
/*UC Reset , SMCLK*/
UCA0CTL0 = UCCKPL|UCMSB|UCMST|UCMODE1|UCSYNC;
/*SPI MODE, MSB first, Master mode, UCxSTE enabled and active low*/
/*SPI bit rate*/
UCA0BR0 = 1;
UCA0BR1 = 0;
/*SPI disable reset*/
UCA0CTL1 &= ~UCSWRST;
}
void SpiBusMasterWrite(uint8_t data)
{
/*Feed Data into Buffer*/
UCA0TXBUF = data;
while(!(IFG2 & UCA0TXIFG));
}
int main(void)
{
WDTCTL = WDTPW | WDTHOLD;
InitSystemClock(); //1MHz
InitSpiBusA0(); // after which UCFE came out
SpiBusMasterWrite(0xAA);
master_receive_data = SpiBusMasterRead();
while(1)
{
__delay_cycles(1000000);
}
return 0;
}
Hope someone can kindly point out. Is there anything else I need to take care of? Thanks.
Regards,
Yuanchen