Unexpected CAN behaviour with MBDT for S32K1xx

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Unexpected CAN behaviour with MBDT for S32K1xx

Jump to solution
1,356 Views
ranulf
Contributor IV
  • Windows 10
  • Simulink 2020a
  • MBDT for S32K1xx
  • S32K144EVB-Q100

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.

SwitchCase.png

Help would be appreciated. This is a serious problem for me. I posted the code. I changed the extension from mdl to txt.

 

 

0 Kudos
1 Solution
1,328 Views
ranulf
Contributor IV

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. 

rightclick.png

A dialog box appears. On the Code Generation tab. I changed “Function packaging from “Auto” to “Nonreusable function”. 

FunctionPackaging.png

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.

View solution in original post

0 Kudos
4 Replies
1,275 Views
Sharolyn_73
Contributor I

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

0 Kudos
1,329 Views
ranulf
Contributor IV

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. 

rightclick.png

A dialog box appears. On the Code Generation tab. I changed “Function packaging from “Auto” to “Nonreusable function”. 

FunctionPackaging.png

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.

0 Kudos
1,316 Views
ranulf
Contributor IV

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. 

TxInEnabledSubsustems.png

0 Kudos
1,339 Views
ranulf
Contributor IV

I am attaching the build folder.

0 Kudos