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.

CCS/DRV8323: can't get the driver to work

Part Number: DRV8323
Other Parts Discussed in Thread: MSP430FR2355, TIDA-00774, CSD88584Q5DC, TIDA-01516, DRV832X

Tool/software: Code Composer Studio

Hello, I'm using the DRV8323 to drive a brushless motor using sensored 1xPWM mode. I'm using MSP430FR2355 microcontroller to interface via SPI with the driver. 

I'm using drv8323.h and drv8323.c from TIDA-00774 reference design to configure the driver, here is the code I use: 

//DRV8323
    P4DIR &= ~(BIT3);                       //Inputs - FAULT

    P6DIR |= (BIT1);                        //Output - EN_GATE

    P6DIR |= (BIT3);                        //Output - DIR
    P6OUT |= BIT3;

    P6DIR |= BIT4;                          //Output BREAK
    P6OUT |= BIT4;

//code for DRV8323-SPI communication CS:P4.4, SCLK:P4.5, SDI:P4.6, SDO:P4.7
    P4DIR |= BIT6;                          //GPIO-SDI
    P4OUT &= ~BIT6;                         //Output-SDI

    P4DIR &= ~BIT7;                         //Input SDO

    P4DIR |= BIT5;                          //Output SCLK
    P4OUT &= ~BIT5;

    P4DIR |= BIT4;                          //Output nSCS
    P4OUT |= BIT4;

    P4DIR |= BIT2;                          //Output DRV_CAL

// code to enable the driver
    P6OUT &= ~BIT1;
    delay_us(150);
    P6OUT |= BIT1;
    delay_us(10);   //10 us delay

    //P4.2 DRV_CAL
    P4OUT |= BIT1;
    delay_us(150);
    P4OUT &= ~BIT1;
    delay_us(10);   //10 us delay

    //FAULT interrupt
    P4IES |= BIT3;
    P4IE |= BIT3;
    P4IFG &= ~BIT3;

    DRV8x_Analog_Init();

//Code for DRV8x_Analog_Init()

void DRV8x_Analog_Init(void)
{
	SPI_Write(GATE_DRIVE_HS_REG, 0x03BF);
	delay_1ms(1);
	SPI_Write(GATE_DRIVE_HS_REG, 0x03BF);
	delay_1ms(1);
	SPI_Write(ADR_DRV_CTRL_REG, 0x0053);
	delay_1ms(1);
	SPI_Write(GATE_DRIVE_LS_REG, 0x06FF);
	delay_1ms(1);
	SPI_Write(OCP_CTRL_REG, 0x0160); //0x0160
	delay_1ms(1);
	SPI_Write(CSA_CTRL_REG, 0x0083); //0x0683
	delay_1ms(1);
}

// code from drv8323.c

void SPI_Write(uint8_t address, uint16_t value)
{
  uint8_t i;
  uint16_t command = 0x0000;
  address = address & 0x0F;
  value &= 0x07FF;

  command &= ~0x8000;					//write command
  command |= (address << 11U) + value;	//set address and value

  M1_SCLK_LOW;
  __delay_cycles(15);
  M1_nSCS_LOW;
  __delay_cycles(15);

  for (i=0; i<16; i++)
  {
	M1_SCLK_HIGH;
	__delay_cycles(15);

	if (((command >> (15 - i)) & 0x01) == 0x01)
	{
		M1_SDI_HIGH;
	}
	else
	{
		M1_SDI_LOW;
	}
	__delay_cycles(15);
	M1_SCLK_LOW;
	__delay_cycles(30);
  }

  M1_nSCS_HIGH;
  __delay_cycles(15);

}

// some defines
#define M1_SCLK_HIGH	(P4OUT |= BIT5)
#define M1_SCLK_LOW		(P4OUT &= ~BIT5)

#define M1_SDI_HIGH		(P4OUT |= BIT6)
#define M1_SDI_LOW		(P4OUT &= ~BIT6)

#define M1_SDO_LEVEL	((P4IN &= BIT7)?(1):(0))

#define M1_nSCS_HIGH	(P4OUT |= BIT4)
#define M1_nSCS_LOW		(P4OUT &= ~BIT4)

