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.

Implementing Simulink model on F28069M

Other Parts Discussed in Thread: MOTORWARE, DRV8312

Gautam Iyer said:

Officially CCSv3.3 is supported but this version is no more available for download on TI website. CCS v4 too is supported but proper documentation is unavailable.

I've also heard the news that Matlab is working to bring back the support for C2000 controllers that would be compatible with CCSv6. Not suare, when!

Regards,

Gautam

Gautam,

Thanks for the help.

I have another question: Is it possible to make use of the InstaSPIN-Motion control in my Simulink model? The model contains the desired speed of the pedals of an electric bike, from which the needed motor speed can be calculated (making use of the current speed of the pedals, the used transmission and the losses). So this calculated desired motor speed, which is constantly changing and calculated in real-time, should be the input of the InstaSPIN-Motion module.

Do you have an idea of how to do this? Or would it be necessary to write the code for this directly in CCS?

  • ThomasV said:
    Do you have an idea of how to do this? Or would it be necessary to write the code for this directly in CCS?

    As far as I'm aware of, there are no models for insta-spin solutions available in simulink. You need to use the in-built libraries which come with insta-spin parts that can be implemented through CCS.

    (I'm also looping in the Insta-spin Expert - Mr Chris)

    Regards,

    Gautam

  • This is a complicated question to answer.

    Regarding InstaSPIN-FOC and InstaSPIN-MOTION, we are not releasing Simulink models of any of the code / functions because Simulink models are not secure enough for our liking. We would be jeopardizing our software IP.

    There are ways however to use the InstaSPIN-FOC and -MOTION software in a simulation, and that is by putting the Processor - running an embedded project which use the InstaSPIN ROM - In the simulation Loop (PIL).

    In this case the simulation generates the digital conversions of the voltages and currents in the inverter and passes them to the embedded project running on chip. The InstaSPIN control loops run, producing their Ta, Tb, Tc values for the PWM, the process halts, and those values are passed back to the simulation where the inverter and plant are updated.  This is a pretty incredible capability because you are testing the ACTUAL embedded project calling the ACTUAL ROM functions.

    The downsides? 

    • It takes MUCH longer than real-time to run these models. Minutes of real-time becomes hours of simulation.
    • You need to use MotorWare and create full, working embedded projects - which some special hooks for the PIL - which are setting things up correctly. You can't simulate this piece or just use a generic "block" like in some sims.

    Support for this is about to be released by one of the simulation vendors...I will update this post once public.

    There are also some options for using these types of tools actually create the MotorWare project for you, allowing you to create the embedded code through the PC / Sim interface and then interacting with the hardware in the loop (HIL).   But this doesn't make the connection from InstaSPIN to your plant model.

    Support for this is somewhat public (I'm checking with the company to see what I can say...)

    Regarding the Mathworks Simulink products, I'll forward this post to them and see if they want to comment.  I also encourage you to reach out to them as direct customer feedback on requirements carries more weight than what their partners tell them :)

  • Thanks Chris.
     Correct. Hand integration of Simulink generated code with InstaSPIN hand code is currently the best solution. For more information on Simulink model protection (incl. AES-256 encryption), see Simulink documentation, here
    For more information on Simulink PIL verification (incl. optimized code generation), see Embedded Coder video, here.
     Thanks,
    Anuja Apte

     

    posted RE: Implementing Simulink model on F28069M

  • Though there isn't any InstaSPIN support in MathWorks products, the shipping examples will allow you to instantly spin motors with multiple TI Motor Control kits.

    You can download the Embedded Coder Support Package for TI C2000 processors at this location:

    http://www.mathworks.com/matlabcentral/fileexchange/43096-embedded-coder-support-package-for-texas-instruments-c2000-processors 

    It supports CCSv3.3 with full IDE automation from MATLAB. CCSv4 and v5 are supported via a makefile approach, the debug scripting tool of CCSv4 or v5 is used to automatically download the code onto the target. The fact that CCSv6 provides the same debug scripting tool makes it compatible with CCS v5. In other words, while running the MathWorks installation steps for CCSv5, you can point to the CCSv6 installation folder and you will be able to generate code from Simulink, compile it with the compiler installed with CCv6 and download the code with the debug scripting tool provided with CCSv6.

    After installation, at the MATLAB prompt type:

    c28069pmsmfoc_ert for a 3-phase field oriented motor control example running on the DRV8312 kit (http://www.ti.com/tool/drv8312-c2-kit)

    c28035pmsmfoc_ert: The same as above on F28035

    c28M35xpmsmfoc_ert: The same on F28M35

    c28M36xpmsmfoc_ert: The same on F28M36

    c28069pmsmfoc_cla: The same on F28069 with the FOC algorithm running on the CLA

    c28035pmsmfoc_cla: The same on F28035 with the FOC algorithm running on the CLA

    c28035pmsmfocdual: One F28035 controlling 2 motors on the Dual Motor Control and PFC Developer's Kit:  http://www.ti.com/tool/tmds2mtrpfckit

    You can download an example that will spin a 3-phase motor with the TI C2000 Launchpad + Motor Drive Booster pack at the following page. This page contains a video that will walk you through the details of the motor control model:

    www.mathworks.com/matlabcentral/fileexchange/45124-motor-control-with-ti-Launchpad

    Send an email to c2000_expert@mathworks.com to get an example running on the TMDSHVMTRPFCKIT high voltage kit (http://www.ti.com/tool/tmdshvmtrpfckit).

    All these examples are running field oriented control with Simulink blocks that you can simulate (except for driver blocks). ADC conversions are triggered from PWM events, the FOC algorithm is launched from the ADC end of conversion interrupt, stand alone execution is provided with one checkbox, a right-click on a subsystem allows you place the related code in ramfuncs for a load in flash and a fast execution in RAM with a copy at startup, etc. All these advanced embedded concept are brought at the Simulink level to create the best embedded programming experience.

    I hope it helps,

     

    Antonin for MathWorks.

  • Support for this is about to be released by one of the simulation vendors...I will update this post once public.

    Any hint of this yet?   I know Matlab 2015 was released recently, but haven't seen if it's working with CCSv6.    

    If I understand the flow correctly, while Simulink's embedded coder can generate C2000 code, if you need to do InstaSpin modeling then it must connect (PIL/HIL) to the actual target via CCS.       And only CCSv3.3 is the last version of this to be well documented to integrate with Simulink?

  • MATLAB R2015a supports CCSv6 via a makefile approach for code generation.

    The dependency between MATLAB and CCS is fairly slim with this workflow as MATLAB only depends on the compiler and a command line tool (dss.bat) provided by CCS to load and run the generated executable.

    You can run PIL simulations using a serial connection between MATLAB and your board with CCSv6. Here is a link to the documentation referring to TI C2000 as an example:

    http://www.mathworks.com/help/ecoder/ug/pil-simulation-for-ide-and-toolchain-targets.html

    This is faster than the old infrastructure interacting with CCSv3.3 to communicate with the board.

    I hope it helps,

    Thanks,

    Antonin.