Scaling Error Writing Real Transformation Fixed Point Scaled Parameters in Freemaster

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Scaling Error Writing Real Transformation Fixed Point Scaled Parameters in Freemaster

跳至解决方案
2,008 次查看
ericrost
Contributor II

When I build and deploy the attached model to a S32K144 and connect to the MCU using freemaster there are several values that cannot be written to the "scaled_parameter" that is present in the model. The GPIO pin that is being manipulated is simply to avoid removal of the parameter by the code generation optimizations in Simulink Embedded Coder.

For example, if a real value of 0.3 (uint16 value 3) is written through the attached freemaster project's Variable Watch, a value of 0.2 is read back (uint16 value 2), there are several other values that are not possible to write.

scaled_param_write_0.3.png

scaled_param_readback_0.2.png

I can work around this by doing the real scaling in my javascript, but this is a fairly major regression in a tool meant to manipulate fixed point scaled values.

The model is created with the following tool versions, and the latest HotFix for the MBD Toolbox has been installed as well:

-----------------------------------------------------------------------------------------------------
MATLAB Version: 9.8.0.1721703 (R2020a) Update 7
Operating System: Microsoft Windows 10 Enterprise Version 10.0 (Build 19043)
Java Version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
-----------------------------------------------------------------------------------------------------
MATLAB Version 9.8 (R2020a)
Simulink Version 10.1 (R2020a)
AUTOSAR Blockset Version 2.2 (R2020a)
Embedded Coder Version 7.4 (R2020a)
Fixed-Point Designer Version 7.0 (R2020a)
MATLAB Coder Version 5.0 (R2020a)
MATLAB Report Generator Version 5.8 (R2020a)
Model-Based Design Toolbox for S32K1xx Series Version 4.2.0 (R2016a-R2020a)
Simscape Version 4.8 (R2020a)
Simscape Electrical Version 7.3 (R2020a)
Simulink Check Version 4.5 (R2020a)
Simulink Coder Version 9.3 (R2020a)
Simulink Coverage Version 5.0 (R2020a)
Simulink Design Verifier Version 4.3 (R2020a)
Simulink Requirements Version 1.5 (R2020a)
Stateflow Version 10.2 (R2020a)
Vehicle Network Toolbox Version 4.4 (R2020a)

ericrost_0-1655479085532.png

 

0 项奖励
回复
1 解答
1,947 次查看
SorinIBancila
NXP Employee
NXP Employee

Hello @ericrost,

Another possible solution to your problem can be to set the Transformation from 'Linear: ax + b' to 'Lin: two points". 

SorinIBancila_0-1655796934688.png

In this case, the inverse transformation works better, and the problem you discovered doesn't appear anymore.

SorinIBancila_1-1655797210757.pngSorinIBancila_2-1655797228375.png

Let me know if this solution works better for you.

 

Best regards,

Bancila Sorin Ioanid

在原帖中查看解决方案

5 回复数
1,948 次查看
SorinIBancila
NXP Employee
NXP Employee

Hello @ericrost,

Another possible solution to your problem can be to set the Transformation from 'Linear: ax + b' to 'Lin: two points". 

SorinIBancila_0-1655796934688.png

In this case, the inverse transformation works better, and the problem you discovered doesn't appear anymore.

SorinIBancila_1-1655797210757.pngSorinIBancila_2-1655797228375.png

Let me know if this solution works better for you.

 

Best regards,

Bancila Sorin Ioanid

1,926 次查看
ericrost
Contributor II

@SorinIBancila 

This workaround is acceptable to make the scaling that I need for my application function properly. An update to FREEmaster resolving the regression when using "ax + b" linear scaling would be preferred, but I can make this work.

Thanks for the support!

1,972 次查看
ericrost
Contributor II

This isn't a solution, it is avoiding the regression in FREEmaster. The 0.1 unit per bit scaling is needed for the application I am developing, and should work with a tool designed to calibrate and stimulate fixed point scaled integer types.

0 项奖励
回复
1,981 次查看
ericrost
Contributor II

Bancila,

This isn't a better workaround than what I'm already able to do in my javascript. I would like to modify the engineering unit scaled value directly in the GUI I am implementing, and FREEmaster not being able to write multiple specific valid parameter values is a relatively serious deficiency.

Thanks,

Eric

0 项奖励
回复
1,987 次查看
SorinIBancila
NXP Employee
NXP Employee

Hello @ericrost,

I checked the attached files and I have a possible solution for you. The model seems fine and all you have to do is to modify the Freemaster project:

  • Add two variables to the 'Variable Watch':

SorinIBancila_0-1655726623598.png

  • Configure the 'Scaled_param' as in the following photo:

SorinIBancila_1-1655726695098.png

  • Configure the 'X' as in the following photo (it's important to be configured as 'unsigned int' and to Show As 'Dec'):

SorinIBancila_3-1655726759161.png

To modify the variable, you have to edit the second variable ('X'), and then the 'scaled_param' is automatically computed.

 

Let me know if this solution helps you.

Best regards,

Bancila Sorin

 

0 项奖励
回复