0
\$\begingroup\$

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

DRV8908-Q1

and here is the microcontroller (Teensy4.0)

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:

SPI timing

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)

16bit word

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.

\$\endgroup\$
2
  • \$\begingroup\$ (1) Have you done the very basic SPI loopback test to make sure the hardware wires are not broken or connected? (2) I think you can try lower SPI speeds, say 100kHz. \$\endgroup\$
    – tlfong01
    Feb 17, 2021 at 1:02
  • 1
    \$\begingroup\$ @tlfong01 I did test both, neither worked. I have found the solution and posted it below (was an issue with using the 1K dummy load) \$\endgroup\$
    – soup
    Feb 19, 2021 at 20:29

1 Answer 1

1
\$\begingroup\$

After a couple days of diving through the manual, the issue turned out to be with my testing method. According to the manual open load detection (OLD) will trigger if the current drops below a specific level (after a specified amount of time, 4ms max), turning off the chip entirely until re-enabled through the correct register. By default this OLD triggers at currents below (nominally) 9mA, but it could be as high as 18mA. (Figure is from page 17).

OLD ratings

Turns out my 1k dummy load was creating a current of 12mA, right in the grey area, and for my specific chip, this was too low so the chip shut down. The solution was simple, either disable OLD, or use a different dummy load (in my case I used a 100R load with 3W dissipation, stuff gets toasty).

So once again, fairly simple solution, RTFM.

\$\endgroup\$
1
  • \$\begingroup\$ how nice you found a solution. BTW, I have never heard of the "Open load detection circuit". But I did find your DRV8908-Q1 motor driver a bit too advanced for me hobbyist! :). Cheers. \$\endgroup\$
    – tlfong01
    Feb 20, 2021 at 1:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.