Hello,
I have two MSP430 Launchpads worrking as master and slave. The code usa for testing is simple: the master sends one byte and the slave echoes.
The master is sending properly, as I've verified it with the oscilloscope; the slave however sends the bits shifted a random number of bits left or rigth. The problem only happens when the system is working with UCCKPH=1. If not, it works perfectly with both reading and sending properly.
I've checked the errata on the MSP430G2553 and there is a bug related to UCCKPH, but I'm not sure whether it aplies to this, nor do I understand the proposed workaround.
Below is the code for the slave Laucnhpad.
Thanks,
Federico
#include <msp430.h> /* * main.c */ void main(void) { WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer while (!(P1IN & BIT4)); P1SEL = BIT1 + BIT2 + BIT4 + BIT5; P1SEL2 = BIT1 + BIT2 + BIT4 + BIT5; UCA0CTL1 = UCSWRST; UCA0CTL0 |= UCMSB + UCSYNC + UCMODE1 + UCCKPH; UCA0CTL1 &= ~UCSWRST; IE2 |= UCA0RXIE; __bis_SR_register(GIE); while(1); } // Echo character #pragma vector=USCIAB0RX_VECTOR __interrupt void USCI0RX_ISR (void) { while(1) { if(UCA0TXIFG) { UCA0TXBUF = UCA0RXBUF; break; } } }