I have designed a board to drive 4 BDC-motors using a DRV8908-Q1 motor driver (datasheet). Here is the schematic of chip with all connections
and here is the microcontroller (Teensy4.0)
The connection for SPI is fairly simple. I am using the hardware SPI pins and pin 10 is the chip select. According to the datasheet (page 19) the SPI signal should look as such:
Which from what I understand is SPI Mode 1 and most significant byte first (MSB). I am running it at 1Mhz to ensure I comply with all the timings. The chip expects a 16 bit word to be sent with the following format (page 59)
where W0 = 0 for write and 1 for read. Ax are the address bits, and Dx are the data bits. Using the register map (page 94) I wrote a script which 'should' set the high side of each H-bridge to continuous mode so that connecting a dummy load between any output and ground produces a high voltage (12V in this case, I am using a 1K resistor for the load so only a few milliamps). I have checked using my scope and the SPI signals are being sent correctly (i.e. the clock and data line up, and I've checked all the timings to make sure they are within spec), however there is never any output from the motor driver.
Here is the test code I wrote:
#include <SPI.h>
#define ss_drv 10 //define slave select for motor driver
void setup() {
//Initialize serial
Serial.begin(57600);
//Initialize SPI (for DRV8908), runs in SPI_mode1
SPI.begin(); //initialize SPI
//SPI.setBitOrder(MSBFIRST);
//SPI.setDataMode(SPI_MODE1);
//SPI.setClockDivider(SPI_CLOCK_DIV128);
pinMode(ss_drv, OUTPUT);
digitalWrite(ss_drv, HIGH); //set the slave select High (default)
delay(100); //give time for everything to settle
}
void loop() {
digitalWrite(ss_drv, LOW); //pull low to start the SPI transfer
SPI.beginTransaction(SPISettings(1000000, MSBFIRST, SPI_MODE1)); //min period 200ns
delayMicroseconds(1); //must be higher than 100ns
SPI.transfer(0b00001000); //select OP_CTRL_1
SPI.transfer(0b10101010); //set all HS enabled
SPI.endTransaction();
delayMicroseconds(1); //must be higher than 100ns
digitalWrite(ss_drv, HIGH); //pull high to indicate end of SPI transfer
delay(1); //must be larger than 600ns
digitalWrite(ss_drv, LOW);
SPI.beginTransaction(SPISettings(1000000, MSBFIRST, SPI_MODE1));
delayMicroseconds(1);
SPI.transfer(0b00001001); //select OP_CTRL_2
SPI.transfer(0b10101010); //set all HS enabled
SPI.endTransaction();
delayMicroseconds(1);
digitalWrite(ss_drv, HIGH);
delay(1);
}
I'm not sure what to do next since as far as I can tell it's not a hardware problem (the chip and passives were selected and laid out according to the reference design), so the issue is likely with how I am sending the data, but afaik I've followed the datasheet to the t.