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.

DRV8323: 1-PWM mode is not working

Part Number: DRV8323

Hi,

I am having a difficulty to run BLDC motor using 1-PWM mode (using MCU signals).

6-PWM mode is working correctly, so I am probably missing some "initialization algorythm" or something.

I set 20kHz PWM signal on INHA, High state on INLC, Low state on INHC and then I am shiffting between 6 commutation states, but OUTPUT is set low, no metter which state it is.

Could you tell me if there are any conditions that I didn't satisfy or present mi some sample code of using 1-PWM mode.

Thanks in advance,

Igor

  • Igor,

    Please tell us the full part number and which board you are using.

    The part number should be one of these four: DRV8323H/DRV8323RH/DRV8323S/DRV8323RS

    Regards,

    -Adam
  • I am using my own board with DRV8323RS,
    Currently I am just testing some peripherials, so I want simple motor rotation, with fixed commutation frequency (states shift based on time elapsed) and this solution works with 6xPWM mode, but I would like to use 1xPWM mode, so I did:
    Changed Driver Control Register
    Checked Driver Control Register-> (0x50) as intended
    Turned on PWM signal (20kHz, 20% duty) on INHA pin
    Set INHC (nBRAKE) to HIGH
    Set INLC (DIR) to LOW

    And now I start commutation, as in this pseudocode: (PIN, VALUE)

    //stop
    INLA,0
    INHB,0
    INHC,0
    delay(50ms)

    //align
    INLA,1
    INHB,1
    INHC,1
    delay(50ms)

    while(1){
    STATE1
    /*
    INLA,1
    INHB,1
    INHC,0
    */
    delay(50ms)
    STATE2
    /*
    INLA,1
    INHB,0
    INHC,0
    */
    delay(50ms)
    STATE3
    ... and so on
    delay(50ms)
    STATE4
    ...
    delay(50ms)
    STATE5
    ...
    delay(50ms)
    STATE6
    ...
    delay(50ms)
    }

    Problem is, the driver don't response, even for align command, no current flow thru motor, no sound, no rotation.

    All signals are checked on scope and it looks as supposed.
  • Igor,

    You have INHC and INLC definition reversed. INHC is Direction. INLC is Brake which you have ON (LOW).

    Other than this, your commutation table matches Table 4 in the datasheet, this is correct.

    Regards,

    -Adam
  • Hi,

    unfortunately this is not it, I made a typo, sorry for that. Actual code is posted below to avoid further misunderstandings. 

    Problem is somewhere else.

    void v1PWMDrive(void * pvParameters )
    {
        uint16_t temp_DRV8323regDrvCtrl =
            0 << 9  | //DIS_CPUV
            0 << 8  | //DIS_GDF
            0 << 7  | //OTW_REP
            2 << 5  | //PWM_MODE
            1 << 4  | //1PWM_COM
            0 << 3  | //1PWM_DIR
            0 << 2  | //COAST
            0 << 1  | //BRAKE
            0;        //CLR_FLT
        uint16_t temp=0;
        DRV8323_writeSpi(ADR_DRV_CTRL,temp_DRV8323regDrvCtrl);
        temp=DRV8323_readSpi(ADR_DRV_CTRL);
        printf("current_DRV_CTRL: %x\n", temp);
        DRV8323_writeSpi(ADR_DRV_CTRL,temp_DRV8323regDrvCtrl+1);
        temp=DRV8323_readSpi(ADR_FAULT_STAT);
        printf("current_FAULT_STAT: %x\n", temp);
        temp=DRV8323_readSpi(ADR_VGS_STAT);
        printf("current_VGS_STAT: %x\n", temp);
       
        mcpwm_gpio_init(MCPWM_UNIT_0, MCPWM0A, PIN_INHA);
        mcpwm_gpio_init(MCPWM_UNIT_0, MCPWM0B, PIN_INLA);
        mcpwm_gpio_init(MCPWM_UNIT_0, MCPWM1A, PIN_INHB);
        mcpwm_gpio_init(MCPWM_UNIT_0, MCPWM1B, PIN_INLB);
        mcpwm_gpio_init(MCPWM_UNIT_0, MCPWM2A, PIN_INHC);
        mcpwm_gpio_init(MCPWM_UNIT_0, MCPWM2B, PIN_INLC);
    
        mcpwm_config_t pwm_config;
        pwm_config.frequency = 1000;    //frequency = 1000Hz
        pwm_config.cmpr_a = 0.0;   
        pwm_config.cmpr_b = 0.0; 
        pwm_config.counter_mode = MCPWM_UP_COUNTER;
        pwm_config.duty_mode = MCPWM_DUTY_MODE_0;
        mcpwm_init(MCPWM_UNIT_0, MCPWM_TIMER_0, &pwm_config);  
        mcpwm_init(MCPWM_UNIT_0, MCPWM_TIMER_1, &pwm_config); 
        mcpwm_init(MCPWM_UNIT_0, MCPWM_TIMER_2, &pwm_config);    
        
        uint16_t delay=7;
        uint16_t duty=20;
        vTaskDelay(delay);   
    
        mcpwm_set_duty(MCPWM_UNIT_0, MCPWM_TIMER_0, MCPWM_OPR_A, duty);
        mcpwm_set_duty_type(MCPWM_UNIT_0, MCPWM_TIMER_0, MCPWM_OPR_A, MCPWM_DUTY_MODE_0);
    
        mcpwm_set_signal_low(MCPWM_UNIT_0, MCPWM_TIMER_2, MCPWM_OPR_A);    //DIR
        mcpwm_set_signal_high(MCPWM_UNIT_0, MCPWM_TIMER_2, MCPWM_OPR_B);    //nBRAKE
    
        //STOP
        mcpwm_set_signal_low(MCPWM_UNIT_0, MCPWM_TIMER_0, MCPWM_OPR_B);
        mcpwm_set_signal_low(MCPWM_UNIT_0, MCPWM_TIMER_1, MCPWM_OPR_A);
        mcpwm_set_signal_low(MCPWM_UNIT_0, MCPWM_TIMER_1, MCPWM_OPR_B);
        vTaskDelay(delay);
        //Align
        mcpwm_set_signal_high(MCPWM_UNIT_0, MCPWM_TIMER_0, MCPWM_OPR_B);
        mcpwm_set_signal_high(MCPWM_UNIT_0, MCPWM_TIMER_1, MCPWM_OPR_A);
        mcpwm_set_signal_high(MCPWM_UNIT_0, MCPWM_TIMER_1, MCPWM_OPR_B);
        vTaskDelay(1000);
    
       
        while (1) {
            //PHASE 1
            printf("Phase 1 \n");
            mcpwm_set_signal_high(MCPWM_UNIT_0, MCPWM_TIMER_0, MCPWM_OPR_B);
            mcpwm_set_signal_high(MCPWM_UNIT_0, MCPWM_TIMER_1, MCPWM_OPR_A);
            mcpwm_set_signal_low(MCPWM_UNIT_0, MCPWM_TIMER_1, MCPWM_OPR_B);
            vTaskDelay(delay);
    
            //PHASE 2
            printf("Phase 2 \n");
            mcpwm_set_signal_high(MCPWM_UNIT_0, MCPWM_TIMER_0, MCPWM_OPR_B);
            mcpwm_set_signal_low(MCPWM_UNIT_0, MCPWM_TIMER_1, MCPWM_OPR_A);
            mcpwm_set_signal_low(MCPWM_UNIT_0, MCPWM_TIMER_1, MCPWM_OPR_B);
            vTaskDelay(delay);
    
            //PHASE 3
            printf("Phase 3 \n");
            mcpwm_set_signal_high(MCPWM_UNIT_0, MCPWM_TIMER_0, MCPWM_OPR_B);
            mcpwm_set_signal_low(MCPWM_UNIT_0, MCPWM_TIMER_1, MCPWM_OPR_A);
            mcpwm_set_signal_high(MCPWM_UNIT_0, MCPWM_TIMER_1, MCPWM_OPR_B);
            vTaskDelay(delay);
    
            //PHASE 4
            printf("Phase 4 \n");
            mcpwm_set_signal_low(MCPWM_UNIT_0, MCPWM_TIMER_0, MCPWM_OPR_B);
            mcpwm_set_signal_low(MCPWM_UNIT_0, MCPWM_TIMER_1, MCPWM_OPR_A);
            mcpwm_set_signal_high(MCPWM_UNIT_0, MCPWM_TIMER_1, MCPWM_OPR_B);
            vTaskDelay(delay);
    
            //PHASE 5
            printf("Phase 5 \n");
            mcpwm_set_signal_low(MCPWM_UNIT_0, MCPWM_TIMER_0, MCPWM_OPR_B);
            mcpwm_set_signal_high(MCPWM_UNIT_0, MCPWM_TIMER_1, MCPWM_OPR_A);
            mcpwm_set_signal_high(MCPWM_UNIT_0, MCPWM_TIMER_1, MCPWM_OPR_B);
            vTaskDelay(delay);
    
            //PHASE 6
            printf("Phase 6 \n");
            mcpwm_set_signal_low(MCPWM_UNIT_0, MCPWM_TIMER_0, MCPWM_OPR_B);
            mcpwm_set_signal_high(MCPWM_UNIT_0, MCPWM_TIMER_1, MCPWM_OPR_A);
            mcpwm_set_signal_low(MCPWM_UNIT_0, MCPWM_TIMER_1, MCPWM_OPR_B);
            vTaskDelay(delay);
        }
    }

  • Hi, unfortunately I still didn't get any response, is it possible that 1xPWM is dependent on some other register that driver control register.  Fault registers are all clear. Commutation table is as in datasheet, and I don't know where the problem is.

  • Igor,

    Unfortunately I don't know your code language and I haven't made sense of it yet.

    Do you see any current being used by the supply?

    Use a multimeter at the pin of the DRV:
    Is INLC is HIGH?
    Is your ENABLE pin HIGH?

    Use a scope:
    Can you verify the MCU is generating the phase waveforms on the inputs?

    Do you have a hall sensor you can use?

    Regards,

    -Adam
  • Adam, 

    something strange is happening here and I don't realy now what.

    I powered up the system to check it one more time and it worked just fine.

    But now I am doing the same, but it isn't working, although all signals are correct. (INLC, ENABLE high) MCU generates phase waveforms, PWM signal, 

    Do you have any idea, why it works one time, and don't work another time.

    Laboratory conditions are the same, the same DC supply, same motor, same connection, same PCB. DRV8323 has clear fault registers.

    Thanks for reply.

    Igor

  • Igor,

    I was on vacation, sorry for the delay, did this get resolved?

    Regards,

    -Adam