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.

MSP432E411Y: SPI config problem with code composer

Part Number: MSP432E411Y


hello

I'm have some trouble setting up SPI for an RFID RC522 scanner in code composer studio 10.4, it says that all my code related to UCB0 is undefined, I was trying to use this code I found to try to learn how to setup a 3 pin SPI comm for the RFID.  I'm not sure if its a syntax problem, I'm using a book as reference but it not helping because it uses the same register names   

#include "msp.h"
#include "spi.h"

unsigned char RXData;

unsigned char TXData;

int main(void)

{

  volatile uint32_t i;

   WDT_A->CTL = WDT_A_CTL_PW | WDT_A_CTL_HOLD; // Stop watchdog timer

  P1->SEL0 |= BIT5 | BIT6 | BIT7; // set 3-SPI pin as second function

 __enable_interrupt();

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

  UCB0CTLW0 |= UCSWRST; // **Put state machine in reset**

  UCB0CTLW0 |= UCMST|UCSYNC|UCCKPL|UCMSB; // 3-pin, 8-bit SPI master

  // Clock polarity high, MSB

  UCB0CTLW0 |= UCSSEL__ACLK;            // ACLK

  UCB0BR0 = 0x02; // /2,fBitClock = fBRCLK/(UCBRx+1).

  UCB0BR1 = 0; //

 UCB0IE |= UCRXIE;

  UCB0CTLW0 &= ~UCSWRST; // **Initialize USCI state machine**

  TXData = 0x01; // Holds TX data

  while(1)

  {

    UCB0IE |= UCTXIE; // Enable TX interrupt

   for (i = 2000; i > 0; i--); // Delay before next transmission

   TXData++; // Increment transmit data

   }

}

// SPI interrupt service routine

void eUSCIB0IsrHandler(void)

{

if (UCB0IFG & UCTXIFG)

UCB0TXBUF = TXData; // Transmit characters

UCB0IE &= ~UCTXIE;

while (!(UCB0IFG & UCRXIFG));

RXData = UCB0RXBUF;