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.
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)
已解决! 转到解答。
Hello @ericrost,
Another possible solution to your problem can be to set the Transformation from 'Linear: ax + b' to 'Lin: two points".
In this case, the inverse transformation works better, and the problem you discovered doesn't appear anymore.
Let me know if this solution works better for you.
Best regards,
Bancila Sorin Ioanid
Hello @ericrost,
Another possible solution to your problem can be to set the Transformation from 'Linear: ax + b' to 'Lin: two points".
In this case, the inverse transformation works better, and the problem you discovered doesn't appear anymore.
Let me know if this solution works better for you.
Best regards,
Bancila Sorin Ioanid
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!
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.
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
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:
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