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.

DRV8311: How I have to set the registers to get a Bldc motor with tspi and internal Pwm-sinals to turn

Part Number: DRV8311

Tool/software:

Hi Experts,

I have a problem with the DRV8311P bldc driver. I'm using the tSPI protocol and it works fine, but I can't get bldc to work so I get 120° phase shifted pwm. I just wanted to know how I have to set the registers to get a Bldc motor with tspi and internal Pwm-sinals to turn. I only get a synchronous pwm at outputs a, b and c.

I did look at all the information provided on the product page. Unfortunately, I still seem to lack some understanding of the matter. 
I’m still not sure how to configure the PWM_State register in order to drive a a BLDC motor. When I look at the outputs (OUTA, OUTB, OUTC) with my current configuration, they are not 120-degree phase shifted but instead synchronized.This, of course, results in the motor not rotating.

Can you give me any specifics tips on how to configure the registers to drive a BLDC motor?

Regards,

Josel

  • Hi Josel, 

    Thank you for your question! 

    Can you help to provide your current register settings? I can help adjust what you already have set to more easily get this process started. 

    Best Regards,

    -Joshua

  • Hi Joshua,

    Of course! Thank you very much for the quick reply and your help.

    I just changed the following registers:

    • 0x17   := 0x0001
    • 0x18   := 0x0800
    • 0x19   := 0x0400
    • 0x1A := 0x0400
    • 0x1B  := 0x0400
    • 0x1D := 0x0400

    Everything else is default.

    The result is a synchronous PWM on A, B, and C.

    Regards,

    Josel

  • Hi Josel, 

    Thank you for the information!  

    With PWM generation mode on, you will need to have in your commutation the appropriate PWMX_STATEs setup as you mentioned in your first post. (see table below)

    What might be happening is the PWM generation is working and the PWM is synchronized between the MCU and driver, but the actual MOSFET states are not being set correctly in a 6-step commutation order (for trapezoidal).

    You will need to set your code so that the hall-states are being read and the state position is updated based on 6-step trapezoidal commutation (see this TI video for trapezoidal commutation methodology: https://www.ti.com/video/6011229676001)

    Please see this example starter code for hall-state configuration from our DRV8311EVM: 

    //Check Hall Sensors
    hall_read = ((GpioDataRegs.GPBDAT.bit.GPIO58 << 2) | (GpioDataRegs.GPADAT.bit.GPIO30 << 1) | (GpioDataRegs.GPBDAT.bit.GPIO40 << 0));
    hall_state = (hall_read^0xF)&0x7;
    if (hall_state)
    {
    switch(hall_state)
    {
    case 1:
    //B-C
    Set_HS0_LS0(&epwm6_info);
    Set_PWM(&epwm5_info, current_duty_cycle);
    Set_HS0_LS1(&epwm3_info);
    break;
    case 2:
    //A-C
    Set_PWM(&epwm6_info, current_duty_cycle);
    Set_HS0_LS1(&epwm5_info);
    Set_HS0_LS0(&epwm3_info);
    break;
    case 3:
    //A-B
    Set_PWM(&epwm6_info, current_duty_cycle);
    Set_HS0_LS0(&epwm5_info);
    Set_HS0_LS1(&epwm3_info);
    break;
    case 4:
    //C-B
    Set_HS0_LS1(&epwm6_info);
    Set_HS0_LS0(&epwm5_info);
    Set_PWM(&epwm3_info, current_duty_cycle);
    break;
    case 5:
    //C-A
    Set_HS0_LS1(&epwm6_info);
    Set_PWM(&epwm5_info, current_duty_cycle);
    Set_HS0_LS0(&epwm3_info);
    break;
    case 6:
    //B-A
    Set_HS0_LS0(&epwm6_info);
    Set_HS0_LS1(&epwm5_info);
    Set_PWM(&epwm3_info, current_duty_cycle);
    break;
    } //end of switch
    } //end of if

    I hope this information is helpful and allows you to move forward.

    Best Regards,

    -Joshua