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.

LAUNCHXL-F28P65X: Help Needed: Integrating PLECS-Generated TI C2000 Code into EtherCAT (SSC) Project — Build Errors

Part Number: LAUNCHXL-F28P65X

Dear TI Support Team,


I hope you are well.
We are currently working on a project where we generate C code from a PLECS model using TI C2000 blocks. The generated code is then integrated into a Beckhoff SSC (Slave Stack Code) project. Our goal is to develop a TI F28P650DK9 microcontroller as an EtherCAT slave to control power electronic stages. Please could you reply as soon as possible, as my thesis deadline is at the end of February.


When we generate code from PLECS, it creates multiple files. From these files, we mainly use the model .c/.h files and the generated HAL.c file. However, when we include the generated HAL.c file directly into our CCS-based TI Echoback example project as the backbone of our experiment in CCS, we get many compilation errors (mainly conflicts with driverlib, GPIO configuration, and initialization code). Because of this, the project does not build.

current controller model I made in PLECS.

PLECS generated files with TI Blocks  the highlithed ones were include in the CCS project.

As a temporary workaround, we are currently creating our own custom plx_hal.c and plx_hal.h files and only implementing the required functions manually. This works, but we do not want to continue this way in the future.

workspace tree with the custom made plx_hal.c and .h files while the plecs generated hal.c file excluded also the main project framework project used here was F28p65x_CPU1_Echoback_example provided by TI. 

the errors I get after only running the code with the plecs generated hal.c files instead of using my custom plx_hal.c and .h files

I’m getting a build failure because the compiler can’t find the header file plx_hal.h. The key error lines I’m including below show the exact files/lines where it fails, and that the build stops because of these errors (the other messages are warnings and aren’t stopping the build).

Important lines to paste:

  • [57] "../f28p65x_cpu1_echoback_solution/led_feedback_c2000_block.c", line 41: fatal error #1965: cannot open source file "plx_hal.h"
  • [58] 1 catastrophic error detected in the compilation of "../f28p65x_cpu1_echoback_solution/led_feedback_c2000_block.c".
  • [59] Compilation terminated.
  • [63] "../f28p65x_cpu1_echoback_solution/led_feedback_c2000_block_hal.c", line 9: fatal error #1965: cannot open source file "plx_hal.h"
  • [64] 1 catastrophic error detected in the compilation of "../f28p65x_cpu1_echoback_solution/led_feedback_c2000_block_hal.c".
  • [65] Compilation terminated.
  • [108] gmake: Target 'all' not remade because of errors.

 

 

For your reference I have also attached my self-made plx_hal.c / .h files that I am currently using and also the hal.c file generated by plecs that is currently excluded from my project. Also I am attaching the .xml file generated from SSC and also the custom PDO’s .xlsx file I made for the project and the zip file for the complete working project “f28p65x_cpu1_echoback_solution.zip” but the custom plx_hal.c/.h are not included in the given file  and the plecs generated files “PWM Model.zip”.


Could you please advise what the recommended and clean solution is for integrating PLECS-generated TI code into an existing SSC EtherCAT project?

  • Is there a specific workflow for combining PLECS code (with TI Blocks ) with EtherCAT slave files generated from SSC “Slave Stack Code” in CCS?
  • Should the generated HAL.c file be modified or partially excluded?
  • Is there a recommended way to avoid these errors?

We would really appreciate your guidance on the correct integration approach.
Thank you very much for your support.

 

Moiz Zaheer Malik

led_feedback.xml 

led_feedback.xlsx

f28p65x_cpu1_echoback_solution.zip 

PWM model.zip

led_feedback_c2000_block_hal.c 

plx_hal.c

 plx_hal.h 

  • Hi , 

    As I had already responded earlier , we cannot test custom code at our end.

    Least I can do is tell that you can check for proper include path for any external headers that were used by software and add it in compiler settings( Right click project->properties) , and i cannot comment on the custom codes.

    Regards

    Kunal.

  • Hi Kunal,

    Thank you for your reply. I understand that you cannot test custom code on your side. I only shared my files as a reference so you could see how the project is structured.

    My main question is about the recommended workflow.

    At the start of the project I used the CPU1 Echoback example from TI as the base project. Then I generated the EtherCAT slave files from SSC and integrated them into that project.

    Before using TI blocks in PLECS, I first tested with generic blocks. In that case PLECS only generated a simple .c and .h file and integrating them worked fine.

    However, when using PLECS TI blocks, the code generation produces many additional files. I included a screenshot of those files in my post.

    So my main questions are:

    1) Is the CPU1 Echoback example the correct base project to keep using for this kind of setup, or is there another recommended template when integrating:

    * PLECS generated code (TI blocks)

    * EtherCAT slave stack files generated from SSC?

    2) When creating a new project in SSC for a custom application, is there a preferred configuration or starting point?
    At the moment when we generate the SSC files it also includes files from the Echoback example (like the .c, .h, and objects.h) together with our custom PDO configuration. Because of this I am not sure if we are expected to continue using the Echoback example as the base every time, or if there is another recommended approach.

    So far I have done several tests combining the PLECS generated model code and the SSC slave files, and most things are working. I just want to make sure that I am following the correct development workflow.

    Any guidance would be really helpful.

    Best regards,
    Moiz

  • You will have to get in contact with PLECS company support.