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.

DRV8312-69M-KIT: DRV8312-69M-KIT

Part Number: DRV8312-69M-KIT

Hello,


-- >I would like to control my Nema 17 motor ( provided with the DRV8312 kit ) using hall sensors. So for that, I am folowing the 6 buildlevels of BLDC_sensored project explained in the folowing document (sprabz4.pdf) and I do not anderstand wich way I have to take for tuning the PI gains, increasing/decrecreasing the variable "CurrentSet" to adjust the torque command. It is no clear for me. Moreover, the output "speed1.Speed" does not move and is blocked to the value (    -8.163487077 (Q-Value(24) ), and when I put the flag IloopFlag to 1, the speed reaches a really high speed for an unknown reason.

-->Also, in level 6, when I set the flag " EnableFlag" to 1, the motor start spining slowly and then when the flag " SpeedLoopFlag" is hight, the speed goes suddenly at an almost maximum speed. And the "speed1.Speed" output is still the same value than above and does not changes.

-->Also, in the buildlevel 4, I want to rotate the motor clockwise and counterclockwise, what I have done with the code provided with the reference design inverting the sequence of commutation. But the problem is that in clockwise direction, the torque seems to be not enough ( less strong than the counterclockwise sequence). So, when I startup the motor in counterclockwise direction, the motor can easily move the load, whereas when I startup the motor in clockwise direction, the motor can not move the load until I give a manual impulsion.

Finally my last question would be, is it an obligation to follow the labs ( 20 ) from Motorware to use my BLDC_Sensored project ? If yes, wich ones ?

Thank you for reading me, and for paying attention to my questions.

Best regards.




  • 1. You need to change some memory assignment for IQmath in the .cmd file as below if you are using F28069M controlCard with DRV8312-Kit since the original .cmd file is for F28069 in the example project.

    FPUTABLES : origin = 0x3FD590, length = 0x0006A0 /* FPU Tables in Boot ROM */
    IQTABLES : origin = 0x3FDC30, length = 0x000B50 /* IQ Math Tables in Boot ROM */
    IQTABLES2 : origin = 0x3FE780, length = 0x00008C /* IQ Math Tables in Boot ROM */
    IQTABLES3 : origin = 0x3FE80C, length = 0x0000AA /* IQ Math Tables in Boot ROM */

    2. Please make sure the connection orders of hall sensor and motor lines are correct, and you may verify it in build level 4 by setting the "ClosedFlag" to "false" always, to check if the calculated feedback speed and the input of hall sensor are correct.

    3. The build level 4 runs the motor with an open-loop control, just is used to verify hall sensor input and feedback speed, doesn't support bidirection running.

  • First of all, thank you very much for replying me.

       Then, after changing the code in the .cmd file the SPEED_PR module is working well, and the speed1.speed varies and displays the good value.

     

       But, there is still the same problem in the closed loop of level 5 and 6, it seems that the commutation sequence is not good to spin the motor clockwise direction ( counter clockwise goes perfect) . My code regarding the change of direction is below :

     

    //   Connect inputs of the PWM_DRV module and call the PWM signal generation

    //   update macro.

    // ------------------------------------------------------------------------------

       if (ClosedFlag==TRUE)

       {

           if (hall1.CmtnTrigHall==0x7FFF)

           {

     

               PreviousState = pwm1.CmtnPointer;

     

               if ( direction == FALSE){

                   // Comment the following if-else-if statements in case of

                   // inverted Hall logics for commutation states.

                   if (hall1.HallGpioAccepted==5)

                       pwm1.CmtnPointer = 0;

     

                   else if (hall1.HallGpioAccepted==1)

                       pwm1.CmtnPointer = 1;

     

                   else if (hall1.HallGpioAccepted==3)

                       pwm1.CmtnPointer = 2;

     

                   else if (hall1.HallGpioAccepted==2)

                       pwm1.CmtnPointer = 3;

     

                   else if (hall1.HallGpioAccepted==6)

                       pwm1.CmtnPointer = 4;

     

                   else if (hall1.HallGpioAccepted==4)

                       pwm1.CmtnPointer = 5;

               }

               else if ( direction == TRUE){

     

                  // Comment the following if-else-if statements in case of

                   // non-inverted Hall logics for commutation states.

                   if (hall1.HallGpioAccepted==2)

                       pwm1.CmtnPointer = 0;

     

                   else if (hall1.HallGpioAccepted==6)

                       pwm1.CmtnPointer = 1;

     

                   else if (hall1.HallGpioAccepted==4)

                       pwm1.CmtnPointer = 2;

     

                   else if (hall1.HallGpioAccepted==5)

                       pwm1.CmtnPointer = 3;

     

                   else if (hall1.HallGpioAccepted==1)

                       pwm1.CmtnPointer = 4;

     

                   else if (hall1.HallGpioAccepted==3)

                       pwm1.CmtnPointer = 5;

               }

     

           }   // Hall1.CmtnTrigHall == 0x7FFF

       }    // ClosedFlag==TRUE

     

       else

           pwm1.CmtnPointer = (int16)mod1.Counter;

     

    pwm1.DutyFunc = rmp2.Out;

    BLDCPWM_MACRO(pwm1)

     

    // direction == FALSE to spin the motor counter-clockwise, and direction == TRUE to spin the motor in the clockwise direction.

     

    The motor, can spin in both direction but in one of both ( the clockwise direction) , it makes a strange noise (not normal). And in this direction, the SPEED_PR module does not work, and the all the outputs of this module are frozen.

     

    --> ALso, in the buildlevel 6, I can now change the reference value. But the problem is that when I put a speed reference in input ( SpeedRef) as for example 0.5 ( Q-value 24 ). The motor start spining slowly until 0.21, then keeps this constant speed during 3 or 4 seconds and then increase his speed suddenly to the value 0.5.

    (The problem regarding the change of direction is the same here too).

     

    --> Finaly, Do I have to folow the labs 5d, 5e, or 12 ? Is it necessary to tune the PI gains like said in the level 5 ?

     

       Thank you for your patience and your help.

     

       Best regards

  • 1. You need to set the commutation states correctly based on the hall logic for reverse rotation as you showed above since the example project only supports a single direction rotation. And you must change MOD6CNT_MACRO for reverse rotation also.

    2. Yes, you need to tune the PI gains based on your motor if you want to achieve a good performance as well.

  • Thank your for replying me. What are the labs that I have to follow particularly for tuning the PI gains of the BLDC project ?
    Also, I've ever done what you've said about the changes on the MOD6CNT_MACRO and the change of the code for the commutation states. The motor can spin in the other direction but I need to give a manual impulsion to create start torque and finally the motor start running. The problem is that the motor makes a lot of sound in this new direction, what is not in the other direction. It seems to be not normal... Do you have an idea of the reason for this problem ?

    Thank you for reading me.

    Best Regards.

  • 1. You may download c2000ware as the following link

    http://www.ti.com/tool/c2000ware

    And you can find a documentation about the topic of tuning PID (PID Controller Tuning Guide.pdf)

    C:\ti\c2000\C2000Ware_2_00_00_02\libraries\control\DCL\c28\docs

    2. Please make sure the hall logics for commutation states are correct for both directions rotation, you may try build level 4 first to tune the related modules, and then enable the speed or current close loop in the following levels.

    Could please capture the current waveform with hall output or commutation signals that should help to understand your question?