Hi everybody, I'm working on a small project on the side using the MSP430f5437a.
I an new to MSP430 and have a question about the SPI setup. I'm trying to connect the MSP430 to the NFC shield v1.0 by seedstudio.
I'm having troubles with the connection and might think there is a problem with my setup of the clock. The NFC shield runs at a maximum of 5MHz so I divided the SMCLK(8MHz) by 2 to get 4 MHz, but the oscilloscope shows the same clock signals as the Ethernet at 8MHz. Is there an error in my code for the SPI initialize?
// RF SPI port
#define RF_SIMO BIT6
#define RF_SOMI BIT7
#define RF_SPI_IN P5IN
#define RF_SPI_OUT P5OUT
#define RF_SPI_DIR P5DIR
#define RF_SPI_REN P5REN
#define RF_SPI_SEL P5SEL
#define RF_SCLK BIT6
#define RF_SPI_SCLK_DIR P3DIR
#define RF_SPI_SCLK_SEL P3SEL
void spi_initialize(void) {
// Activate reset state
UCA1CTL1 |= UCSWRST;
// Configure ports
RF_SPI_SEL |= RF_SIMO + RF_SOMI; // Special functions for SPI pins, SIMO, SOMI
RF_SPI_SCLK_SEL |= RF_SCLK; // Special functions for SPI pins, SCLK
RF_SPI_DIR |= RF_SIMO; // Outputs, SIMO
RF_SPI_SCLK_DIR |= RF_SCLK; //Outputs, SCLK
UCA1CTL1 |= UCSSEL_2; // SMCLK (8MHz) clock source
UCA1BR0 = 2; // (8MHz)/2 = 4MHz
UCA1BR1 = 0;
UCA1CTL0 |= UCCKPH + UCMST + UCSYNC;// Clock phase 0, Clock pol 0, 8-bit
UCA1CTL1 &= ~UCSWRST;
}