This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430G2553: SPI reading using oscilloscope issue

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);
    }
}

  • Hi,

    Were you able to successfully use SPI to communicate between two MSP430G2553's? Also, I'm not very familiar with analog discovery, but I see that in your MSP430 code you are not using a chip select signal but in your analog discovery screenshot you have a chip select set to active low. Do you think this could be causing the issue?

    Best regards,
    Caleb Overbay
  • Might not be necessary for your actual test scenario, but you toggle P1.0 after each byte without having configured this pin to be an output. Furthermore, if you later want to use it as slave select (SS_PIN), bringing it high right after copying something into the TX buffer will lead to an erroneous transmission. You will have to wait for a complete transfer before deactivating the slave by polling the RX interrupt flag, for example.
  • Hi,

    Have you been able to solve this issue? If so could you post your solution to the forum to help others who may experience the same issue?

    Best regards,
    Caleb Overbay

**Attention** This is a public forum