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.

DRV8301: DRV 8301 SPI write not working

Part Number: DRV8301

I have Arduino Uno and I have developed HTTSOP to DIP(with 2.57mm pitch header) PCB board. I have soldered tiny chip of DRV8301 on this PCB board. I have attached all the peripherals as described in the reference design in the datasheet. I have also connected EN_GATE to 5V and VDD_SUPPLY to 5V pin on Arduino Uno board. I tried just SPI communication with DRV in the beginning as I want to configure it in 3-PWM mode. I think following is register value to be communicated for this, write in 0x02 with value of 0x08 so register becomes like

0x1008 for configuring DRv in 3-pwm mode.

But unfortunately I can only read values and even if I write anything over SPI and then try to read from those values I get default value back i.e

read 0x02 register command is 

0x9000

and response I get is

0x9000

instead of 

0x9008 after written configuration of 3-PWM mode to dRV. 

Please help!!

  • Hi Saraj,

    Please try reading register 0x01 twice and report the result both times. The second read should be correct.

    Please note the SPI read operation described in 7.5.1.1 of the datasheet.

    If you do not read the correct value, please provide scope captures of the first and second read.

  • #include <SPI.h> #define ss digitalWrite(10, LOW); #define nss digitalWrite(10, HIGH); const int chipSelectPin = 10; const int EN_GATE = 8; void setup() { Serial.begin(9600); pinMode(chipSelectPin, OUTPUT); pinMode(EN_GATE, OUTPUT); digitalWrite(EN_GATE, HIGH); digitalWrite(chipSelectPin, LOW); SPI.begin(); // DRV8301 communicates with MSB first and has low clock polarity and data is shifted on rising edge // SPI.beginTransaction(SPISettings(4000000, MSBFIRST, SPI_MODE1)); SPI.setBitOrder(MSBFIRST); SPI.setDataMode(SPI_MODE1); // While Idle SPI CLK = 0, falling Egde latching for Rx } void loop() { readRegister(0x02); delay(5000); } unsigned int readRegister(byte Register ) { uint16_t dataToSend = 0x0000,dataToRead = 0; // bit 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 // R=1/W=0 |-Raddr--| |-----------Data---------------------| // Fault=1/0 |-Raddr--| |-----------Data---------------------| dataToSend |= ( 0x0010 | Register) ; dataToSend <<= 11; Serial.print("Sending read command: "); Serial.println(dataToSend,HEX); ss Serial.println(SPI.transfer16(dataToSend),HEX); Serial.println(SPI.transfer16(dataToSend),HEX); nss } void writeRegister(byte Register, byte Value) { uint16_t dataToSend = 0; // bit 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 // R=1/W=0 |-Raddr--| |-----------Data---------------------| dataToSend |= Register ; dataToSend <<= 11; dataToSend |= Value; Serial.print("Sending write command: "); Serial.println(dataToSend,HEX); ss Serial.println(SPI.transfer16(dataToSend),HEX); //Send value to record into register nss // take the chip select high to de-select: Serial.print("Reading reply for write command: "); Serial.println(dataToSend,HEX); }

    Hi Rick,

           Above is arduino code I'm using to print SPI data received twice. Attached is figure from DSO I observed that there is no signal on MISO pin even after trying for more than half and hour. I measured supply current to DRV8301 it takes about 50mA at 24V when only SPI is powered on. And DRV heats up to 130 C temperature in just 15 minutes. I have not connected any MOSFET circuitry to DRV but rest of the circuitry is same as shown in reference design and it still is heating up a lot.

    In figure, topmost signal is clock, then second is MOSI(from microcontroller) then third is MISO and fourth is slaveSelect.

    What am I missing?

  • Hi Saraj,

    Please refer to post: e2e.ti.com/.../1723924

    This is similar to what you are describing. It is important to ensure nSCS is "framing" the SPI command as described on page 21 of section 7.5.1.1 of the datasheet.

    Also please zoom out to capture both SPI read transactions. One of the reads should have bit D10 set as a 1.