- 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.
Simulink for Texas Instruments C2000 microcontrollers CLA: cannot open source file "cla_header.h" in the LAUNCHXL-F28379D
조회 수: 19(최근 30일)
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 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
### 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?
Mukul Choudhury 2021년 6월 15일
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,
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.