Other Parts Discussed in Thread: DRV8323, SYSCONFIG
I connected an F280049C Launchpad to a BOOSTXL-DRV8323RS and the SPI communication will not work.
My connections:
I used jumpers to connect the following pins: (only these connections are made -- no others)
| Signal | GPIO | F280049 | pin | DRV8323 | |
| 3.3v | J1-1 | J3-1 | |||
| GND | J3-22 | J3-4 | |||
| ENABLE | GPIO-13 | J1-3 | ENABLE | J3-9 | |
| SCLK | GPIO-22 | J5-47 | SCLK | J3-13 | |
| SIMO | GPIO-30 | J4-33 | SDI | J4-12 | |
| SOMI | GPIO-57 | J2-19 | SDO | J4-14 | |
| STE | GPIO-40 | J1-4 | nSCS | J4-18 |
I tried simple code that did not work and then I copied code from the universal motorcontrol lab example for the F280025 processor which has many more waits and checks but neither works.
The following code was generated by sysconfig:
#define GPIO_PIN_SPIB_SIMO 30
#define GPIO_PIN_SPIB_SOMI 57
#define GPIO_PIN_SPIB_CLK 22
#define ENABLE 13
#define CS_PIN 40
#define mySPI0_BASE SPIB_BASE
#define mySPI0_BITRATE 1000000
#include "board.h"
void Board_init()
{
EALLOW;
PinMux_init();
GPIO_init();
SPI_init();
EDIS;
}
void PinMux_init()
{
//GPIO13 -> ENABLE Pinmux
GPIO_setPinConfig(GPIO_13_GPIO13);
//GPIO40 -> CS_PIN Pinmux
GPIO_setPinConfig(GPIO_40_GPIO40);
//SPIB -> mySPI0 Pinmux
GPIO_setPinConfig(GPIO_30_SPIB_SIMO);
GPIO_setPinConfig(GPIO_57_SPIB_SOMI);
GPIO_setPinConfig(GPIO_22_SPIB_CLK);
}
void GPIO_init(){
//ENABLE initialization
GPIO_setDirectionMode(ENABLE, GPIO_DIR_MODE_OUT);
GPIO_setPadConfig(ENABLE, GPIO_PIN_TYPE_PULLUP);
GPIO_setMasterCore(ENABLE, GPIO_CORE_CPU1);
GPIO_setQualificationMode(ENABLE, GPIO_QUAL_ASYNC);
//CS_PIN initialization
GPIO_setDirectionMode(CS_PIN, GPIO_DIR_MODE_OUT);
GPIO_setPadConfig(CS_PIN, GPIO_PIN_TYPE_PULLUP);
GPIO_setMasterCore(CS_PIN, GPIO_CORE_CPU1);
GPIO_setQualificationMode(CS_PIN, GPIO_QUAL_ASYNC);
}
void SPI_init()
{
//mySPI0 initialization
SPI_disableModule(mySPI0_BASE);
SPI_setConfig(mySPI0_BASE, DEVICE_LSPCLK_FREQ, SPI_PROT_POL0PHA0,
SPI_MODE_MASTER, 1000000, 16);
SPI_disableFIFO(mySPI0_BASE);
SPI_disableLoopback(mySPI0_BASE);
SPI_setEmulationMode(mySPI0_BASE, SPI_EMULATION_STOP_AFTER_TRANSMIT);
SPI_enableModule(mySPI0_BASE);
}I then setup my main code based on the driver lib SPI example:
#define CS_PIN_B 40
#define CS_LOW_B GPIO_writePin(CS_PIN_B, 0)
#define CS_HIGH_B GPIO_writePin(CS_PIN_B, 1)
void main(void)
{
uint16_t sData = 0x8000; // Send data
uint16_t rData = 0; // Receive data
volatile SPI_RxFIFOLevel RxFifoCnt = SPI_FIFO_RXEMPTY;
uint16_t n;
volatile uint16_t WaitTimeOut = 0;
bool rxTimeOut;
//
// Initialize device clock and peripherals
//
Device_init();
//
// Disable pin locks and enable internal pullups.
//
Device_initGPIO();
//
// Initialize PIE and clear PIE registers. Disables CPU interrupts.
//
Interrupt_initModule();
//
// Initialize the PIE vector table with pointers to the shell Interrupt
// Service Routines (ISR).
//
Interrupt_initVectorTable();
//
// Board initialization
//
Board_init();
GPIO_setPadConfig(DEVICE_GPIO_PIN_SPISIMOB,GPIO_PIN_TYPE_PULLUP);
GPIO_setQualificationMode(DEVICE_GPIO_PIN_SPISIMOB,GPIO_QUAL_ASYNC);
GPIO_setPadConfig(DEVICE_GPIO_PIN_SPICLKB,GPIO_PIN_TYPE_PULLUP);
GPIO_setQualificationMode(DEVICE_GPIO_PIN_SPICLKB,GPIO_QUAL_ASYNC);
GPIO_setPadConfig(DEVICE_GPIO_PIN_SPISOMIB,GPIO_PIN_TYPE_PULLUP);
GPIO_setQualificationMode(DEVICE_GPIO_PIN_SPISOMIB,GPIO_QUAL_ASYNC);
// Must put SPI into reset before configuring it
SPI_disableModule(mySPI0_BASE);
// SPI configuration. Use a 500kHz SPICLK and 16-bit word size, 25MHz LSPCLK
SPI_setConfig(mySPI0_BASE, DEVICE_LSPCLK_FREQ, SPI_PROT_POL0PHA0,
SPI_MODE_MASTER, 400000, 16);
SPI_disableLoopback(mySPI0_BASE);
SPI_setEmulationMode(mySPI0_BASE, SPI_EMULATION_FREE_RUN);
SPI_enableFIFO(mySPI0_BASE);
SPI_setTxFifoTransmitDelay(mySPI0_BASE, 0x10);
SPI_clearInterruptStatus(mySPI0_BASE, SPI_INT_TXFF);
// Configuration complete. Enable the module.
SPI_enableModule(mySPI0_BASE);
CS_HIGH_B;
GPIO_writePin(ENABLE, 1);
GPIO_writePin(ENABLE, 1);
DEVICE_DELAY_US(100000L);
//
// Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
//
EINT;
ERTM;
//
// Loop forever. Suspend or place breakpoints to observe the buffers.
//
while(1)
{
CS_LOW_B;
CS_LOW_B;
// wait for registers to update
for(n = 0; n < 0x08; n++)
{
__asm(" NOP");
}
// reset the Rx fifo pointer to zero
SPI_resetRxFIFO(mySPI0_BASE);
SPI_enableFIFO(mySPI0_BASE);
// wait for registers to update
for(n = 0; n < 0x20; n++)
{
__asm(" NOP");
}
// write the command
SPI_writeDataBlockingNonFIFO(mySPI0_BASE, sData);
// wait for two words to populate the RX fifo, or a wait timeout will occur
while(RxFifoCnt < SPI_FIFO_RX1)
{
RxFifoCnt = SPI_getRxFIFOStatus(mySPI0_BASE);
if(++WaitTimeOut > 0xfffe)
{
rxTimeOut = true;
}
}
WaitTimeOut = 0xffff;
// wait for registers to update
for(n = 0; n < 0x200; n++)
{
__asm(" NOP");
}
CS_HIGH_B;
CS_HIGH_B;
// Read the word
rData = SPI_readDataNonBlocking(mySPI0_BASE);
if (sData == 0x8000){
sData = 0xB000;
}else sData = 0x8000;
DEVICE_DELAY_US(500L);
}
}I hooked up a Saleae to the pins and get this from the code. No matter what I try, I ALWAYS get 0000 back on the SDO line. This makes no sense. I tried all different registers and tried a variety of delays and timing changes.

As far as I can tell, the ENABLE is enabled, and the clock and input to the DRV8323 looks correct, but I never get a response. Is there something else I need to do to the chip to get it to listen and respond?
Regards,
Neil







