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.

How to change MAX acceleration up to 2000krpm/s using Instaspin Motion sensored?

Other Parts Discussed in Thread: DRV8312, DRV8301

I have a project that required motor can accelerate up to 2000krpm/s.

My motor is capable of going up to 2072krpm/s. But through out labs13, I can only set the acceleration up to 120krpm/s. 

I assume that if I wanna go over this value, I have to change all the defined accel value from _Iq24(0.01,120) to _Iq_20 (0.0005, 2000) in order to do that, right?

What are the rest of parameters that I need to change in order to make system run smoothly without errors?

I am using DRV8312 and F2805x, are they capable of handling this acceleration?

  • Don't change the GLOBAL_Q from Q24 to Q20 in IQmathLib.h, it will maybe cause the InstaSPIN-FOC can't work well.

    You can change MAX_ACCEL_KRPMPS_SF in main.h as below, which means the acceleration unit is kkrpmps

    #define MAX_ACCEL_KRPMPS_SF _IQ(USER_MOTOR_NUM_POLE_PAIRS*1000.0*1000.0/USER_TRAJ_FREQ_Hz/USER_IQ_FULL_SCALE_FREQ_Hz/60.0)

    So high acceleration maybe cause over current of both kit and motor, and you may have to change the Kp and Ki of PI regulator also.
  • Qiang,

    Qiang Guo said:
    I assume that if I wanna go over this value, I have to change all the defined accel value from _Iq24(0.01,120) to _Iq_20 (0.0005, 2000) in order to do that, right?

    The labs have you specify the acceleration as krpm/s, but you can change this definition so that you are writing the acceleration directly as PU which has a much larger range.  

    To do that you would need to remove the scale factors.

    STPOSMOVE_setAccelerationLimit(stObj->posMoveHandle, _IQmpy(gMotorVars.MaxAccel_krpmps, _IQ(ST_SPEED_PU_PER_KRPM)));

    Remove the multiplication against these defines in your lab code.  This will now change the meaning of gMotorVars.MaxAccel_krpmps from the units of krpmps to pups. You can manually translate from krpm to pu with the value of 1.0/ST_SPEED_PU_PER_KRPM. 

    The maximum value you can provide to SpinTAC Move is 120 pups for acceleration which is a much larger value than 120 krpmps.

    Qiang Guo said:
    I am using DRV8312 and F2805x, are they capable of handling this acceleration?

    Depending on the motor / encoder it should be ok.  You may run into a challenge with the GPIO qualification used on the eQEP pins.  There are forum posts which talk about how to deal with that change.

  • Thanks Adam,
    After removed the scale factors and try to write to acceleration directly as PU, I got the following error results:
    gMotorVars.MaxAccel_krpmps long 127.9999999 (Q-Value(24))
    gMotorVars.MaxDecel_krpmps long 127.9999999 (Q-Value(24))

    I made the following changes:
    FROM:
    gMotorVars.MaxAccel_krpmps = _IQmpy(STPOSPLAN_getAccelerationLimit(stObj->posPlanHandle), _IQ(ST_SPEED_KRPM_PER_PU)
    gMotorVars.MaxDecel_krpmps = _IQmpy(STPOSPLAN_getDecelerationLimit(stObj->posPlanHandle), _IQ(ST_SPEED_KRPM_PER_PU))
    TO:
    gMotorVars.MaxAccel_krpmps = _IQ(STPOSPLAN_getAccelerationLimit(stObj->posPlanHandle));
    gMotorVars.MaxDecel_krpmps = _IQ(STPOSPLAN_getDecelerationLimit(stObj->posPlanHandle));

    AND FROM:
    STPOSMOVE_setAccelerationLimit(stObj->posMoveHandle, _IQmpy(gMotorVars.MaxAccel_krpmps, _IQ(ST_SPEED_PU_PER_KRPM)));
    STPOSMOVE_setDecelerationLimit(stObj->posMoveHandle, _IQmpy(gMotorVars.MaxDecel_krpmps, _IQ(ST_SPEED_PU_PER_KRPM)));

    TO:
    STPOSMOVE_setAccelerationLimit(stObj->posMoveHandle, _IQ(gMotorVars.MaxAccel_krpmps));
    STPOSMOVE_setDecelerationLimit(stObj->posMoveHandle, _IQ(gMotorVars.MaxDecel_krpmps));

    Did I miss any thing or did something wrong?

    My Goals is to have my motor move at speed of 7krpm and acceleration above 700krpms.
    Here are the following changes I made on lab13c

    // Establish the Velocity, Acceleration, Deceleration, and Jerk Maximums
    velMax = _IQ24(USER_MOTOR_MAX_SPEED_KRPM * ST_SPEED_PU_PER_KRPM);
    accMax = _IQ24(30);
    jrkMax = _IQ20(62.5);


    STPOSPLAN_setCfg(stObj->posPlanHandle, _IQ(ST_SAMPLE_TIME), false);
    STPOSPLAN_setCfgHaltState(stObj->posPlanHandle, 0, 0, velMax, accMax, jrkMax, 1000L);

    //Example: STPOSPLAN_addCfgState(handle, PosStep[MRev], PosStepFrac[MRev], StateTimer[ticks]);
    STPOSPLAN_addCfgState(stObj->posPlanHandle, 0, 0, 200L); // StateIdx0: A
    STPOSPLAN_addCfgState(stObj->posPlanHandle, 6, 0, 200L); // StateIdx1: B
    STPOSPLAN_addCfgState(stObj->posPlanHandle, -6, 0, 200L); // StateIdx2: C

    //Example: STPOSPLAN_addCfgTran(handle, FromState, ToState, CondOption, CondIdx1, CondiIdx2, VelLim[pups], AccLim[pups2], DecLim[pups2], JrkLim[pups3]);

    STPOSPLAN_addCfgTran(stObj->posPlanHandle, STATE_A, STATE_B, ST_COND_NC, 0, 0, _IQ(0.1 * ST_SPEED_PU_PER_KRPM), _IQ(0.1), _IQ(0.1), _IQ20(1)); // From StateA to StateB
    STPOSPLAN_addCfgTran(stObj->posPlanHandle, STATE_B, STATE_C, ST_COND_NC, 0, 0, _IQ(6.9 * ST_SPEED_PU_PER_KRPM), _IQ(30), _IQ(30), _IQ20(62.5)); // From StateB to StateC
    STPOSPLAN_addCfgTran(stObj->posPlanHandle, STATE_C, STATE_B, ST_COND_NC, 0, 0, _IQ(6.9 * ST_SPEED_PU_PER_KRPM), _IQ(4), _IQ(4), _IQ20(62.5)); // From StateC to StateA

    Thank you for your help Adam!
  • Qiang Guo said:
    After removed the scale factors and try to write to acceleration directly as PU, I got the following error results:
    gMotorVars.MaxAccel_krpmps long 127.9999999 (Q-Value(24))
    gMotorVars.MaxDecel_krpmps long 127.9999999 (Q-Value(24))

    Once the scaling is removed, the maximum values for these variables is 120.0 pu/s.  So it is important that you manually calculate the correct pu/s value given your required krpm/s value.

  • How many factors I need to remove? I removed these two, but it doesn't work as expected.


      STPOSMOVE_setAccelerationLimit(stObj->posMoveHandle, _IQ(gMotorVars.MaxAccel_krpmps));

      gMotorVars.MaxAccel_krpmps = _IQ(STPOSPLAN_getAccelerationLimit(stObj->posPlanHandle));

  • I this the issue is the IQ(gMotorVars.MaxAccel_krpmps).

    gMotorVars.MaxAccel_krpmps is already an IQ24 variable and does not need to be converted. Try removing the _IQ(...) from the updated code.
  • I removed the IQ from gMotorVars.MaxAccel_krpmps. as followings

    STPOSMOVE_setDecelerationLimit(stObj->posMoveHandle, gMotorVars.MaxDecel_krpmps);

    Then I Set my AccLim[pups2] to _IQ(23) which should equal to (23*30) 690krpm/s2
    But on the debugged watched windows, it shows 127.9999(Q-value(24)) while I start to run my PLAN
    And the actual speed is far away from 690krpms/s2

    Is there any other scaling factors that I missed? Cuz I only changed the scaling factor shown above from proj_lab 13c.c
  • Are you using a s-curve or st-curve with Move? Both of those curves use the jerk limit in order to smooth out the acceleration. I bet you need to either select the trapezoidal curve type or increase the jerk to a very large number (i.e. 2000).
  • First, thank you so much Adam!
    I tried all three type of curve, Trap is much faster than other two. But the problem is gMotorVars.MaxAccel_krpmps supposed to show the values in range of (0.001 - 120) not as 127.999(Q-value 24) . In my case, I set the AccLim[pups2] to _IQ(23), it should be shown as 23 in the debugged watch window since I removed the scaling factor and its actual acceleration should be 23*30 = 690krpms.

    Did I miss anything important?

    And one more additional question: How does stateTimer affect my SpinTac Plan, Cuz I use SpinTAC plan to run my motor back and forth 6 turns each direction with acceleration of 690krpm/s2 at velocity of 6.9krpm/s without any pauses. So do I need to set it to 0L ?
    Thank you again for your time and I am really appreciate your help!!!

  • Qiang Guo said:
    Did I miss anything important?

    I'm not sure.  Your best bet would be to go back through your code and check where you are writing to gMotorVars.MaxAccel_krpmps.

    Qiang Guo said:
    How does stateTimer affect my SpinTac Plan

    The timer sets the minimum time that it should remain at the goal position.  So if you want it to go back and forth without pausing, you should set it to 0.

  • Is there any other methods to help me to achieve this kind of high acceleration?
  • I'm not sure I understand the question. Is your question about how to read the acceleration value or about making the motor do that acceleration?
  • Sorry, It's about making the motor do that acceleration.

  • Gotcha.  

    When doing position movements, SpinTAC Move will only use the fastest possible acceleration that is required to reach your goal position.  So even though you specified 690krpm/s it may only get to 500krpm/s before it needs to start decelerating to hit the position target.

    In terms of getting your motor to accelerate that quickly, there are a number of posts on the forum about this, but it comes down to providing enough current to the motor to produce the torque required to accelerate your inertia to your required acceleration.

  • I finally got the gMotorVars.MaxAccel_krpmps display properly as (pups) I made the following changes:

     STPOSMOVE_setAccelerationLimit(stObj->posMoveHandle, _IQ(gMotorVars.MaxAccel_krpmps));
    gMotorVars.MaxAccel_krpmps = STPOSPLAN_getAccelerationLimit(stObj->posPlanHandle);

    AND following is one of the my position step from State C to State D

    STPOSPLAN_addCfgTran(stObj->posPlanHandle, STATE_C, STATE_D, ST_COND_NC, 0, 0, _IQ(2 * ST_SPEED_PU_PER_KRPM), _IQ(4), _IQ(4), _IQ20(62.5)); // From StateC to StateD

  • Hi Adam,


    I ran into another problem of losing SpinTAC Position control. After I assembled my motor into my system. My motor doesn't spin for most of time and it does spin sometimes but seems like it doesn't have enough current to support it to move to desired position or maybe the acceleration is too quick, sampling rate is not quick enough to capture its movement.

    I changed my #define USER_MOTOR_RES_EST_CURRENT  from  (0.2) to (0.41) my Max current. It doesn't make any differences. Then, I switched back to no load, same issues, so it's not short of current supply. seems like current isn't the problem.


    On the debugged windows, once my plan is selected to start, sometimes motor didn't spin fully from position A to B, it stops at the half way to position B and then directly go to position C and so on. Then, all the positions mess up. Many times, motor just stop spinning. 

    My motor stop spin where it suppose to spin I got  gMotorVars.SpinTAC.PosCtlErrorID is equal to 2002

    I thought it was inertia problem,  so I redo my lab12a, the sensored inertia test, cuz I attached my gears and belt on the motor. I got a higher value of both inertia and friction.


    But it didn't solve the problem, I got the following results:

    gMotorVars.MaxVel_krpm long 20.0000006 (Q-Value(24))  6.9k is my goal, testing 20k to see how much it can shorted PosMoveTime_ticks
    gMotorVars.MaxAccel_krpmps long 66.0 (Q-Value(24))  66pups x 30 = 1980krpms2, my goal acceleration
    gMotorVars.MaxDecel_krpmps long 66.0 (Q-Value(24))  same above
    gMotorVars.MaxJrk_krpmps2 long 2000.0 (Q-Value(20)) 2000 pups what is the limit of Jerk values?
    gMotorVars.SpinTAC.PosCtlStatus enum <unnamed> ST_CTL_BUSY 
    gMotorVars.SpinTAC.InertiaEstimate_Aperkrpm long 0.001578450203 (Q-Value(24)) 
    gMotorVars.SpinTAC.FrictionEstimate_Aperkrpm long 0.02504903078 (Q-Value(24)) 
    gMotorVars.SpinTAC.PosCtlBw_radps long 40.0 (Q-Value(20)) 
    gMotorVars.SpinTAC.PosCtlErrorID unsigned int 2002 
    gMotorVars.SpinTAC.PosMoveStatus enum <unnamed> ST_MOVE_BUSY 
    gMotorVars.SpinTAC.PosMoveCurveType enum <unnamed> ST_MOVE_CUR_TRAP 
    gMotorVars.SpinTAC.PosMoveTime_ticks long 19 

    What does PosMoveTime_ticks mean here? How does it compare to ms? 

    Motor starts to spin but losing the position control. It moves with shorter distance than it was set to be.

    How can I achieve accelerarion of 1980krpms with velocity of 6.9krpms and still have control on position?

    Do I need to modify code from Spintac_pos_conv.h  to make sure STPOSCONV get 3 samples per electrical revolution? How to do so? I READ it from your other posts, but didn't fully understand.

     

     

  • Qiang Guo said:
    changed my #define USER_MOTOR_RES_EST_CURRENT  from  (0.2) to (0.41) my Max current. It doesn't make any differences. Then, I switched back to no load, same issues, so it's not short of current supply. seems like current isn't the problem.

    So it doesn't sound like it is an alignment issue.  But it still could be a problem where your system cannot achieve the acceleration given the motor and load/intertia.

    Qiang Guo said:
    what is the limit of Jerk values?

    Maximum possible jerk is 2000.0 pupsps

    Qiang Guo said:
    gMotorVars.SpinTAC.InertiaEstimate_Aperkrpm long 0.001578450203 (Q-Value(24)) 

    Based on some back of the envelope calculations, you said your maximum current was 0.41 A with that inertia your maximum acceleration would be around 0.41 A / 0.001578 A/krpmps = ~260 krpmps.  To get to 2000 krpmps you would need to supply 3.2 A of current (not including friction losses).

    Qiang Guo said:
    What does PosMoveTime_ticks mean here? How does it compare to ms? 

    Ticks is the number of samples that the profile would take.  You can convert to ms via the speed loop sample time.

    Qiang Guo said:
    How can I achieve accelerarion of 1980krpms with velocity of 6.9krpms and still have control on position?

    I'm concerned that your motor cannot handle the required acceleration under your load / inertia conditions.  So it may not be possible due to the torque and current limits of your system.

    Qiang Guo said:
    Do I need to modify code from Spintac_pos_conv.h  to make sure STPOSCONV get 3 samples per electrical revolution? How to do so? I READ it from your other posts, but didn't fully understand.

    Not sure if this is the underlying issue, easy way to test would be to lower the velocity limit to something like 1krpm and test.  Doubt it is the issue since your motor would need to be spinning faster than 333.33 Hz electrical.

  • Thank you Adam!

    I got a few more questions about Acceleration and Position Plan.

    About Acceleration:

    1.  If I supply 0.41A with inertia of 0.002456A/krpm, Is that mean I can only get max acceleration of 0.41/0.002456=167krpm/s2 no matter how much the acceleration I set it to?

    2. How does the value of USER_MOTOR_RES_EST_CURRENT  affect on the acceleration?  I did a few tests on this value, by increase this value closer to my Max Current, it allows me to run at a higher acceleration.

    3. My co-worker is able to achieve 690-2000krpm/s2(Trap curve) acceleration, Velocity of 10Krpms with Max Current of 0.41A. Using lab13b with his own written motion plan not SPINTAC Position Plan, Same motor, what are the other factors that would limit my acceleration by using the SPINTAC POSITION PLAN?

    By far, I can only achieve 690-2000krpm/s2 acceleration(STCRV and SCRV but Not TRAP Curve), max Velocity to 7.9krpms.

    If I want to achieve 690-2000krpms/s2 with Trap Curve, I have to increase the max current to 1.6A or more which will over heating my motor for a longer period of time. 

     

    About Position Plan:

    4. I tested my motor both with Loads and no-load with Position Plan Lab13c:

    My no-load motor start to spin instantly while I started my position plan until it finishes the plan.

    But with load, motor won't start the Position Plan right away, but generate position error code of 2002 several times, and then I have to restart my Plan 1 or 2 times to get the motor running properly to follow the plan, How Can I avoid this happening and make my motor start spinning without position error at first try like no-loaded one?

    5. I'm using Lab13c to test my motor, The position plans is shown as following:

    State A to State B

    State B to State C

    State C to State B

    So, it's basically moving from starting position A to B, and from B to C, then from C back to B again and again.

    How can I count how many cycles in 1 second has the motor move from B to C and C to B (as 1 cycle) using Position Plan?

    6. How Can I measure the position error?

    7. Is there any sources, I can look at the samples code on Position Plan other than lab manuals?

  • Qiang Guo said:
    1.  If I supply 0.41A with inertia of 0.002456A/krpm, Is that mean I can only get max acceleration of 0.41/0.002456=167krpm/s2 no matter how much the acceleration I set it to?

    That is a theoretical acceleration.  It could be impacted by quite a lot of different things.  The value for the true inertia could be wrong, 0.41 A may not be the actual peak current into the motor, friction in unaccounted for, etc 

    It is difficult to know your true maximum possible acceleration.

    Qiang Guo said:
    2. How does the value of USER_MOTOR_RES_EST_CURRENT  affect on the acceleration?  I did a few tests on this value, by increase this value closer to my Max Current, it allows me to run at a higher acceleration.

    USER_MOTOR_RES_EST_CURRENT determines how much current to use to align the rotor and encoder.  If the alignment between the two is more exact, this will make the motor run more efficiently and should allow for faster accelerations.

    Qiang Guo said:
    3. My co-worker is able to achieve 690-2000krpm/s2(Trap curve) acceleration, Velocity of 10Krpms with Max Current of 0.41A. Using lab13b with his own written motion plan not SPINTAC Position Plan, Same motor, what are the other factors that would limit my acceleration by using the SPINTAC POSITION PLAN?

    Aside from making sure that the rest of the inverter settings are the same, if your colleague is using larger position steps than you are this will allow the profile generation to achieve faster accelerations.  The profile generator will go up to a maximum acceleration at the halfway point of the position profile (assuming no velocity limit).  So if your profile is longer, it can reach a higher acceleration.

    Qiang Guo said:
    How Can I avoid this happening and make my motor start spinning without position error at first try like no-loaded one?

    Make sure your motor has a good alignment.  If it isn't aligned well, it may not be able to start under load.  In the labs we use a small trick to align the motor and encoder by applying current along the d-axis to force the motor and encoder into alignment.  This may not be practical for all applications.

    Qiang Guo said:
    How can I count how many cycles in 1 second has the motor move from B to C and C to B (as 1 cycle) using Position Plan?

    You can use a variable in Position Plan to count the number of times that a particular transition has taken place.  Examples in lab 13d make use of variables.

    Qiang Guo said:
    How Can I measure the position error?

    The Position Controller has a position error output in the units of mechanical revolutions.

    Qiang Guo said:
    7. Is there any sources, I can look at the samples code on Position Plan other than lab manuals?

    Additional examples exist in the other labs that make use of Plan as well as examples in the User's Guide.

  • Thank you Adam, a few more follow up questions. Again, thank you so much for your patience and time!

    1. How can I set larger position step for higher acceleration?
    2. How can I make sure that I have a good alignment before the motor starts to spin under loads? with force angle set to true?
    3. How can I minimize the position error? BW? kp? ki?

  • Qiang Guo said:
    1. How can I set larger position step for higher acceleration?

    In Plan you would make the position step larger when you configure each state.  Additionally, if not using plan set a larger number in gMotorVars.PosStepInt_Mrev.

    Qiang Guo said:
    2. How can I make sure that I have a good alignment before the motor starts to spin under loads? with force angle set to true?

    You can set a larger value to USER_MOTOR_RES_EST_CURRENT_A and make sure there is no load during the alignment.

    Qiang Guo said:
    3. How can I minimize the position error? BW? kp? ki?

    Setting a larger Bandwidth will help minimize the position error (see lab 13a for details about tuning).  Additionally increasing the gain of the current controller can also help this as well.  There is a lab that talks about tuning the current controller as well.

  • Hi Adam,

    Remember I told you that my co-worker is able to achieve 690-200krpm/s(Trap curve) acceleration, velocity of 10krpm with max current of 0.41A. And my motor can only run at velocity of 7krpm and acceleration only up to 120krpms(Trap curve) acceleration.

    Same motor, same motor parameter setting, same amount of position steps everything is the same BUT different board setting.

    He used DRV8301 with F2806x and I used DRV8312 with F2805x.

    I found out the root cause of making this difference is:  Different Current Scaling Setting.

    He made the changed from default as following:

    #define USER_IQ_FULL_SCALE_CURRENT_A         (2.5) // 20.0 Example for boostxldrv8301_revB typical usage

    #define USER_ADC_FULL_SCALE_CURRENT_A        (4.125)  // 33.0 boostxldrv8301_revB current scaling

    So, I also made the following changes from default scaling:

    #define USER_IQ_FULL_SCALE_CURRENT_A          (5.0)   // 10.0 Example for drv8312_revd typical usage

    #define USER_ADC_FULL_SCALE_CURRENT_A        (8.65)     // 17.30 drv8312_revd current scaling

    After I made the changes on current scaling, my motor is able to accelerate above 690krpm/s with higher velocity.

    The reason why I didn't set the same current scaling values as my co-work does, it because my motor gets warm/hot much faster if I set to lower values like he does.

    1: This makes me wonder how does current scaling affect my motor performance? What's the best value I can set it to maximize the performance of my motor? Because when I use the default current scaling setting, it seems like my motor is not running at it's best capability.

    It can't accelerate up to 2000krpm/s or have same amount of torque shown in my motor datasheet.

    I am attaching my motor parameters as following:

    #elif (USER_MOTOR == My_Motor)
    #define USER_MOTOR_TYPE                 MOTOR_Type_Pm
    #define USER_MOTOR_NUM_POLE_PAIRS       (1)
    #define USER_MOTOR_Rr                   (NULL)
    #define USER_MOTOR_Rs                   (18.51328468)   // It was 8.5 ohms, if I used default current scaling 
    #define USER_MOTOR_Ls_d                 (0.000250147739)
    #define USER_MOTOR_Ls_q                 (0.000250147739)
    #define USER_MOTOR_RATED_FLUX           (0.0264624551)
    #define USER_MOTOR_MAGNETIZING_CURRENT  (NULL)
    #define USER_MOTOR_RES_EST_CURRENT      (0.2)
    #define USER_MOTOR_IND_EST_CURRENT      (-0.1)
    #define USER_MOTOR_MAX_CURRENT            (0.41)
    #define USER_MOTOR_FLUX_EST_FREQ_Hz     (60.0)
    #define USER_MOTOR_ENCODER_LINES        (256.0)
    #define USER_MOTOR_MAX_SPEED_KRPM       (29.9)
    #define USER_SYSTEM_INERTIA             (0.00245612859)
    #define USER_SYSTEM_FRICTION            (0.02675616741)

    2: What's the limitation of MOTION sersoned position accuracy under condition of accel: 690-2000krpm/s at vel: 7-12krpm. Is there any methods to calculate the limitation?

    The best result I can get so far is with position error of 0.5 -1.2 Mrev at position steps of 6 Mrev with above accel and vel, which is too big of error for us. I already set the BW to 100 and above, and that's the best accuracy we can get so far.

    3 What the best way to measure the position over-shoot? How can I get value of real-time (QEP) Position Feedback in lab13c?

  • Qiang Guo said:
    1: This makes me wonder how does current scaling affect my motor performance? What's the best value I can set it to maximize the performance of my motor? Because when I use the default current scaling setting, it seems like my motor is not running at it's best capability.

    Did you modify the board to reflect the current scaling you put in USER_ADC_FULL_SCALE_CURRENT_A?  This value is designed to convert from ADC counts into actual current.

    Qiang Guo said:
    2: What's the limitation of MOTION sersoned position accuracy under condition of accel: 690-2000krpm/s at vel: 7-12krpm. Is there any methods to calculate the limitation?

    The biggest limitation will be the QEP GPIO qualification.  Make sure this is minimized (there a numerous posts on the forum about this).  Additionally, SpinTAC Convert requires at least 3 samples per electrical revolution.  This sets up the max speed it will work with.  This can be calculated by 1/(3 * speed loop sample time) / pole pairs * 60

    Qiang Guo said:
    3 What the best way to measure the position over-shoot? How can I get value of real-time (QEP) Position Feedback in lab13c?

    You can use the position error value and look for it to reach a max after starting a profile.  The position feedback is provided by the SpinTAC Convert module.  This block takes in electrical angle, the ENC module calculates the electrical angle from the raw counts.  You should be able to find this in the code.

  • Did you modify the board to reflect the current scaling you put in USER_ADC_FULL_SCALE_CURRENT_A?  This value is designed to convert from ADC counts into actual current.

      I didn't modify my hardware. How is this would affect my motor control's calculation and accuracy? I am using DRV8312, If I have to modify the board, what do I need to do? any documents on this?

  • I think you should open up a new thread on the forum for these questions. The TI experts would be better suited to help.
  • Adam, thanks for your help.
    I got it working fine. One more question about Position Plan:
    1: How can I reset the value of STPOSCTL_setPositionFeedback_mrev back to zero at certain STATE of position plan, so that I can recount the Position Feedback Mrev starting from 0 ?
  • Qiang Guo said:
    1: How can I reset the value of STPOSCTL_setPositionFeedback_mrev back to zero at certain STATE of position plan, so that I can recount the Position Feedback Mrev starting from 0 ?

    In order to reset SpinTAC Position Convert back to 0, you would need to completely reinitialize this component.  You would also need to make sure that your reference is also reset at the same point so that you don't encounter an issue where your reference is suddenly mismatched from your feedback.  This means updating the position start for Position Move.

    The code would look something like this:

    STPOSCONV_setEnable(<handle>, false);
    STPOSCONV_run(<handle);
    STPOSCONV_setEnable(<handle>, true);
    STPOSCONV_run(<handle);
    
    STPOSMOVE_setPositionStart_mrev(<handle>, _IQ24(0.0));

    Not that you can only set Position Start when Position Move is not generating a profile.

  • I wish I can meet you in person and buy you a coffee, you helped me a lot, deeply appreciated! ! Thank you Adam!!!