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.

BOOST-DRV8711: SPI MISO Not Functioning

Part Number: BOOST-DRV8711
Other Parts Discussed in Thread: DRV8711, MSP432WARE,
I am working to configure the DRV8711 BoosterPack using the SPI register interface on the DRV8711 IC. The MCU I am using is the MSP-EXP432P401R LaunchPad. My code uses the most recent version of MSP432Ware's DriverLib. I use CCS v6.1.
I have been unable to read the registers because the SDO line on the BoosterPack is always logic high. I suspect that the SPI interface on the IC is broken (the SDO pin is perhaps stuck in a high-z state, defaulting to its pull-up value), or I am missing something in my code setup. Below are a couple of screen captures: the first is a write to the CTRL register, and the second is a read from that register. My timing meets the datasheet requirements, and I have tried both clock phase modes with the same results. The SDO line remains high at all times.
For reference, the signals are, from top to bottom, CS, CLK, SDI, and SDO.
Write:
Read:


I am at a loss on this. All of the appropriate pins are configured according to the IC's datasheet and the pinout on the BoosterPack. My code is attached. It starts with a single write to the CTRL register, followed by repeated reads in an endless loop. I have tried this with other registers; all have ended with the same results. What other debugging steps can I try?
main.c
/*
 * -------------------------------------------
 *    MSP432 DriverLib - v3_21_00_05 
 * -------------------------------------------
 *
 * --COPYRIGHT--,BSD,BSD
 * Copyright (c) 2016, Texas Instruments Incorporated
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * *  Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * *  Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * *  Neither the name of Texas Instruments Incorporated nor the names of
 *    its contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 * --/COPYRIGHT--*/
/******************************************************************************
 * MSP432 Empty Project
 *
 * Description: An empty project that uses DriverLib
 *
 *                MSP432P401
 *             ------------------
 *         /|\|                  |
 *          | |                  |
 *          --|RST               |
 *            |                  |
 *            |                  |
 *            |                  |
 *            |                  |
 *            |                  |
 * Author: 
*******************************************************************************/
/* DriverLib Includes */
#include "driverlib.h"

/* Standard Includes */
#include <stdint.h>
#include <stdbool.h>

// My includes
#include "BoosterPackInterface.h"

static uint16_t packet = 0;
static uint8_t txByte = 0;

//void spi_init()
//{
//	SpiaRegs.SPICCR.bit.SPISWRESET = 0; // reset during configuration
//
//	// set configuration control register fields
//	SpiaRegs.SPICCR.bit.SPICHAR = 0xF; // 16-bit transactions
//	SpiaRegs.SPICCR.bit.CLKPOLARITY = 0; // data output on rising edge, input on falling
//	SpiaRegs.SPICCR.bit.SPILBK = 0; // disable loopback
//
//	// set operation control register fields
//	SpiaRegs.SPICTL.bit.CLK_PHASE = 1; // no phase delay for data
//	SpiaRegs.SPICTL.bit.MASTER_SLAVE = 1; // master mode on
//	SpiaRegs.SPICTL.bit.TALK = 1; // enable data output from this master device
//	SpiaRegs.SPICTL.bit.SPIINTENA = 0; // disable SPI interrupt
//
//	// set baud rate via maximum clock division in baud rate register
//	SpiaRegs.SPIBRR =0x007F; // set rate of transmission to slowest possible
//
//	// exit reset state
//	SpiaRegs.SPICCR.bit.SPISWRESET = 1; // done with configuration; clear reset
//
//	// keep CCS from messing with the transmission
//    SpiaRegs.SPIPRI.bit.FREE = 1;                // Set so breakpoints don't disturb xmission
//    SpiaRegs.SPIPRI.bit.STEINV = 1; // active high CS
//    SpiaRegs.SPIPRI.bit.TRIWIRE = 0; // 4-wire SPI
//}

