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.

MSP432E401Y: MSP432E401Y with MAX31855 (Read only Mode 1 SPI Interface)

Part Number: MSP432E401Y

When i used the MSP432P401R launchpad, i only used the P1.5 (SPI CLK), P1.7 (MISO) and P5.0 (SPI CS) to connect to the MAX31855 module. In addition my SPI configuration using driverlib functionality was:

// MAX 31855 implements a read-only Mode 1 SPI (i.e CPOL, CPHA = 0,1)
const eUSCI_SPI_MasterConfig spiMasterConfig =
{
EUSCI_B_SPI_CLOCKSOURCE_SMCLK, // SMCLK Clock Source
48000000, // SMCLK = 48MHz
4000000, // SPICLK = 4Mhz
EUSCI_B_SPI_MSB_FIRST, // MSB First
EUSCI_B_SPI_PHASE_DATA_CAPTURED_ONFIRST_CHANGED_ON_NEXT, // UCCKPH = 1 =>
EUSCI_B_SPI_CLOCKPOLARITY_INACTIVITY_LOW, // UCCKPL = 0

EUSCI_B_SPI_3PIN // 3Wire SPI Mode
};

On the MSP432E401Y launchpad, I will be using SSI3 (PQ0-PQ3)  help needed for the setup and code. The driverlib master example connects a 4 wire master to a 4 wire slave. However in this case

The MAX31855 uses a single line as it's input and output.

For the MSP432E401Y, is there functionality similar  to the 'EUSCI_B_SPI_3PIN // 3Wire SPI Mode'  using only the SPI SCLK, MOSI and SPI SC lines?

Thanks

David Nyarko 

  • David,
    The eUSCI 3-wire mode refers to CLK, MOSI, and MISO and does not include the slave transmit enable (this would be four wire mode). The Chip select as you noted is handled via software on a dedicated IO.

    I am assuming that you are discussing this example:
    dev.ti.com/.../

    I believe that similar functionality can be obtained, however, we currently do not have any examples to show this.

    Chris
  • Hi Chris,
    Thanks. I got it working by using a similar approach to what i used for the MSP432P. Including my code and hope others might find it useful.

    My functions used are:

    void configure_SPI_SSI3(void)
    and
    void MAX31855ReadTemperature(void)

    /*
    *
    * void configure_SPI_SSI3(void)
    *
    * SSI3 used: SCLK = PQ0, MOSI = PQ2 MISO = PQ3
    * GPIO pin PQ1 will be used as CS
    *
    * The only connections to the MAX31855 chip are PQ0, PQ1 and PQ2
    */

    void configure_SPI_SSI3(void)
    {
    uint32_t getSPIResponseData;

    // Enable clocks to GPIO Port Q and configure pins as SSI
    MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOQ);
    while(!(MAP_SysCtlPeripheralReady(SYSCTL_PERIPH_GPIOQ)))
    {
    }

    // Configure pins as SSI
    MAP_GPIOPinConfigure(GPIO_PQ0_SSI3CLK); // CLK
    // MAP_GPIOPinConfigure(GPIO_PQ1_SSI3FSS); // CS
    MAP_GPIOPinConfigure(GPIO_PQ2_SSI3XDAT0); // MOSI
    MAP_GPIOPinConfigure(GPIO_PQ3_SSI3XDAT1); // MISO
    MAP_GPIOPinTypeSSI(GPIO_PORTQ_BASE, (GPIO_PIN_0 | GPIO_PIN_2 | GPIO_PIN_3));


    // Configure the PQ1 as a GPIO output and set high
    MAP_GPIOPinTypeGPIOOutput(GPIO_PORTQ_BASE, GPIO_PIN_1);
    // MAP_GPIOPinWrite(GPIO_PORTQ_BASE, GPIO_PIN_1, GPIO_PIN_1);


    // Enable the clock to SSI-3 module and configure the SSI Master
    MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI3);
    while(!(MAP_SysCtlPeripheralReady(SYSCTL_PERIPH_SSI3)))
    {
    }

    MAP_SSIConfigSetExpClk(SSI3_BASE,
    getSystemClock,
    SSI_FRF_MOTO_MODE_1,
    SSI_MODE_MASTER,
    (getSystemClock/30), // 4Mhz Clock frequency to SSI module, should be >= 2* bit rate (master mode) OR 12*bit rate (slave mode)
    8); // 8-bit data

    MAP_SSIEnable(SSI3_BASE);

    MAP_GPIOPinWrite(GPIO_PORTQ_BASE, GPIO_PIN_1, GPIO_PIN_1);

    /* Flush the Receive FIFO */
    while(MAP_SSIDataGetNonBlocking(SSI3_BASE, &getSPIResponseData));

    }


    /*
    *
    * void MAX31855ReadTemperature(void)
    *
    * Read MAX31855 and store values in struct MAX31855 MAX31855Sensor
    *
    *
    * struct MAX31855 {
    * volatile int16_t thermocouple_temp; // Right-justified for 14-bit result (D31..D18)
    * volatile uint8_t therm_fault; //Just D16 (so 1 bit)
    * volatile int16_t internal_temp; // Right-justified for 12-bit result (D15...D4)
    * volatile uint8_t therm_fault_details; // 3 bits : D2...D0 (SCVcc, SCGnd, OC)
    * volatile int8_t sign; // Indicate if thermocouple temperature is positive or negative
    * };
    *
    * struct MAX31855 MAX31855Sensor;
    *
    */

    void MAX31855ReadTemperature(void)
    {

    uint32_t readresults[4];
    uint8_t count;


    MAP_WatchdogReloadSet(WATCHDOG0_BASE, DEFAULT_WATCHDOG0_MULTIPLIER*getSystemClock);

    // Enable CS
    MAP_GPIOPinWrite(GPIO_PORTQ_BASE, GPIO_PIN_1, 0);
    count = 4;
    while(count != 0)
    {
    count--;
    // Transmitting dummy byte to MAX31855
    MAP_SSIDataPut(SSI3_BASE, 0x00);
    // Wait for the data to be transmitted out of the SSI3 by checking on
    // the busy status from the SSI controller
    while(MAP_SSIBusy(SSI3_BASE));
    // Receive data
    MAP_SSIDataGet(SSI3_BASE, &readresults[count]);

    }

    // Disable CS
    MAP_GPIOPinWrite(GPIO_PORTQ_BASE, GPIO_PIN_1, GPIO_PIN_1);

    //Signed 14-bit temperature is from D31-D18 of overall 32-bit result
    // Read 16-bit values from D31-D16 in readresults[3] and readresults[2] and adjust

    MAX31855Sensor.thermocouple_temp = (int)((((readresults[3]) << 8) | ((readresults[2]) & 0xFC))>> 2); // Retrieve 2's complement 14 MSbits (which includes 2 fractional bits)
    MAX31855Sensor.therm_fault = (readresults[2]) & 0x01; // D16
    MAX31855Sensor.internal_temp = (int)((((readresults[1]) << 8) | ((readresults[0]) & 0xF0))>> 4);
    MAX31855Sensor.therm_fault_details = (readresults[0]) & 0x07;

    if(MAX31855Sensor.thermocouple_temp >= 0 )
    {
    MAX31855Sensor.sign = '+';
    }
    else
    {
    MAX31855Sensor.thermocouple_temp = ~MAX31855Sensor.thermocouple_temp + 1; // Take 2's complement
    MAX31855Sensor.sign = '-';
    }


    }

**Attention** This is a public forum