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.

Lab 5c: cannot find "USER_SYSTEM_INERTIA" from user.h

Other Parts Discussed in Thread: DRV8301, MOTORWARE, DRV8312

Hello,

Working on lab5c and the id went through very well but when I go back to the use.h, cannot find the inertia and friction (USER_SYSTEM_INERTIA and USER_SYSTEM_FRICTION) which suppose to be modified by identified values.

I copied the user.h from _FOC folder to _MOTION folder previously (following the instruction). Is this the reason??

  • I closed everything and do lab5c over...

    Even worse this time that the "Build" cannot even go through... Some errors reported as attached. Obviously, user.h in _FOC does not have inertia and friction variables... Also, since I did copy, I have lost original user.h file in _MOTION folder. What to do then?

  • yes, it is because you copied over the entire user.h file from FOC to MOTION solution.

    Attached is the default drv8301 MOTION user.h that ships with MotorWare _11. Place it here:

    C:\ti\motorware\motorware_1_01_00_11\sw\solutions\instaspin_motion\boards\drv8301kit_revD\f28x\f2806xM\src\

    then update the user.h and any other sections you modified.  You can use a free tool like Beyond Compare to do this quickly if you have multiple lines changed.

     

    Do the instructions say to copy the entire file?  I thought they just had you copy over certain files?  Please point me to the specific section and I'll see if it should be updated/clarified.

     

    user.h
  • Thanks a lot, as always, and I'll try it soon...

    Yes, page 101 "Prerequisites" part. Actually, it didn't make sense to me when I 1st time read it, because I didn't see anything about inertia/friction related codes in previous _FOC labs...

  • Chris,

    I updated user.h in _MOTION and some errors reported when building8865.user.h0257.user.h the project. I'm attaching my updated user.h file here and according to the user.h from _FOC, I modified user.h in _MOTION at:

    1. row 129 - 138;

    2. row 338; row 355;

    3. row 363 - 379;

    The error screenshot is shown below:

    Anything wrong here??

  • you are missing having your motor selected

    #define My_Motor                    104

    #define USER_MOTOR My_Motor

    and then make sure you have a section with

    #elif (USER_MOTOR == My_Motor)
    #define

     

    Note that the MOTION projects have  few more #define USER_MOTOR variables that you need to add

     

  • BTW - here is the new section of the instaspin_labs.pdf for proj_lab5c

    1. Open the user.h file that was modified as part of InstaSPIN-FOC lab 2a.  It is located in “sw\solutions\instaspin_foc\boards\drv8312_revD\f28x\f2806xF\src”

    2. Locate the USER_MOTOR settings that you identified in lab 02a.

    3. Open the user.h file for InstaSPIN-MOTION.  It is located in “sw\solutions\instaspin_motion\boards\drv8312_revD\f28x\f2806xM\src”

    4. Copy the USER_MOTOR settings from the InstaSPIN-FOC user.h into the InstaSPIN-MOTION user.h

    5. Notice that there are now four new fields for MY_MOTOR:

    • USER_MOTOR_ENCODER_LINES – This should be set to the number of pulses on your motor’s encoder.  If your motor does not have an encoder, set this to 1.0.
    • USER_MOTOR_MAX_SPEED_KRPM – This should be set to the maximum speed that your motor can run.
    • USER_SYSTEM_INERTIA – We will determine this value as part of this lab.  Please set it the default value of 0.02.
    • USER_SYSTEM_FRICTION - We will determine this value as part of this lab.  Please set it the default value of 0.01.
  • I believe I have them: 2 and 3 below:

    1. row 129 - 138;

    2. row 338; row 355;

    3. row 363 - 379;

  • you have a typo, the names don't match. I do it all the time :)

    if you can't find it, attach the user.h and I'll fix

     

  • Checked it over again... and couldn't find it still...

    Could you pinpoint it for me?? 4300.user.h

  • does changing

    #if (USER_MOTOR == Estun_EMJ_04APB22) 

    to

    #elif (USER_MOTOR == Estun_EMJ_04APB22) 

     

    fix it?

  • It works fine now.

    Really appreciate and also sorry for such kind of "wasting-time" mistake...

  • Just reviewed the updated section of lab5c, you posted above. It's much better now.

    So, before applying SpinTAC controller, we DO need previous FOC labs to identify the system parameters (Rs, Ld/Lq, flux, etc.; current/voltage ADC offsets), right?

    I mean, could one ignore the FOC labs (lab1 ~ lab4) and directly run the motor by lab5s?

  • Yu,

    To run InstaSPIN-MOTION you need to have your USER_MOTOR parameters updated at a minimum. This either needs to come from Motor ID (recommended) or from a datasheet (may be ok if using a sensor).

    You can run Motor ID in any project, just be aware that if you need the special configuration done in proj_lab2c (for high speed / low inductance motors) you would need to have this logic in your main project to run Motor ID with those features, else it will use defautl features and you will have issues.  For "normal" motors you should be fine.

    I would say you can ignore the first 4 labs if you have run them before. If you have not, you should go through them at least once to understand the Params interface, the importance of the scaling variables, and how to save your motor and HW parameters.