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.

CCS: MSP432P401R SPI Examples

Tool/software: Code Composer Studio

Hello, I want to communicate (SPI) between a MSP432 and an Arduino. I want to send a string with Arduino and receive it with MSP432. I tried examples but it doesn't work. Can someone help me, please?

  • What have you tried?
    How are the arduino and the MSP432 hooked up? Have you tried a scope to see if communication is happening? Have you tried the various arduino SPI modes?
  • To Keith's point, some more information would be helpful. Are you familiar with these examples?

    dev.ti.com/.../

    dev.ti.com/.../

    Regards,
    Chris
  • I am using nRF24L01, one for the MSP432 and another for the Arduino.

  • The code I use in Arduino is:

    #include <nRF24L01.h>
    #include <RF24.h>
    #include <RF24_config.h>
    #include <SPI.h>

    const int pinCE = 9;
    const int pinCSN = 10;

    RF24 radio(pinCE, pinCSN);

    // Single radio pipe address for the 2 nodes to communicate.
    const uint64_t pipe = 0x01;

    char data[16]="Hello World" ;

    void setup(void)
    {
    radio.begin();
    radio.openWritingPipe(pipe);
    }

    void loop(void)
    {
    radio.write(data, sizeof data);
    delay(1000);
    }



    And in MSP432:

    #include "msp.h"
    #include "driverlib.h"

    volatile unsigned int RXData, w;

    void loop_1();

    int main(void)
    {
    WDT_A->CTL = WDT_A_CTL_PW | WDT_A_CTL_HOLD; // stop watchdog timer
    P2->DIR |= BIT0; //P1.0 set as output
    P1->SEL0 |= BIT5|BIT6|BIT7; //Set P1.5, P1.6, and P1.7 as SPI pins functionally

    EUSCI_B0->CTLW0|=EUSCI_B_CTLW0_SWRST; //Put state machine in reset
    EUSCI_B0->CTLW0=EUSCI_B_CTLW0_SWRST; //Keep the state machine in reset
    EUSCI_B_CTLW0_SYNC | EUSCI_A_CTLW0_CKPL | EUSCI_B_CTLW0_MSB;
    //Set as synchronous mode, set clock polarity high and MSB first and Slave

    EUSCI_B0->CTLW0|= EUSCI_B_CTLW0_SSEL__ACLK; //ACLK
    EUSCI_B0->BRW = 0x01;
    EUSCI_B0->CTLW0&=~EUSCI_B_CTLW0_SWRST; //Initialize USCI state machine
    EUSCI_B0->IE |= EUSCI_B_IE_RXIE; //Enable USCI_B0 RX interrupt

    //Remain in LPM on exit from IS
    //SCB->SCR|=SCB_SCR_SLEEPONEXIT_Msk;

    //Ensures SLEEPONEXIT takes effect immediately
    //_DSB();

    //Enable eUSCI_B0 interrupt in NVIC module
    NVIC->ISER[0]=1<<((EUSCIB0_IRQn)&31);

    //Enter LPM0
    //__sleep();
    //__no_operation();

    }

    //SPI interrupt service routine
    void EUSCIB0_IRQHandler(void)
    {
    //Wait till a character is receives
    while(!(EUSCI_B0->IFG & EUSCI_B_IFG_RXIFG));
    RXData = EUSCI_B0->RXBUF;
    if(RXData==0x01)
    {
    P2->OUT ^= BIT0; //XOR P2.0;
    NVIC->ISER[0]=~(1<<((EUSCIB0_IRQn)&31));

    //for (w=200000; w>0; w--); //Delay
    loop_1();
    }
    }
    void loop_1()
    {
    EUSCI_B0->IFG &= ~EUSCI_B_IFG_RXIFG;
    }
  • > EUSCI_B0->CTLW0=EUSCI_B_CTLW0_SWRST; //Keep the state machine in reset
    > EUSCI_B_CTLW0_SYNC | EUSCI_A_CTLW0_CKPL | EUSCI_B_CTLW0_MSB;
    This looks like a typo (I'm surprised you didn't get a warning "has no effect"). I suspect you meant:
    > EUSCI_B0->CTLW0=EUSCI_B_CTLW0_SWRST|EUSCI_B_CTLW0_SYNC | EUSCI_A_CTLW0_CKPL | EUSCI_B_CTLW0_MSB;

    Also: The nRF24L01 is a slave, so the MSP has to be the master. This means:
    1) you need to set EUSCI_B_CTLW0_MST in CTLW0
    2) it won't send anything spontaneously, you have to send something -- at minimum, a register number byte (with a R/W bit) -- in order to get anything from it.
  • It neither doesn't work.
  • I think it 's something wrong in the Arduino code
  • I cannot comment on the Arduino code, but please let us know if you have questions about the device of the SDK examples.

    Regards,
    Chris

**Attention** This is a public forum