Part Number: MSP430G2553
Hello TI,
I have an issue with SPI communication between two MSP430G2553 boards.
What I did is that I created a Master version and a Slave one, where I send a byte from the master and receive it in the slave hand and I receive it correctly.
Now the problem is that I wanted to use Analog Discovery to display sent packets (because the next step ill be to replace the slave by a TMS320C5402 DSP), so I only need to verify that the communication is ON, the problem I faced is that in the Analog Discovery (using WaveForms) I don't get the sent byte (0xAA) but I get several different values and I don't if I missed something or what?
And this is the code i'm using
#include <msp430.h>
#include <msp430g2553.h>
/*
* P1.0 -> SS (NOT USED)
* P1.1 -> MISO
* P1.2 -> MOSI
* P1.4 -> CLK
* P1.5 -> STE (NOT USED)
*
*/
#define SS_PIN BIT0
#define MISO_PIN BIT1
#define MOSI_PIN BIT2
#define CLK_PIN BIT4
#define STE_PIN BIT5
void main(void) {
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
BCSCTL1 = CALBC1_1MHZ; // Set DCO to 1MHz
DCOCTL = CALDCO_1MHZ;
P1SEL = MISO_PIN | MOSI_PIN | CLK_PIN; // | STE_PIN;
P1SEL2 = MISO_PIN | MOSI_PIN | CLK_PIN; // | STE_PIN;
UCA0CTL1 = UCSWRST;
UCA0CTL0 |= UCCKPH + UCMSB + UCMST + UCSYNC; // 3-pin, 8-bit SPI master
UCA0CTL1 |= UCSSEL_2; // SMCLK
UCA0BR0 |= 0x02; // /2
UCA0BR1 = 0; //
UCA0MCTL = 0; // No modulation
UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
_BIS_SR(GIE); // Enable interrupts
i=0;
while(1)
{
while (!(IFG2 & UCA0TXIFG)); // USCI_A0 TX buffer ready?
UCA0TXBUF = 0xAA; // Send 0xAA over SPI to Slave
P1OUT ^= BIT0;
__delay_cycles(1000);
}
}