Tool/software: Code Composer Studio
Hello,
I am trying to build a SPI connection between the MSP432P401R-Launchpad (Master) and the F28069M-Launchpad (Slave).
The F28069M code works because I used it with the F28379D as Master.
I just want to send a message (sdata = 1).
I don't know if the SPI Master Config is correct.
And is my data transmit correct?
/* DriverLib Includes */ #include <ti/devices/msp432p4xx/driverlib/driverlib.h> /* Standard Includes */ #include <stdint.h> #include <stdbool.h> /* Statics */ static volatile uint8_t RXData = 0; static uint8_t TXData = 0; //![Simple SPI Config] /* SPI Master Configuration Parameter */ const eUSCI_SPI_MasterConfig spiMasterConfig = { EUSCI_B_SPI_CLOCKSOURCE_SMCLK, // SMCLK Clock Source 3000000, // SMCLK = DCO = 3MHZ 500000, // SPICLK = 500khz EUSCI_B_SPI_MSB_FIRST, // MSB First EUSCI_B_SPI_PHASE_DATA_CHANGED_ONFIRST_CAPTURED_ON_NEXT, // Phase EUSCI_B_SPI_CLOCKPOLARITY_INACTIVITY_LOW, // High polarity EUSCI_B_SPI_3PIN // 3Wire SPI Mode }; //![Simple SPI Config] int main(void) { /* Halting WDT */ WDT_A_holdTimer(); //![Simple SPI Example] /* Selecting P1.5 P1.6 and P1.7 in SPI mode */ GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P1, GPIO_PIN5 | GPIO_PIN6 | GPIO_PIN7, GPIO_PRIMARY_MODULE_FUNCTION); /* Configuring SPI in 3wire master mode */ SPI_initMaster(EUSCI_B0_BASE, &spiMasterConfig); /* Enable SPI module */ SPI_enableModule(EUSCI_B0_BASE); TXData = 0x01; while(1) { /* Transmitting data to slave */ SPI_transmitData(EUSCI_B0_BASE, TXData); EUSCI_B0->IE &= ~EUSCI_B__TXIE; } }
and adapted the Baudrate and the Bitword in the F28069M example:
// // spi_init - // void spi_init() { SpibRegs.SPICTL.bit.MASTER_SLAVE = 0; SpibRegs.SPICTL.bit.TALK = 0; //Receiver mode enabled SpibRegs.SPICTL.bit.CLK_PHASE = 0; SpibRegs.SPICTL.bit.SPIINTENA = 1; // Set reset low before configuration changes // Clock polarity (0 == rising, 1 == falling) // 16-bit character // Enable loop-back SpibRegs.SPICCR.bit.SPISWRESET = 1; SpibRegs.SPICCR.bit.CLKPOLARITY = 0; SpibRegs.SPICCR.bit.SPICHAR = (8-1); SpibRegs.SPICCR.bit.SPILBK = 0; SpibRegs.SPIBRR =0x007A; SpibRegs.SPIPRI.bit.FREE = 1; // Set so breakpoints don't disturb }