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.

some questions on instaSPIN motion

Genius 5910 points
Other Parts Discussed in Thread: MOTORWARE, SYSBIOS

Hi,

 I have a lot of small questions on the Instaspin motion. I use a modified Lab13C

 - How do I read the current the motor used. Or do I have to calculate them from Ibias.

 - If I just want the motor to spin. in previous(intraspin FOC)  examples you give a value to gMotorVars.SpeedRef_krpm. Is the a way to let the motor just spinning at a given RPM with intaspin motion?

- If I make a function: Start controller, wait controller to become ready, Motor do something. Nothing happens, because the main loop is never served. so can I make a Interrupt timer routine for this functions. How fast needs it to be serviced?

- does CPU_USAGE.h Also work with Instraspin motion? Is there any document on how to use it.

- Is it correct that no timers are used in Proj_Lab13C?

- where is mainISR attached to the interrupt controller?

Can you please add some variable description text in typedef struct _MOTOR_Vars_t_ It is a bit short.

  • Evs,

    evs said:
     - How do I read the current the motor used. Or do I have to calculate them from Ibias.

    By current the motor used do you mean the current vector or do you mean DC bus current?  In Lab10b we calculate the current vector, Is.  You should be able to move this code into your lab.

    evs said:
     - If I just want the motor to spin. in previous(intraspin FOC)  examples you give a value to gMotorVars.SpeedRef_krpm. Is the a way to let the motor just spinning at a given RPM with intaspin motion?

    In InstaSPIN-MOTION Position solution there is a jog mode which will have the motor spin at a fixed speed.  This is implemented in Lab13e, but you can modify Lab13c to be able to switch between these two modes.  One caveat is that if you are trying to switch between the Velocity Mode and Position Mode the motor must be at 0 speed.

    evs said:
    - If I make a function: Start controller, wait controller to become ready, Motor do something. Nothing happens, because the main loop is never served. so can I make a Interrupt timer routine for this functions. How fast needs it to be serviced?

    You should be able to make a timer function that will service background tasks.  As far as how often this needs to be serviced, that is dependent on your application.  I've seen some applications where the background loop runs every 100ms and others at 5ms.

    evs said:
    - does CPU_USAGE.h Also work with Instraspin motion? Is there any document on how to use it.

    It should.  I have not tested this, but I see no reason it would not work.  I also don't have any documents about how to use it.  It should be pretty straight forward to integrate it into your project.

    evs said:
    - Is it correct that no timers are used in Proj_Lab13C?

    Correct, we do not use any timers in this project.

    evs said:
    Can you please add some variable description text in typedef struct _MOTOR_Vars_t_ It is a bit short.

    Thanks for the feedback.  We can try to add more text in the next software release.

  • let me answer a few then pass the rest to our MOTION expert

    evs said:
     - How do I read the current the motor used. Or do I have to calculate them from Ibias.

    we aren't measuring the inverter bus so you have to calculate it from the Iq and Id currents. We first make a value called gMotorVars.Is_A which is used in motion proj_lab10b

    this is the vector length of Iq and Id in the D-Q reference.  This is the active current being used but the motor is usually not getting the full voltage, so you can't use it directly as bus current.  You need to multiply / scale it by the amount of voltage being used out of the total available. The easiest way to do this is to create the scaling factor by using the real-time gMotorVars.Vs value (which will be between -1.33 and +1.33 for full modulation) and dividing by 1.33.  This will give you a % of voltage being applied which you can use to scale your Is into an Ibus.

    There is a post yesterday where someone is also using a different trick by substituting in (Flux_VpHz * Freq_Hz) / Vbus for the scaled % of voltage.  This can work in some cases but isn't as accurate, especially when you have Vs available.

    evs said:
     - If I just want the motor to spin. in previous(intraspin FOC)  examples you give a value to gMotorVars.SpeedRef_krpm. Is the a way to let the motor just spinning at a given RPM with intaspin motion?

    The MOTION labs use the same variable as the Speed Reference input, but you also need to select a curve type, acceleration (you also need this in FOC), and any applicable trajectory limitations.

    evs said:
    - does CPU_USAGE.h Also work with Instraspin motion? Is there any document on how to use it

    Yes, I'm sure. I'll let Adam comment.

    evs said:
    - Is it correct that no timers are used in Proj_Lab13C?

    We are certainly using the ePWM1 timer as our main time base. I don't recall in this lab if we are using additional CPU timers for anything. I'll let Adam comment.

    evs said:
    - where is mainISR attached to the interrupt controller?

    done in the HAL layer. Read the tutorial here:

    C:\ti\motorware\motorware_1_01_00_13\docs\tutorials

  • Adam and Chris thanks for the reply.

     I have a problem with the Interrupt priority Can't find anything about it in the documentation:

     I have added a 100us Systemtimer and every 10ms The Intraspin mainloop code is called.

     Green is MainISR and yellow is the main code. So If the main control code is called the MainISR is stalled. So how do I change interrupt priory of is it possible to move MainISR to the CLA?(howto)

      I don't understand .Why you have to redo the current calculation? The motor current with a factor is available(aka torque).  where Can I find Id and Iq the angle between them is the motor current.

  • evs said:
    every 10ms The Intraspin mainloop code is called.

    Please clarify what you mean by "mainloop"

    to talk in the language or our proj_lab##.c, do you mean

    void main(void) // I assume this one

    or

    interrupt void mainISR(void) // I assume this is what you mean by MainISR which gets stalled

    It seems like your Systimer has higher priority or has set the main(void) to higher priority and that's the larger problem.  Obviously the mainISR needs to have highest priority.

    You are using SYSBIOS?

  • I moved all the code from the main for (;;) loop to a timer interrupt function.  After searching all the the documentation I did not find any interrupt priority system. Wow a controller designed for power electronics and I can 't control how the interrupt are handled.

     To solve it, I made a 5 state statemachine in my systemtimer interrupt function.

    Only these functions:

    (gMotorVars.Rr_Ohm = EST_getRr_Ohm(obj->estHandle))

    gMotorVars.Rs_Ohm = EST_getRs_Ohm(obj->estHandle);

    gMotorVars.Lsd_H = EST_getLs_d_H(obj->estHandle);

    gMotorVars.Lsq_H = EST_getLs_q_H(obj->estHandle);

     Take app 50uS each to execute. That is a really long time for a get function.

    So I moved them out of the updateGlobalVariables_motor function and move them to an other place in my state machine to apportion the state machine timing.I don't know If i can do that.  Have those function dependency to other functions (timing/execution order)?

  • For information about interrupt priority you need to look at the F28069M Technical Reference Guide.  Specifically section 1.6.3.4

    Those variables are only used for information purposes.  So you shouldn't need to include them in your project if you don't want to.