Error using the C2000 CLA
9 ビュー (過去 30 日間)
I am working on an embedded project where the target hardware is a Texas Instruments C2000 F28379D MCU. I would like to utilize the CLA (on CPU1), but I experienced an issue that I cannot solve on my own. I am using Data Stores for the communication between the CLA and CPU. The data stores are allocated to the appropriate memory sections (CpuToClaMsgRAM and ClaToCpuMsgRAM).
My trigger sequence is the following: a PWM interrupt triggers an ADC conversion, then the ADC EOC triggers the CLA Task 1. I verify that the CLA is running (and measuring the speed) by toggling two GPIOs, one in the PWM interrupt, the other in the CLA interrupt.
Please note that the following snippet runs properly. I simplified the circuit and focused on the section where the code goes wrong.
This way, having the Constant block (sample time -1) to drive the input of the Gain block, the CLA is running as expected.
However, I would like for a variable to take the place of the Constant block, hence I use a Data Store Read Block. The data store it is linked to resides in the CpuToClaMsgRAM. The picture below shows the change.
Now, however, the CLA is not running. The GPIO toggled in the CLA interrupt is contant high (instead of toggling). Please note that the Data Store variable type is a custom Bus consisting of 3 single signals. The other two signals can be connected to their appropriate places and the CLA runs fine. If I connect either of the 3 signals to the Gain block pictured, the CLA does not execute.
Please help solve this problem with the CLA. I am happy to provide additional information if needed.
EDIT: Somehow the problem is the Sine block. If I remove the sine block, the CLA runs.
回答 (1 件)
Mukul Choudhury 2021 年 10 月 1 日
The CLA does not support sine function and has its own sine function defined in CLAMath Library provided by TI.
In order to caluclate sine of a value, use the "CLAsin()" function provided by TI. This can be done in Simulink by using a MATLAB function block and use the following statement to execute the function.
y = coder.ceval('CLAsin', u);
where u is the input to the sine block.
You can also refer to the example : c28035pmsmfoc_cla.slx where the sine function has been implemented.
In the example, look inside the park transformation block in the following path c28035pmsmfoc_cla/FOC Algorithm/Torque Control Algorithm/Generating Space Vectors/Generating Raw Space Vectors/Park Transformation to see the implementation of triginimetric function in CLA.
I hope this helps you. Please let me know if you have further queries.