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.

InstaSPIN with TI/SysBios

Other Parts Discussed in Thread: SYSBIOS

Hello,

are there any drawbacks when using InstaSPIN combined with TI/SysBios? If I want to convert an example to be used within SysBios, do I only have to put the main loop part in a Bios/Task? How often needs this task loop be called?

Sebastian

  • Sebastian,

    There are no drawbacks to using SYS/BIOS and InstaSpin.  They are complementary products.  I've personally implemented real time control applications within the context of SYS/BIOS and surprisingly enough, the application worked better when implemented with SYS/BIOS than without.

    Certainly the main loop will need to be placed inside a task.  Looking at what the main loop does, you probably only need to execute it every 100ms or so.

    The tricky part will be figuring out what to do with all the control interrupts.  These need to be run with as little delay as possible.  You can try plugging these interrupts into the HWI module, but the HWI dispatcher will add some latency.  This might work, or it might not.  

    Your other option for interrupts is to unplug them from BIOS and to let the normal hardware mechanism (PIE) dispatch these interrupts.  This is how I implemented my real time control application with BIOS, and is what I'd recommend you do.  There is some information on how to do this here:

    http://processors.wiki.ti.com/index.php/SYS/BIOS_for_the_28x

    Look for the section called Minimal Latency Interrupts.

    Let me know if you have more questions,

  • we are doing an example of this when running 2 motors with InstaSPIN-FOC....target release is late this year or early next. We have some new HW late this summer coming.

     

  • Hello,

    good to hear that it should work without any problems.

    my project was based on proj_lab03, that is just using InstaSPIN-FOC. I have setup the mainISR in the same way as it is in the examples. The main loop part runs inside a SysBios task. This worked fine without any problems.

    Now I try to add InstaSPIN-MOTION witt encoder support. Therefore I looked in proj_lab12 and copied all the necessary things in my project. But when I start my application, I have strange issues:

    - I have setup a bios clock with a period of 1ms. I can see that it works fine, because in the mainISR i write the

    tick into a global variable that I can see in the debugger.

    - I activated the task loop by setting Flag_enableSys and Flag_Run_Identify to true.

    - After the EstState changed to EST_State_Rs it stays in this state for several seconds.

    - Then nothing happens and my tick-variable gets increased very slowly (only every seconds or so instead of milli-seconds)

    The next thing I tried was to setup my own timer (not timer2, Iused timer0 but also with 1ms period) and call Clock_tick() myself. This worked fine, but the same thing happend as I described above when activating the task loop.

    I really do not understand this, because the clock tick gets increased in a timer interrupt. And this configuration is independent from the BIOS or the motor software. But it looks like something is going on that slows down my timer interrupt.

    Do you have any idea?

    Sebastian

  • Sebastian,

    That is very interesting.  I wouldn't expect that the mainISR would be consuming so much processor that it is slowing down your timer interrupt.  

    Does the estimator ever leave EST_State_Rs and go into EST_State_OnLine?

    Have you ran this motor in lab 12 w/o the SysBios before?

  • Hi,

    yes I already run this motor in lab 12 without any problems. Everything works fine and this is the reason I want to switch from InstaSPIN-FOC to InstaSPIN-MOTION.

    I have setup a minimal example using SysBios with InstaSPIN-MOTION based on lab 12.

    8030.Bios_with_InstaSPIN-MOTION_based_on_lab_12.zip

    I have configured SysBios to produce a clock with 1ms period. In The Expressions window I have added

    (&ti_sysbios_knl_Clock_Module__state__V)->ticks

    With continuous refresh enabled I can see that the counter increases with approximately 1ms.

    Then I activated the main loop by setting Flag_enableSys and Flag_Run_Identify to true. The states of the controller and the estimator changes and the tick counter is still increasing with 1ms,

    The estimator stays fpr several seconds in the "EST_State_Rs" state. Then it switches to  "EST_State_OnLine" state and the motor is moving. But then I see that the tick counter is gets increased onl with round about 100µs. Something strange is going on.

    NOTE: Sometimes it happens, that the estimator stays in the "EST_State_Rs" state and the motor is not moving. Until then the tick counter behaves as expected. Then I manually rotate the rotor a bit and immediately the estimator changes to "EST_State_OnLine". And at thi point the tick counter gets increased very slowly.

    How can this happen?

    Sebastian

  • Sebastian,

    Which version of the compiler are you using?  You can check by selecting Help -> About Code Composer -> Installation Details and looking at the C2800 Compiler Tools.  I want to make sure your compiler is at least 6.2.3 or greater.  With the 6.2.0 compiler there is an issue with IQMath that causes some strange behavior.

    The debug step I would recommend is start commenting out the MOTION functions.  Start with ST_runVelCtl and run the system, than comment out ST_runPosConv and run the system.  This should help us identify where the issue lies.