I have a model where I try to send out 3 CAN messages. Each message is sent on a different time step. See the figure below. FCAN Send blocks are in the "Switch Case Action" subsystems. I have given the FCAN_Config block a high priority (see https://community.nxp.com/t5/NXP-Model-Based-Design-Tools/S32k144-EVB-CAN-Communication-using-MBD/m-...). All three messages have different IDs and mailboxes. Message "Tx CAN 1" is transmitted without problems, but messages "Tx CAN 2" and "Tx CAN 3" get mixed in a strange way. The message payloads are transmitted fine, I think, but the ID for "Tx CAN 3" is lost and the ID of "Tx CAN 2" is shared by both "Tx CAN 2" and "Tx CAN 3"!
I have spent a lot of time and tried a variety of different things to try to fix this, but nothing I have tried works consistently.
Help would be appreciated. This is a serious problem for me. I posted the code. I changed the extension from mdl to txt.
Solved! Go to Solution.
I have a fix that appears to work. I right-click on each Switch Case Action Subsystem and select “Block Parameters (Subsystem)” from the dropdown menu.
A dialog box appears. On the Code Generation tab. I changed “Function packaging from “Auto” to “Nonreusable function”.
After making this change to the 3 Switch Case Action Subsystems I now get the expected behavior: 3 separate CAN messages are transmitted, each with their own ID and payload.
What led me to try this approach was the realization that the contents of “Switch Case Action Subsystem Tx CAN 2” and “Switch Case Action Subsystem Tx CAN 3” were almost identical. I thought that this might lead Simulink and the MBDT block set to inappropriately reuse code.
I hope the fix continues to work! I would still like to know what was going on.
The S32K118 and S32K116 support will be added on the next release of this toolbox - targeted for July 22nd
You will get the same capabilities as for the currently supported S32K14x derivatives, plus a few new features requested by users like you in the past year. Stay tuned ... soon you will have it
Best regards,
Sharolyn_73
I have a fix that appears to work. I right-click on each Switch Case Action Subsystem and select “Block Parameters (Subsystem)” from the dropdown menu.
A dialog box appears. On the Code Generation tab. I changed “Function packaging from “Auto” to “Nonreusable function”.
After making this change to the 3 Switch Case Action Subsystems I now get the expected behavior: 3 separate CAN messages are transmitted, each with their own ID and payload.
What led me to try this approach was the realization that the contents of “Switch Case Action Subsystem Tx CAN 2” and “Switch Case Action Subsystem Tx CAN 3” were almost identical. I thought that this might lead Simulink and the MBDT block set to inappropriately reuse code.
I hope the fix continues to work! I would still like to know what was going on.
The fix also appears to work when the CAN Tx blocks are wrapped in enabled subsystems instead of Switch Case Action subsystems. The "Function packaging" change is applied to each enabled subsystem.