Good Day!
I have to migrate a old software based on MSP430F148 to MSP430F248. Everything works well but I have a problem with the SPI slave mode.
My old software was:
P5SEL |= 0x0F; // Setup P3 for SPI mode
P5DIR &= ~BIT3;
U1CTL = CHAR + SYNC + SWRST; // 8-bit, SPI, Slave
U1TCTL = 0x00;//CKPL; // Polarity, UCLK, 4-wire
U1BR0 = 0x02; // SPICLK = SMCLK/2
U1BR1 = 0x00;
U1MCTL = 0x00;
ME2 = USPIE1; // Module enable
U1CTL &= ~SWRST; // SPI enable
IE2 |= URXIE1; // Recieve interrupt enable
TXBUF1 = 0xFF;
And my new one is:
P5SEL |= 0x0F; // Setup P3 for SPI mode
P5DIR &= ~BIT3;
UCB1CTL1 |= UCSWRST;
UCB1CTL0 = UCSYNC + UCMSB + UCMODE_2; //4-pin, 8-bit SPI slave
UCB1STAT = 0;
UCB1CTL1 &= ~UCSWRST;
UC1IE |= UCB1RXIE; // Enable USCI1 RX interrupt
UCB1TXBUF = 0xFF;
If my master sends a 0xAA, the slave received always 0xDE and there is an UCOE condition...
I also tried the code example from TI, but the resultat is the same.
The clock frequency is 20kHz? Any idea about my problem?
thank you!