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.

Example InstaSPIN-FOC Code

Other Parts Discussed in Thread: MOTORWARE, LAUNCHXL-F28027F

Could anyone provide me with some code examples of controlling a motor with InstaSPIN-FOC?  I've seen the code in the labs but I can't believe that 30 different files (not including headers) would be necessary just to spin the motor.  I mean, I should be able to just define some motor parameters then call a single function that turns the motor on right?  

I've tried looking through the API Documentation in Motorware but I don't find it a good environment for learning what the objects actually do or how to use them.  I also don't want to use the GUI as I want to program my own instructions to the motor.  

So, I would love it if someone could provide me with simple example code of running a motor.  For reference, I'm using a BLDC motor with LAUNCHXL-F28027F with BOOST-DRV8301 Booster Pack and running CCS v5.5.

  • Sorry you don't like the modularity of MotorWare, but all the files are required.  

    You should do setup of your user.h and motor ID using proj_lab02b or 2c (if you have a high speed motor) and then you can move to 5b or 10, these are the most commonly used initially. 

    Run MotorWare.exe and follow the project and labs UG. 

  • Well that's alright, the layout of motorware isn't really what's bothering me, it's figuring out how to program the board that I'm having problems with.  I have gone through all the labs that apply to my board successfully already, but I didn't find them very helpful in teaching me how to write my own code or control the system outside of the lab setting.  Am I alone in this?  or do other people simply not write their own code and only use the Labs and GUI provided?  

    Also, Chris, could I message you directly with some problems I'm having with a motor?  I don't think it would warrant another forum post.  (It's a different motor than the one I completed the labs with.)

  • Bradley Odhner said:
    I have gone through all the labs that apply to my board successfully already, but I didn't find them very helpful in teaching me how to write my own code or control the system outside of the lab setting.  Am I alone in this?  or do other people simply not write their own code and only use the Labs and GUI provided?

    I don't think you are alone.  This is the area where we have certainly recieved the most feedback and request for assistance.  In this last version of MotorWare (_13) we started trying to address this with some tutorials.

    The first is on the HAL, which is where you make most modifications for using peripherals outside of the control system. Included in this is SOME code examples for what would be needed to add to your main.c (proj_lab##.c) but it certainly isn't everything....we aren't at the point of trying to teach / give examples of system level coding, we are leaving that to users as they create their own product.

    some discussion on this topic here:

    http://e2e.ti.com/support/microcontrollers/c2000/f/902/t/347563.aspx

    the tutorials are here:

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

  • Bradley Odhner said:
    Also, Chris, could I message you directly with some problems I'm having with a motor?  I don't think it would warrant another forum post.  (It's a different motor than the one I completed the labs with.)

    I prefer to have these posted on the forum directly.

    1. the direct messaging system is kind of a pain to post/reply on, especially on mobile where I often am

    2. having the topic on the forum allows for others to learn, either immediately or in the future through search

    thanks