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.

DRV8711: Stop the Stepper motor

Part Number: DRV8711

Hi.,

I need the favor from you.

I'm using DRV8711 for my project.My requirement is to stop the stepper motor few seconds in running sequence.(Stall detection)

I'm using 5 positions of stepper motor.In the second position, I added a mechanical stopper to stop the motor. Therefore, I created an interrupt when the mechanical stopper stopped the motor.

void Stepper_GPIOIntHandler (void)
{

GPIOIntClear(GPIO_PORTP_BASE,GPIO_PIN_1);
if(GPIOPinRead(GPIO_PORTP_BASE,GPIO_PIN_1))
{
g_Cal_RSU_SuctionArm_Motor.Stall = 1;
}
else
{

if(STALL_Flag==1)
{

g_Cal_RSU_SuctionArm_Motor.Stall = 0;
Motor_Stop_Sequence();
RSU_STALL_Flag = 0;
}
}

}

when the interrupt came the stepper sequence changed STALL=1(motor running) into STALL=0(motor stop),but i need to stop the stepper after stall=0,i used stop sequence but this is not working.

I need to stop the motor few seconds after that the motor will move to next position.

My stop sequence is

void Motor_Stop_Sequence(void)
{
Stepper_SleepMode_Input_Low;

Stepper_Step_Input_Low;

}

Note:In this above code the motor will freefall . Not moving the next position.Please  suggest how to stop the motor.

Please review my above stop sequence is right? kindly give a solution for after stall 0 to stop the stepper for few seconds after that stepper will go to the next sequence.

Objective:

When the mechanical stopper stops the motor,the stall detection will enable.

