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.

TMS320F28388D: Loading Matlab Simulink on CPU1/2 and EtherCAT on CM

Part Number: TMS320F28388D
Other Parts Discussed in Thread: C2000WARE

Hi all,

I would like run a Matlab/Simulink model on CPU1/2 and keep the Ethercat connectivity on the CM.

Unfortunately EtherCAT is not supported on Simulink.

My initial attempt was to run my Simulink on CPU1 and send data to the CM via IPC and then do my Ethercat Application code for the CM on Code Composer. But l;ater on, I realised I need CPU1 to at least do the Setup EtherCAT GPIOs, Allocate Ethercat to CM, Setup CM clocks and release from reset to Wait Boot Mode and release from wait boot. After that I was like, fine I will run my simulink only on CPU2, so I can keep CPU1 to do so, but apparently using Simulink it uses both CPU1 and CPU2.

So my question is: Is there a way to run a Simulink model on CPU1/2 and keep the EtherCAT connectivity on the CM?

If yes, how can I setup and allocate all the config for the EtherCAT and release the CM from reset.

Thank you

  • Hi Alexis,

    I am reaching out to MathWorks engineer to help us on this. We should expect response by Monday.

    Thanks & Regards,

    Santosh

  • Hi Alexis,

    The workflow which you are looking for is already supported in Simulink. You can configure the GPIOs required for etherCAT on CPU1 and run your application on CPU2. If you need to run EtherCAT application code on CM, you may either use the custom code blocks to include the required code with the code generated from Simulink or add the custom code files in the project folder and include the file names under configuration parameters--> code generation--> custom code. Also, ensure that the same settings need to be done under configuration parameters--> Simulation Target --> custom code.

    For the custom code blocks approach, you may refer to the below FAQ:

    https://in.mathworks.com/matlabcentral/answers/673888-how-do-i-use-simulink-custom-code-blocks-to-measure-code-execution-time-on-ti-c2000

    If you have any other questions, please contact MathWorks support channel. When we have a support ticket, our internal process enables us to involve right people on this issue and we will immediately get in touch with you to understand the case in more detailed way. Please connect to us at:

    https://www.mathworks.com/support.html

    Regards,

    Ram Alla.

  • Hi Alexis,

    We got a similar setup to you implemented using Matlab System (Implement a MATLAB System Block - MATLAB & Simulink - MathWorks Benelux) blocks to extend the Simulink Models with C code. As well as modifying the memory CMD file and the dictionary from Embedded Coder to create memory sections for larger IPC transfers. I based this on the example projects given in C2000ware but it takes some effort getting it all to work. I can share some details over direct message if you would like some help.

    Kind regards,

    Gert

  • Hi Gert, 

    Thank you so much, indeed, now that I know it is feasible, I am not sure where to start from.

    If I understand it correctly you are using custom code blocks to integrate C code into Simulink blocks for the CM (EtherCAT communication), then configure the GPIOs required for etherCAT on CPU1 and run your Simulink application on CPU2. So you have a total of 3 different Simulink models?

    I will dig a little bit with custom code blocks first and I will probably direct message you Gert.

    Thanks again,

    Alexis

  • Alexi,

    I will put the thread in 'Waiting for Customer'. Please let us know when you explored 'Custom Code Block' and if you need further help from MathWorks team.

    Thanks & Regards,

    Santosh