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 achieve servo control with F28069M?

Other Parts Discussed in Thread: LAUNCHXL-F28069M, BOOSTXL-DRV8301

Hello InstaSPIN community,

 

I’m using DRV8301-HC-EVM and F28069M ISO controlCARD. I spent time running InstaSPIN Projects and Labs and finished all labs with my ACIM.

 

When I run the lab13b, I find that new target position will be taken as a position reference after the completion of the previous target position.

 

As mentioned in “13.5.4 Profile Tracking” of “spruhj1d.pdf”, controller is able to follow a changing target position to make a servo control. So is there any more detail information or demonstration projects about this application?

 

Best regards,

 

Brant Zheng

  • Brant,

    there are two labs that focus on the profile generation. Lab 13b focuses on point to point position moves. Lab 13e focuses on "jog mode" where you set a goal speed to the profile generator. 

    In both of those labs the position reference is being changed by the profile generator in order to show how well the position controller can track a changing position reference. 

    Can you be more specific about additional information or examples you would like to see?

  • Hello Adam,

     

    Thank you for your explanation!

     

    In my application of servo control, the input target position can be changing constantly, and I want the position of the motor shaft to follow it constantly in real-time.

     

    For example, I use the rotatable potentiometer on DRV8301-HC-EVM Board to provide an analog voltage to ADC as a target position. When I turn the shaft of the potentiometer, the shaft of the motor need to spin and follow the input position synchronously.

     

    Could you give some advice about how to achieve this application?

     

    Best regards,

     

    Brant Zheng

  • Brant,

    For this application I think you should look at lab 13a. This lab does not use the profile generator. So it will not generate smooth trajectories for point to point movements. This lab holds a fixed position but you should be able to modify the code to provide the position reference from your potentiometer. 

    One thing to keep in mind is that you will need to handle converting your position command into the scaled position system expected by the position controller. The position controller expects that the position signal will vary between -10 and +10 with rollover, where 1 is equal to one mechanical revolution. 

    There is a document that I need to provide to you that will help. Right now I'm on mobile so I'll post it when I'm back at my PC. 

  • Hello Adam,

     

    Thank you for your advice!

     

    I’m so excited that I achieve this application after modifying the code to provide the position reference from my potentiometer.

     

    As you mentioned that the position controller expects that the position signal will vary between -10 and +10 with rollover, which is set by “ST_MREV_ROLLOVER (10.0)”. What should I do to make this range much larger than [-10,+10] or make a position move of >10 mechanical revolutions?

     

    And I found that if I set the gap between two position reference value too big, which caused by turning the potentiometer too quickly, the motor will run abnormally. I set the “ST_POS_ERROR_MAXIMUM_MREV” to the maximum allowable value 5.0 from the default value 2.0, and it can provided some improvements.

     

    Are these two problems mentioned in the document that you are going to give me? I am so eager to get your sharing information.

     

    Best regards!

     

    Brant Zheng

  • Brant,

    The solution uses that rollover in order to prevent fixed point math errors.  We support position movements much larger than 10 revolutions.  

    What do you mean that the motor runs abnormally?  If the gap it too large, the position controller will go into an error condition.

    I've attached a document that shows the position reference signal which should help with understanding the rollover situation.

    1667.SpinTAC_Position_Move_Rollover.pdf

  • Hello Adam,

     

    Thank you for your sharing information!

     

    The problem of large gap can be solved by reducing the rate of change of the reference position target.

     

    I understand the rollover situation and I am working on lab13a now. I update the position reference via “STPOSCTL_setPositionReference_mrev(stObj->posCtlHandle, _IQ(MyRvalue));” in “ST_runPosCtl(ST_Handle handle, CTRL_Handle ctrlHandle)”. The “MyRvalue” represents the changing position target and its value range is [-ROMax, ROMax)= [-10,10).

     

    As you mentioned that InstaSPIN supports position movements much larger than 10 revolutions. So how should I operate the code to make the position movement larger than 10 revolutions such as 130 mechanical revolutions? Is there a function that can be called directly?  

     

    I tried to set the “ST_MREV_ROLLOVER” to “130”, so that “MyRvalue” can get the range of [-130,130). But I think it is not a conventional means. Could you give me some advice?

     

    Best regards,

     

    Brant Zheng

  • Brant,

    In order to get movements greater than 10 revolutions without using the profile generator, you would need to provide a changing position reference to the position controller.  The key is that when your position reference gets to ST_MREV_ROLLOVER it would then need to change to negative ST_MREV_ROLLOVER.  This now puts your position reference on the next set of [-10, 10].

    So if you continuously lead the position feedback by 2 revolutions you could do this until the system has moved as far as you would like it to.  

    I would leave ST_MREV_ROLLOVER as 10, it is a pretty easy value to work with.  Also if you set it greater than 127 that will cause fixed point math errors.  

  • I'm working on a similar setup and goal. LAUNCHXL-F28069M + BOOSTXL-DRV8301 + 150W/24V/10A/4pole-pairs BLDC.

    In my case control signal comes from Joystick -> PC -> master board -> (I2C) -> LAUNCHXL-F28069M. Joystick signal range [-1000..1000]. I modified Lab13a as advised above i.e.

    proj_lab13a.c:ST_runPosCtl

    STPOSCTL_setPositionReference_mrev(stObj->posCtlHandle, gMotorVars.PosStep_MRev);

    STPOSCTL_setVelocityReference(stObj->posCtlHandle, gMotorVars.SpeedRef_krpm);

    STPOSCTL_setAccelerationReference(stObj->posCtlHandle, _IQmpy(MAX_ACCEL_KRPMPS_SF, gMotorVars.MaxAccel_krpmps));

    ...

    Modified also proj_lab13a.js and main_position.h to add variables  PosStep_MRev and SpeedRef_krpm.

    ST_MREV_ROLLOVER (10.0)

    ST_POS_ERROR_MAXIMUM_MREV (2.0)

    Note that I ran all labs already OK. However with the above modification I only able to run motor in increments of 2 (max 3) up until PosStep_MRev = 20. For clarity the details follow:

                PosStep_MRev = 2   OK
                PosStep_MRev = 4   OK
                PosStep_MRev = 6   OK
                PosStep_MRev = 8   OK
                ...
                PosStep_MRev = 20      after rotation is done error 2002 pops up.
                PosStep_MRev = 0        resets error to 0
                PosStep_MRev = 2        runs OK until 20 i.e. cycle repeats
                PosStep_MRev = -1 or -2 or 3.5     error 2002

    Setting PosStep_MRev=0 at any step before 20 gives 2002. I was not able to make negative rotations by trying negative PosStep_MRev or/and negative SpeedRef_krpm.

    Deciding on optimal Bandwidth is challenging too.

    At USER_SYSTEM_BANDWIDTH = 20   I can barely move (tiny fraction of a rotation) the rotor by hand. At 30 its dead seized. At 10 I can rotate with considerable effort. So, what would be the optimal value? Anyways 20 seems to work fine.

    Please, advise is much appreciated.

  • Googling "spintac position control forum" returns a few hits that help with this problem.

    1. STPOSCTL_setVelocityReference(stObj->posCtlHandle, gMotorVars.SpeedRef_krpm);

    has to be replaced with 

    STPOSCTL_setVelocityReference(stObj->posCtlHandle, _IQmpy(ST_SPEED_PU_PER_KRPM, gMotorVars.SpeedRef_krpm));

    The change immediately allows for -/+ rotations

    2. I keep forgetting my motor has a 1:3.5 Gear box, which makes rotating by hand more difficult. But rotating on the side of encoder is easier and allows for a more precise tuning of USER_SYSTEM_BANDWIDTH, which in my case can be set to 40 (or more)

    I still haven't figured out why Rollover doesn't happen automatically with manual rollover possible at PosStep_MRev = (+/-)20 when ST_MREV_ROLLOVER (10.0)

  • Made more progress. The rollover does happen automatically when count reaches -/+ 20. But the rollover is to 0 (not -/+ 10 as per the documentation. Are the docs outdated?). I'm using MW 15. The compiler is 6.4.9.

    When count reaches +/- 20, 2002 error is thrown sometimes. Seems can be ignored. If I enter e.g. 1.5 or -1.5 at this point, the motor rotates OK and the error is reset automatically.

    Example rotation cycle

    PosStep_MRev = 1.5   1.5 rotation Clockwise (CW)
    PosStep_MRev = 3      1.5 rotation CW
    PosStep_MRev = 4.5   1.5 rotation CW
    PosStep_MRev = 3      1.5 rotation Counter-Clockwise (CCW)
    PosStep_MRev = 1.5   1.5 rotation CCW
    PosStep_MRev = 3      1.5 rotation CW
    PosStep_MRev = 4.5   1.5 rotation CW
    ... increment PosStep_MRev in 1.5 steps until 20 to rotate CW (rollover to 0)
    PosStep_MRev = -1.5  1.5 CCW
    PosStep_MRev = -3.0  1.5 CCW
    PosStep_MRev = -1.5  1.5 CW
    ... decrement PosStep_MRev in -1.5 steps until -20 to rotate CCW (rollover to 0)

    I'm currently using USER_SYSTEM_BANDWIDTH = 50

    The motor works OK in max 2.0 increments CCW and 1.5 CW. Why is this asymmetry?

    How to achieve rotation from 0 to 20 in one shot?

  • Alex,

    Unless you are creating true velocity and acceleration reference signals, I would recommend leaving them as 0.  This will only cause issues with the controller.  

    Please look at the attached PDF that describes the position reference signal.  

    1234.SpinTAC_Position_Move_Rollover.pdf

    This shows how the position reference signal is expected to look for SpinTAC.  

    This is the signal that you need to emulate in order to get this setup to work.  So when the position reference reaches 10 the next value should be -8 (assuming steps of 2 revolutions) to travel in the same direction.

    The profile generator (covered in lab 13b) handles all of this automatically.