Thank you

  • Hey Tom,

    Is your stall detection working within the driver or not?  See 7.3.10.1 Internal Stall Detection.  Did you set EXSTALL bit in the CTRL register to 0?  If you did this then the STALLn pin should turn to a 1 when stall is detected.

    In your stop sequence, you should change the order of those commands or remove the SleepMode command.  If you set nSLEEP low it will disable all the outputs, which I think is what you call freefall.  Instead, don't set nSLEEP low if you want the motor to be held in place.  

    void Motor_Stop_Sequence(void)
    {
        Stepper_Step_Input_Low();
        delay(50); // delay for motor to hold in place
        Stepper_SleepMode_Input_Low; // Put device into SLEEP mode, motor driver circuitry disabled
    }

    Here is a good post about getting stall detection working on the DRV8711:  E2E link

    We also have an app note on DRV8711 Decay Mode Setting Optimization, check your waveforms and see if any adjustments are needed.

    What microstep setting are you using?  The stall detection does not work when operating in full step. There must be a zero current step to measure the Back EMF.  Also there must be enough Back EMF to be measured, and the time at the zero current step must be long enough for the current to reach zero and measure the Back EMF.

    You can also check the SDCNT and SMPLTH settings as mentioned in this post:  https://e2e.ti.com/support/motor-drivers-group/motor-drivers/f/motor-drivers-forum/843041/drv8711-detection-time-of-stall-condition

    Cheers,

    Jacob

  • Thanks jacob,

    Now i got the stop sequence and its working.And my requirement is im giving 200 pulse from home position,but the mechanical stopper stops the motor at 100 pulses. The stall was not detected,and jerk is coming in this stage. The stall will generate at 100 pulse(the mechanical stopper stops the motor).and also avoid jerk.Please help me how to enable stall detection and what parameter i have to tune for this stall detection purpose.

    Control_Register.Address = 0x00;
    Control_Register.ENBL = 0x01;
    Control_Register.RDIR = 0x00;
    Control_Register.RSTEP = 0x00;
    Control_Register.MODE = 0x02;
    Control_Register.EXSTALL = 0x00;
    Control_Register.ISGAIN = 0x01; 
    Control_Register.DTIME = 0x03;


    Torque_Register.Address = 0x01;
    Torque_Register.TORQUE = 0xB4; //current= 3.89amps
    Torque_Register.SAMPLTH = 0x00;
    Torque_Register.Reserved = 0x00;


    Off_Register.Address = 0x02;
    Off_Register.TOFF = 0x30;
    Off_Register.PWMMODE = 0x00;
    Off_Register.Reserved = 0x00;

    Blank_Register.Address = 0x03;
    Blank_Register.TBLANK = 0x08;
    Blank_Register.ABT = 0x01;
    Blank_Register.Reserved = 0x00;

    Decay_Register.Address = 0x04;
    Decay_Register.TDECAY = 0x10;
    Decay_Register.DECMOD = 0x03;
    Decay_Register.Reserved = 0x00;

    Stall_Register.Address = 0x05;
    Stall_Register.SDTHR = 0x80;
    Stall_Register.SDCNT = 0x01;
    Stall_Register.VDIV = 0x00;

    Drive_Register.Address = 0x06;
    Drive_Register.OCPTH = 0x01;
    Drive_Register.OCPDEG = 0x01;
    Drive_Register.TDRIVEN = 0x01;
    Drive_Register.TDRIVEP = 0x01;
    Drive_Register.IDRIVEN = 0x00;
    Drive_Register.IDRIVEP = 0x00;

    Status_Register.Address = 0x07;
    Status_Register.OTS = 0x00;
    Status_Register.AOCP = 0x00;
    Status_Register.BOCP = 0x00;
    Status_Register.APDF = 0x00;
    Status_Register.BPDF = 0x00;
    Status_Register.UVLO = 0x00;
    Status_Register.STD = 0x00;
    Status_Register.STDLAT = 0x00;
    Status_Register.Reserved = 0x00;

    Please check my tuned parameters is right?  what parameter missed  for stall detection.kindly resolve this issue.

    Thank you

  • Hey Tom,

    Try changing your stall threshold (SDTHR) and number of steps before stall is asserted (SDCNT), and VDIV until you have a reliable stall detection as described in section 8.2.2.5 of the datasheet..   These settings vary depending on speed and the motor you are spinning.

    What speed are you running at?  The stall detection is designed to operate at <9000 pps. Above that, it may not work.  

    Finally, you can configure the EXSTALL bit = 1 and scope the associated BEMF pin to see what level you are getting during running and stall conditions.  This is a sanity check to see if the BEMF monitoring is working at all before setting for internal stall.

    Regards,

    Jacob

  • Dear Jacob.,

    My stepper motor speed is 21 rpm. And also i could set the constant value for SDCNT=0x01 and VDIV = 0x00,and i vary SDTHR for checking STALL is occurred or not.


    Stall_Register.SDTHR = 0x75;
    Stall_Register.SDCNT = 0x01;
    Stall_Register.VDIV = 0x00;

    And my question is, can any additional parameters be modified for stall detection, or is it just the ones mentioned above?Please provide a suggestion.

    Thank you

  • Okay 21rpm should be fine, 21 rotations/min * 1min/60sec * 200 steps/rev * 4 pulse/step = 280 pulse per second at 1/4 microstepping, so should be fine. (Per 8.2.2.1 Set Step Rate) 

    Those and SMPLTH (back EMF sample threshold) are the only parameters I see for configuring stall detection, per 7.3.10.1 Internal Stall Detection and 8.2.2.5 Config Stall Detection.  

    Regards,

    Jacob

  • Thank you jacob.,

    i will definitely try this.And i need one more question.

    I created interrupt for stall detection.The stall pin is  GPIO_PORTP_BASE,GPIO_PIN_1. This pin reads 1 the stall is 1(not stall detection).If the pin  reads 0 stall is detected.when i put the break point the interrupt was  not generated.Please check my interrupt sequence is right?

    void GPIOIntHandler (void)
    {

    GPIOIntClear(GPIO_PORTP_BASE,GPIO_PIN_1);
    if(GPIOPinRead(GPIO_PORTP_BASE,GPIO_PIN_1))
    {
    Motor.Stall = 1;
    }
    else
    {

    Motor.Stall = 0;

    SysCtlDelay(100);
    Motor.Stall = 1;


    }

    }

  • Hey Tom, 

    This will be very dependent on your specific microcontroller, I recommend you looking into its examples for interrupt functions.  You can test it out by just manually pulling the pin high/low to see if your interrupt triggers, or hook up an oscilloscope or logic analyzer to see if the stall pin went high when it should.  Make sure you are globally enabling interrupts and setting the priorities and trigger source properly.

    Regards,

    Jacob 

  • Thank you.,

    Kindly share me the any example for stepper pulse calculation(step angle,no of steps,rpm,freq..) and example for all register values(ctrl register to status register).Its very help for my current situation.

    Note:I need example for TIVA with DRV8711(Not msp ex code).

    Please do the needful.

    Thank in advance..

  • Hey Tom,

    Please see section 8.2.2.1 Set Step Rate in the datasheet.  

    For a typical stepper motor with 1.8° per step (200 steps per revolution)

    Speed in Rotations Per Minute (RPM) = #Pulse/Sec * 1.8°/Pulse * 1/microstep * 1rev/360° * 60seconds/1minute

    For example with 6000Pulse/sec, 1/16 microstep = 6000Pulse/1Sec * 1.8°/Pulse * 1/16 * 1/360 * 60 = 112.5 RPM

    Check out these resources:

    For register settings and quick start I recommend looking at the Operating the EVM section of the EVM GUI Users Guide.  

    Regards,

    Jacob