I don't know if there's something wrong in the driver's configuration, I can't make it work. I attach schematics

I'm using csd88584q5dc half-bridge power block, 

I have the PWM signal in INHA pin, I see it with an oscilloscope, also the hall sensor inputs connected to the corresponding pins in schematic. I'm using 24V as VM.

I based my design on TIDA-00774 and TIDA-01516, I'm not an expert in the motor drivers field and I can realize there are lot of concepts and information I don't know,

Is the configuration I'm using ok? Any help would be really appreciated. Thanks in advance.

Diana

  • Hi Diana,

    Thanks for your post.

    Can you confirm if the driver is operating by measuring the following voltages with a multimeter?

    • VM (pin 4) - should be ~24V
    • VDRAIN (pin 5) - should be ~24V
    • VCP (pin 3) - should be ~34V
    • DVDD (pin 33) - should be ~3.3V
    • nFAULT (pin 25) - should be ~3.3V
    • ENABLE (pin 30) - should be ~3.3V
    • INLC (pin 39) - should be ~3.3V

    We should be able to get the driver powered ON and operational before accessing any SPI register configurations. If there is a fault occurring (nFAULT ~0V), can you determine which fault is present by reading the SPI registers?

    When you perform this command SPI_Write(ADR_DRV_CTRL_REG, 0x0053); it looks like you are setting the BRAKE bit (bit 1 of address 2h), this would prevent the driver from operating until this bit is cleared. Make sure to reset this BRAKE bit before trying to spin the motor.

    A SPI interface with 1x PWM mode can be tricky. The DRV8323S will initialize in 6x PWM mode by default and if there are any signals on the inputs the driver will interpret them in 6x PWM mode before can change the PWM mode over SPI to 1x PWM.We would recommend ensuring that all INxx pins are 0 until you can change the PWM mode over SPI. 1x PWM is much easier to do using the hardware interface variant of the device (DRV8323H) since the PWM mode is initialized based on the hardware pins on power-up (rather than from a SPI write).

    Thanks,

    Matt

  • Hello Matt, thanks for your answer.

    I checked the voltages as you asked and these are my results:

    • VM (pin 4) - should be ~24V  (OK)
    • VDRAIN (pin 5) - should be ~24V (OK)
    • VCP (pin 3) - should be ~34V (not OK, I measure 0V)
    • DVDD (pin 33) - should be ~3.3V  (OK)
    • nFAULT (pin 25) - should be ~3.3V (not OK, it's LOW state)
    • ENABLE (pin 30) - should be ~3.3V (OK)
    • INLC (pin 39) - should be ~3.3V (OK)

    Voltage in VCP is 0V, does it mean the driver in broken?

    Thanks!

    Diana

  • Hi Diana,

    It does look like the charge pump is low and the driver is in a fault state. Can you perform a SPI read of addresses 0h and 1h to determine which faults are occurring? I cannot tell if the unit is simply in a fault state or actually damaged.

    Please ensure that Pin 1, 2, & 3 of DRV8323S are properly soldered to the board and your VCP-VM & CPH-CPL capacitors are properly soldered as well.

    You can try replacing the IC with a new DRV8323S to see if the device itself is damaged.

    Fault registers to read:

    Thanks,

    Matt

  • Thanks Matt, I'll try replacing the IC to see if the device is damaged and I'll come back to tell you what I found.

    I have another question, I tried reading the SPI registers 0h and 1h, when I read 1h, I got 0x0 but when I read 0h I got 0x400, that's not a valid value right? 

    Is my reading code ok? I used the code from drv8323.c from TIDA-00774 reference design: 

    uint16_t ReadOnce(uint8_t address)
    {
      uint8_t i;
      uint16_t command = 0x0000;
      uint16_t reading = 0x0000;
      address = address & 0x0F;
    
      command |= 0x8000;			//read command
      command |= address << 11U;	//set address
    
      M1_SCLK_LOW;
      __delay_cycles(10);
      M1_nSCS_LOW;
      __delay_cycles(10);
    
      for (i=0; i<16; i++)
      {
    	M1_SCLK_HIGH;
    
    	if (((command >> (15 - i)) & 0x01) == 0x01)
    	{
    		M1_SDI_HIGH;
    	}
    	else
    	{
    		M1_SDI_LOW;
    	}
    	__delay_cycles(10);
    	M1_SCLK_LOW;
    	reading |= M1_SDO_LEVEL << (15 - i);
    	__delay_cycles(20);
      }
      M1_nSCS_HIGH;
      __delay_cycles(10);
    
      return reading;
    }
    
    uint16_t  SPI_Read (uint8_t address)
    {
    	uint16_t reading;
    
    	reading = ReadOnce(address);	//once
    
    	delay_1us(1);
    
    	reading = ReadOnce(address);	//twice
    
    	return reading;
    }

    Thanks!

  • Hi Diana,

    0x400 should be valid, DRV832x register map is 11 bits long (one entire SPI command is 16 bits). It looks like you are getting the FAULT bit but not any other diagnostic bit set (oddly enough).

    Try asserting CLR_FLT (2h bit 0) to clear the fault condition and re-read registers 0h and 1h.

    Thanks,

    Matt

  • Hello Matt, I changed the DRV8323 IC but now I have this values:

    • VM (pin 4) - should be ~24V  (OK)
    • VDRAIN (pin 5) - should be ~24V (OK)
    • VCP (pin 3) - should be ~34V (not OK, I measure 0V)
    • DVDD (pin 33) - should be ~3.3V  (not OK, I measure 0V)
    • nFAULT (pin 25) - should be ~3.3V (OK)
    • ENABLE (pin 30) - should be ~3.3V (OK)
    • INLC (pin 39) - should be ~3.3V (OK)

    I don't understand why the measured values had changed, but  now it seems the driver is definitively not working :(  Any suggestion?  

    Thanks,

    Diana

  • Hello again Matt, sorry for bombarding you with messages, I wanted to update the last post because now I get these error values: 0x480 in 0h and 0x480 in 1h

    that means I get the under voltage lockout fault condition (0h register) ; overcurrent on phase A sense amplifier and overtemperature warning, right? At least now It seems I get response from the IC, not the kind of answer I would like, but it's a beginning :)

    What would cause the overcurrent? problems in soldering a mosfet?

    Another question, I'm using only current sense amplifier A and I configure all current sense amplifiers in normal operation in CSA control register, is that ok? in hardware the inputs of current amplifiers B and C are shorted and connected to GND.

    Thanks,

    Diana

  • Hi Diana,

    That definitely seems like the driver is not operating (DVDD = 0 means the part is unpowered or in sleep mode)

    Can you make sure that all pads are properly soldered onto the board? Especially the VM, ENABLE, VCP, and DVDD pins. Re-work of the board presents some challenges with remaining solder and the device sitting flat on the board to make contact on all pins. Make sure that you are using a heat source applied to the bottom of the board to reflow the solder under the thermal pad completely.

    When in doubt you should remove the device, use solder wick to remove as much of the solder as possible, and attempt to solder a new part down.

    Thanks,

    Matt

  • Thanks for your answer Matt and your time, I decided to take my time in re-work the board and I think all pads are properly soldered.

    I made a quick test without connecting a BLDC motor and now before configuring the driver with SPI, as soon as I enable the ENABLE pin there's a current of almost 1A  from the 24V source and a kind of sound (but it could be the voltage source too), is that ok?  I think the driver is working now, but maybe that current means there's something wrong, please tell me your opinion about this.

    Thanks,

    Diana

  • Hi Diana,

    Use a DMM to measure the resistance between your power pin and ground pin on the board. it sounds like there is a board short or current path causing the power supply to limit. All of that current needs to be flowing somewhere on the board. You mention that the motor was not connected for this test? You may be able to (carefully) test to see if any component on the board is getting warm to see where the current is flowing.

    As mentioned before, a SPI interface with 1x PWM mode can be tricky because the DRV8323S will initialize in 6x PWM mode. You will need to make sure all PWM inputs are 0 until you can perform a SPI write to change the PWM mode from 6x to 1x. The hardware variant of the device DRV8323H avoids this.

    Thanks,

    Matt

  • Hello again Matt,

    I found the short in the board, it was a soldering problem in a MOSFET, now I can enable the driver without problems of exceeded current flow, but I get a fault code in the 0h SPI register (0x610), that means VDS monitor overcurrent fault condition and on the A low side MOSFET, why would that be happening? 

    Thanks,

    Diana



  • Hi Diana,

    The driver could be initializing and then driving current based on the states of pins 34-39, in this case you could be turning on the low-side of phase A and the high side of another phase. Overcurrent will eventually trip since current will keep flowing in that direction; overcurrent will automatically retry.

    Your VDS level is set very, very low (0.06V): OCP Control Register address 0x05 bits 3-0. You can try to increase this to allow more current to flow.

    Thanks,

    Matt

  • Hello Matt, thanks a lot for your answers, they have been really helpful.

    The motor is spinning now but the 24V power source drops tremendously and it shows more than 2A current, I suppose it drops because the current is limited, but I don't understand why the motor is consuming too much current cause it has no load. Are there other parameters I have to change in order to enhance the performance.

    Thanks,

    Diana

  • Hi Diana,

    First of all, congratulations that your motor is spinning!

    What are you using as a power supply in this case? Could there be a current limit in place on your supply?

    When the motor starts up there will be a higher inrush current due to acceleration.

    If you start with a very low duty cycle on PWM_LEFT (like 10% or below) is the current still high?

    If you assert BREAK_LEFT, does the current decrease when the motor is stopped?

    Thanks,

    Matt

  • Hi Matt,

    I'm using a DC power supply and it limits the current but it should limit only at start up, In my case the voltage drops while the motor is spinning.

    I've run the motor before with another controller and the current was less than 1A using the same DC power supply.

    I'm using a debugger to run the code by steps, when I low the duty cycle of PWM the motor doesn't start, I think the driver tries sometimes and then stops trying. It doesn't spin even with last duty cycle, when it stops the debugging session halts.

    Could something in hardware causing the voltage drop?

    Thanks,

    Diana

  • Hi Diana,

    If you measure the voltage on SOA (i.e. the current through your sense resistor), you should be able to tell if the current is flowing through the motor. If it isn't then there is a separate current path on the board.

    What VDS setting did you choose? You may want to further decrease the VDS setting (but not all the way to 0.06V) so that the DRV8323 limits the motor current internally.

    You can also confirm that the hall sensors are wired in the right orientation. If you swap them the motor may not spin correctly.

    i would also recommend trying to command 100% duty cycle (PWM_LEFT) either from your MCU or externally to see if the motor reaches the target maximum speed.

    Thanks,

    Matt

  • Hello Matt, thanks a lot for your help. 

    You were right about the hall sensors, I tried different combinations and finally found one. I can start motor spinning and stop it without problems and I can change PWM to control the current, now it's about 150mA with a duty cycle of 20%.

    The only problem I have sometimes when I use a PWM of 50% or more, I think current peaks make the microcontroller freeze or halt, I have a linking led on the board and it stops blinking, and I can`t start motor spinning anymore, why would that happen? Is it related to electrolytic capacitors for ripple current? 

    Thanks again

    Diana

  • Hi Diana,

    You may be causing your microcontroler to brown out due to current flow. This will be mostly layout dependent. If your MCU is on the same ground plane as the motor driver and MOSFETs, the current from the motor can flow in such a way that the MCU voltage can dip. Can I see a picture of your board and a schematic of the MCU and MCU supply circuits?

    If you have an oscilloscope, measure the VCC and GND of your MCU while the motor is running, and increase the PWM to 50%.

    Bear in mind a sudden PWM duty cycle change results in a lot of current flowing because of the motor speed changes rapidly.

    Thanks,

    Matt

  • Hello Matt, thank you for your answer.

    I've been reading this guide about layout for DRV8323: https://www.ti.com/lit/an/slva951/slva951.pdf?ts=1610741050016 

  • Hi Diana,

    Also take a look at the general layout guide for motor drivers, there is a video that discusses this document here.

    Thanks,

    Matt

  • Thanks a lot Matt, with all these information I'm sure there won't be problems with my next design!

    Thanks again,

    Diana