"Data type mismatch" error in Embedded Coder Support Package for Texas Instruments C2000 Processors Simulink model
12 views (last 30 days)
Show older comments
Dear friends,
I am working with the Embedded Coder Support Package for Texas Instruments C2000 Processors package for Simulink and trying to implement a certain type of control system. For this, I need to measure two currents and take the Clarke Transformation of them.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/170023/image.png)
Inside this "Current Sensors" subsystem, I have this:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/170024/image.png)
Just measuring two AC currents and removing the offset given by an external conditioning circuit. The "DTC" blocks (Data Type Conversion) are used a lot in my program, since some Texas Instruments blocks requires a certain type of data.
They are all set as "Inherit: Inherit via back propagation", so they will adequate the data type according to the next block. But it doesn't work in this section of the model... and I don't know why.
Basically, I got this error message:
Data type mismatch. The internal rule determines the output of 'TCC_CPU1/Clarke Transformation/Multiply by 2' to be a signal of data type 'sfix32_En16'. However, it is driving a signal of data type 'sfix32_En21'.
Why are the DTC block generating a "sfix32_En21" type, if the "Clarke Transformation" block requires a "sfix32_en16"? Checking the "Clarke Transformation" block, we got this:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/170026/image.png)
It seems that the "DTC A" block is working properly, but the "DTC B" isn't. If I change manually the "DTC B" block from "Inherit: Inherit via back propagation" to "sfix32_En16", I got this error message:
Invalid setting in 'TCC_CPU1/Current Sensors/DTC B' for parameter 'OutDataTypeStr'.
Caused by:
Error evaluating parameter 'OutDataTypeStr' in 'TCC_CPU1/Current Sensors/DTC B'
Undefined function or variable 'sfix32_En16'.
Variable 'sfix32_En16' does not exist.
I am using another 5 "Data Type Conversion" blocks, and none of them give me problems. But this one, specifically, is giving me a headache.
Someone knows how to solve this?
Thank you, Gabriel
1 Comment
Yaki
on 7 Apr 2023
Where did you find the CLARKE transformation to be used with TI DSP's? We need AB/DQ blocks as well....did you install something in particular. We think we are all set, but this CLARKE block doesn't appears to us.
Thanks in advance.
Answers (1)
Lokesh
on 25 Jul 2024
Hi Gabriel,
I am writing in response to the second error you are encountering: "Undefined function or variable 'sfix32_En16'. Variable 'sfix32_En16' does not exist." The term 'sfix32_En16' denotes a signed fixed-point 32-bit number with 16 fractional bits.
The correct syntax to set the 'OutDataTypeStr' to 'sfix32_En16' is "fixdt(1, 32, 16)". The first argument indicates whether the number is signed or unsigned (1 for signed and 0 for unsigned), the second argument specifies the total number of bits, and the third argument specifies the number of fractional bits.
You may refer to the following documentation for more information on 'fixdt':
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!