Simulink for Texas Instruments C2000 microcontrollers CLA: cannot open source file "cla_header.h" in the LAUNCHXL-F28379D
22 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Dear all,
I am trying to configure the Control Law Accelerator (CLA) for my LAUNCHXL-F28379D launchpad, based on the TMS320F28379D microcontroller. I am getting an error when trying to compile my model:
The "Main Routine - CPU1" works fine, as it was already tested. I included the "CLA Task Trigger", which is triggered by ePWM1. The variable that is passed from "Main Rotine - CPU1" to "Auxiliary Routine - CLA1" is only "theta_e" (for now), and it is defined in the main level by the "Data Store Memory" block. "System Initialize" only turns on two pullup resistors, and have no relevancy here. Excluding the right-side of the model (CLA Task Trigger, its subsystem and the global variable), the model works as intended.
By adding the CLA, even searching a lot, I could not find a solution to the problem caused. The section of the Diagnostic Viewer that describes the error is the one that follows:
"C:/Users/Gabriel/Documents/MATLAB/C2000_Programming/BOOSTXL_3PhGaNInv_Test/BOOSTXL_3PhGaNInv_Test_CPU1_L4_ert_rtw/cla_task.cla", line 1: fatal error: cannot open source file "cla_header.h"
1 catastrophic error detected in the compilation of "C:/Users/Gabriel/Documents/MATLAB/C2000_Programming/BOOSTXL_3PhGaNInv_Test/BOOSTXL_3PhGaNInv_Test_CPU1_L4_ert_rtw/cla_task.cla".
Compilation terminated.
>> Compilation failure
gmake: *** [cla_task.obj] Error 1
gmake: *** Waiting for unfinished jobs....
"C:/ProgramData/MATLAB/SupportPackages/R2020b/toolbox/target/supportpackages/tic2000/src/MW_c28xIPC.c", line 1342: warning: variable "CheckSTSFlag" is used before its value is set
C:\Users\Gabriel\Documents\MATLAB\C2000_Programming\BOOSTXL_3PhGaNInv_Test\BOOSTXL_3PhGaNInv_Test_CPU1_L4_ert_rtw>echo The make command returned an error of 2
The make command returned an error of 2
C:\Users\Gabriel\Documents\MATLAB\C2000_Programming\BOOSTXL_3PhGaNInv_Test\BOOSTXL_3PhGaNInv_Test_CPU1_L4_ert_rtw>exit 1
### Build procedure for BOOSTXL_3PhGaNInv_Test_CPU1_L4 aborted due to an error.
It seems that the file "cla_header.h" could not be opened. I tried to debug it myself, and have some useful information that might be helpful:
- It seems that the block "CLA Task Trigger" needs something that is causing the problem. Without it, the model is buildable.
- In the "Using the Control Law Accelerator (CLA)" page (available at https://www.mathworks.com/help/supportpkg/texasinstrumentsc2000/ug/using-the-control-law-accelerator-cla.html), in the "Data Exchange between the CLA and the C28x CPU" section, I cannot set the custom memory sections. The tab "Signal Attributes" of the "DataStoreMemory" block does not contain the "Code Generation" area. The same happens to the "Signal Properties", even though I created said settings according to https://e2e.ti.com/support/microcontrollers/c2000/f/171/t/943935
- By acessing the models available at the "Using the Control Law Accelerator (CLA)" page, especially the "c28379D_cpu1_blink_cla.slx", the model is buildable without any error, even though it contains a "CLA Task Trigger" block. This leads me to think that the "cla_header.h" issue is some configuration with my model/file that is missing/wrong. I still cannot set/view the custom memory sections in MATLAB's example, as mentioned above.
- I already set the CLA subsystem to run "Inline", as mentioned by the "Using the Control Law Accelerator (CLA)" page.
- If I copy all blocks from my model into the "c28379D_cpu1_blink_cla.slx" example and delete all the original blocks, I still get the same error.
- If I coppy all blocks from the "c28379D_cpu1_blink_cla.slx" example into my .slx file and delete all my blocks, I still get the same error.
- The solution provided by Brian McKay in the post "https://www.mathworks.com/matlabcentral/answers/294905-running-the-using-the-control-law-accelerator-cla-example-in-f28069-controlstick" did not work. I tried to change to all other paths in the "C:\ti\controlSUITE\libs\math\CLAmath" folder, but none have worked.
I have worked for several hours in this issue, but it is still persistent. Could anyone help me? How can I effectively implement the CLA in my F28379D launchpad?
Best regards,
Gabriel
1 comentario
Rob de Kluijver
el 5 de Mayo de 2021
Hi Gabriel,
I encountered the same problem so I started from scratch. That's a copy of the CPU1 blink example for your board. (I have the same board.) This example builds, loads and blinks. Then I modified it to the first model. This also works. Both LEDs should be blinking. Then I used only the eCAP to trigger the task. This builds and loads. The eCAP is running. I can see that with the logic analyzer on P2. However the CLA task is not started. Next is the removal of the data store from the first test. This results is a your build error. The file is also not present in the build directory. I copied it but it got removed. My solution for the moment is to keep the data store. That solves the building problem. The workaround for the CLA triggering is to also include the interrupt, in my case the CAP1 interrupt, in the interrupt handlers.
My overall conclusion on working with the CCS toolchain and the embedded coder is that both tools have serious problems. The latest CCS toolchain doesn't even work in the IDE. Solution there is to switch to an older version. (10.1) Maybe this is the solution for the embedded coder to. I now have 2021a. I can't remember if I used the CLA in 2019a my previous version.
Regards,
Rob.
Respuestas (1)
Mukul Choudhury
el 15 de Jun. de 2021
Hi Gabriel,
cla_header.h is the file where the data stores, signals and states accesible by cla are declared. Could you please check, if the file is generated or not in the directory by only generating code.
If not, store the data store in the memory section "CpuToCla1MsgRam". To do so follow the link below:
You have to store the data store in "Cpu1ToCla1MsgRam" through embedded coder dictionary.
The steps are as follows:
1) Go to Apps and open "Embedded Coder". A tab name "code mappings" section will appear on the bottom left hand corner of the simulink window.
2) Ensure "tic2000demospkg" is loaded in your model. If not loaded,
- Open embedded coder dictionary from C Code -> Code Interface -> Embedded Coder Dictionary.
- In the embedded coder dictionary select the "tic200demospkg" from the drop down that after clicking on Manage Packages ->refresh and then select load.
3) Click on the "Code Mappings" tab on the bottom left hand corner of Simulink window to enlarge it.
4) For data stores, go to "Data Stores" tab. You will find the data store used in your model. Select the storage class as "CpuToCla1MsgRam" for the data stores going to cla from cpu.
5) Similarly set the storage class for the signals in and out of the cla in the "Signals/States" tab.
Also, I noticed that you mentioned that you are triggering cla task using EPWM interrupt. Please ensure, while doing so you also use the CLA end of the task CPU interrupt to perform some task at the end of CLA task. This is required as the EPWM interrupt flag will not be cleared if you just use the CLA task and future interrupts will be blocked as the EPWM interrupt flag is cleared at the end of the cla task while using the End of the task ISR.
Please don't hesitate to comment if you need any further clarification.
Thanks,
Mukul
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!