How to get CAN_message data type on real time target?
2 vues (au cours des 30 derniers jours)
I'm trying to run real time on target(speedgoat) with CAN capabilities with simulink 2018b. I can build the model on the target but when I connect to target with simulink (start simulation) I get an error poppup:
The diagnostic viewer says : Unable to find the appropriate MATLAB data type to save the Simulink internal data of type 'CAN_MESSAGE' for modelName.
External Mode Open Protocol SetParam command failed with status 1.
I have a CAN read block feeding a CAN message to a J1939 transport layer. The transport layer also outputs a CAN message to go to the CAN Write block.
Thanks for any help
Stefanie Schwarz le 27 Mar 2023
This is a limitation with J1939 CAN models in Simulink Real-Time R2020a and prior.
The issue is that the external mode attempts to set all the block parameters when it connects to ensure that parameter values on the host match those on the target. CAN blocks such as CAN Pack and CAN Unpack blocks have parameters that are custom data types (CAN_Message) and therefore not supported by external mode.
As a workaround, you can set the default parameter behavior to 'Inlined': https://www.mathworks.com/help/releases/R2020a/rtw/ref/default-parameter-behavior.html
Or you avoid External Mode ("Run on Target" button) and use the command-line interface or SLRT Explorer instead: https://www.mathworks.com/help/releases/R2020a/xpc/gs/configure-build-and-download-target-application-using-matlab-language.html
Note that this limitation no longer exists since the major R2020b update to Simulink Real-Time. You can find more information at this link: https://www.mathworks.com/products/simulink-real-time/r2020b-update.html