/* SPI Master Configuration Parameter */
const eUSCI_SPI_MasterConfig spiMasterConfig =
{
        EUSCI_B_SPI_CLOCKSOURCE_SMCLK,             // SMCLK Clock Source
        3000000,                                   // SMCLK = DCO = 3MHZ
        50000,                                    // SPICLK = 500khz
        EUSCI_B_SPI_MSB_FIRST,                     // MSB First
		EUSCI_B_SPI_PHASE_DATA_CAPTURED_ONFIRST_CHANGED_ON_NEXT, // other phase option
		//EUSCI_B_SPI_PHASE_DATA_CHANGED_ONFIRST_CAPTURED_ON_NEXT,    // Phase default
        EUSCI_B_SPI_CLOCKPOLARITY_INACTIVITY_LOW, // Low polarity
        EUSCI_B_SPI_3PIN                           // 3Wire SPI Mode
};

int main(void)
{
    /* Halting WDT  */
    WDT_A_holdTimer();

    /* 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);
    // configure CS pin
    GPIO_setAsOutputPin(GPIO_PORT_P3, GPIO_PIN6);

    ////////////////////////////////////////////////////////////////////////////////////////////
    // Configure GPIO
    ////////////////////////////////////////////////////////////////////////////////////////////

    // Port 6.0 is analog input from pot
    GPIO_setAsInputPin(GPIO_PORT_P6, GPIO_PIN0);
    // Ports 3.2, 3.3, 4.1 are inputs (NC)
    GPIO_setAsInputPin(GPIO_PORT_P3, GPIO_PIN2);
    GPIO_setAsInputPin(GPIO_PORT_P3, GPIO_PIN3);
    GPIO_setAsInputPin(GPIO_PORT_P4, GPIO_PIN1);
    // Port 4.3 is nSLEEP output (active low)
    GPIO_setAsOutputPin(GPIO_PORT_P4, GPIO_PIN3);
    // Port 4.6 is RESET output (active high)
    GPIO_setAsOutputPin(GPIO_PORT_P4, GPIO_PIN6);
    // Port 6.5 is STEP output
    GPIO_setAsOutputPin(GPIO_PORT_P6, GPIO_PIN5);
    // Port 6.4 is DIR output
    GPIO_setAsOutputPin(GPIO_PORT_P6, GPIO_PIN4);
    // Port 2.5 is nSTALL input
    GPIO_setAsInputPin(GPIO_PORT_P2, GPIO_PIN5);
    // Port 3.0 is nFAULT input
    GPIO_setAsInputPin(GPIO_PORT_P3, GPIO_PIN0);
    // Port 5.7 is an input (NC)
    GPIO_setAsInputPin(GPIO_PORT_P5, GPIO_PIN7);
    // Port 5.0 is B1 output
    GPIO_setAsOutputPin(GPIO_PORT_P5, GPIO_PIN0);
    // Port 5.2 is B2 output
    GPIO_setAsOutputPin(GPIO_PORT_P5, GPIO_PIN2);

    /////////////////////////////////////////////////////////////////////////////////////////////
    // Initialize GPIO
    /////////////////////////////////////////////////////////////////////////////////////////////
    // drive nSLEEP high (not in sleep mode)
    GPIO_setOutputHighOnPin(GPIO_PORT_P4, GPIO_PIN3);
    // drive RESET low (not in reset)
    GPIO_setOutputLowOnPin(GPIO_PORT_P4, GPIO_PIN6);
    // set STEP output low
    GPIO_setOutputLowOnPin(GPIO_PORT_P6, GPIO_PIN5);
    // set DIR output high
    GPIO_setOutputHighOnPin(GPIO_PORT_P6, GPIO_PIN4);
    // set B1 output low
    GPIO_setOutputLowOnPin(GPIO_PORT_P5, GPIO_PIN0);
    // set B2 output low
    GPIO_setOutputLowOnPin(GPIO_PORT_P5, GPIO_PIN2);


    /* Configuring SPI in 3wire master mode */
    SPI_initMaster(EUSCI_B0_BASE, &spiMasterConfig);

    /* Enable SPI module */
    SPI_enableModule(EUSCI_B0_BASE);

    // write to CTRL reg first
    packet = WRITE | CTRL_ADDR | DEADTIME_850 | SENSE_GAIN_40 | MODE_EIGHTH | ENABLE_MOTOR;

    while(1)
    {
    	GPIO_setOutputLowOnPin(GPIO_PORT_P3, GPIO_PIN6); // reset CS pin
        _delay_cycles(10000);
        /* Polling to see if the TX buffer is ready */
        while (!(SPI_getInterruptStatus(EUSCI_B0_BASE,EUSCI_B_SPI_TRANSMIT_INTERRUPT)));

    	GPIO_setOutputHighOnPin(GPIO_PORT_P3, GPIO_PIN6); // assert CS pin
        /* Transmitting data to slave */
    	txByte = packet >> 8;
        SPI_transmitData(EUSCI_B0_BASE, txByte); // transmit packet[15:8]
        while (!(SPI_getInterruptStatus(EUSCI_B0_BASE,EUSCI_B_SPI_TRANSMIT_INTERRUPT)));
        txByte = packet;
        SPI_transmitData(EUSCI_B0_BASE, txByte); // transmit packet[7:0]
        _delay_cycles(850); // hold CS high
        packet = READ | CTRL_ADDR; // from now on, read from the CTRL register
    }
}
BoosterPackInterface.h
  • Hi Rhett,

    The images did not appear. Would you please re-send them?

    Also please do a search for DRV8711 SPI on the forum. There you will find some post with images that may match.

    e2e.ti.com/.../1503716
    e2e.ti.com/.../1520442
  • Thanks for getting back to me, Rick. Here are the screenshots from the scope:

    ^^SPI Write: Yellow=CS, Orange=Clk, Green=MOSI, Purple=MISO

    ^^SPI Read, same signals

    The key difference between my post and the two links you posted is that I am getting no response whatsoever from the MISO line. I suspect that the pin is faulty on the chip, but I am having the same issue on two different boosterpacks. What debugging steps do you suggest I take? The settings for non-SPI pins are in my code, attached to the original post.

  • Hi Rhett,

    Please separate the MISO signal from the mcu. Add an external pullup and monitor it. If you are having problems with two boosterpacks, the connection to from SDO to the mcu GPIO is suspect.
  • Howdy Rick,

    I separated the MISO connection from the MCU. The boosterpack already has an external 3.3k pullup, so I did not add one of my own. The results were identical, probing at the boosterpack's header interface and on the IC pin itself (pin 17).

    In addition, I verified that the corresponding GPIO pin 1.7 was functional on the MCU. It works correctly in both the input and output modes.

    Are there any other steps I can take?

  • Hi Rhett,

    Do you have access to a MSP-EXP430G2 Launchpad? If so, please try that.

    Also, what is the VM voltage of the DRV8711?
  • I don't have a 430 available, and I need the feature set of the 432 for my project.

    The VM voltage is 12 V.

    I am still encountering the same issue with a brand-new, out of the box MSP432 with fresh BOOST-DRV8711 hardware. Any other ideas?

  • Hi Rhett,

    Please confirm the pin location of the SPI connections between the MSP430 and MSP432.

    It appears there may be a difference on at least one pin (SCS).
  • The SPI pin locations comply with the BOOST-DRV8711 interface. I have reason to believe that the registers are never being written through the SPI interface:

    I attempted to write the enable bit (register 0, bit 0), and I sent pulses on the STEP line. The outputs to the motors remained inactive.

    What is the polarity of SCS? I have it coded as active high, according to the datasheet, but it is worth a sanity check.

  • Were you able to find a resolution to this? I am seeing similar issues but when interfacing the BOOST-DRV8711 with the C2000 based LAUNCHXL-F28377S.

    I am wondering if the issue resides with a mismatch of the logic levels of the uControllers and the DRV8711. Both our controllers are 3V3 logic and I find no-where in DRV8711 documentation to definitively say one way or another but it would appear it is a 5V device based on its VMax=5.5V for all logic pins (at least nothing makes a mention of it running at 3V3 other then the BoosterPack Standard).

    dev.ti.com/.../ this app states "compatibility" when it would be apparent logic levels would disqualify any direct "compatibility"

    Can anyone at TI confirm the ability of the DRV8711 to interface directly with 3V3 devices?
  • Well, I it appears logic levels was not the problem...it works just fine at 3V3. I was able to resolve after looking at timing a bit more closely. implementing the Cock Delay (Clock Phase) was necessary -- As the datasheet refers to it as "Rising Edge with Delay":

    SpiaRegs.SPICCR.bit.CLKPOLARITY = 0;
    SpiaRegs.SPICTL.bit.CLK_PHASE = 1;