S32K144EVB crash from FCAN Rx or Tx block from Processor-in-the-Loop (PIL) simulation mode

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

S32K144EVB crash from FCAN Rx or Tx block from Processor-in-the-Loop (PIL) simulation mode

1,241 Views
rsating
Contributor III

We would like to have the S32K144EVB board communicate with the MPC5775B EVB through CAN Bus messages, and initially, run our code on the S32K144EVB through Processor-in-the-Loop (PIL) simulation mode.  See attached ZIP file with the following models:

S32K144_FCAN_ext_PIL_test.slx  <== tries to run model in PIL Simulation Mode, crashes

S32K144_PCAN_ext_test.slx   <== runs with both Rx and Tx in External Mode

S32K144_FCAN_ext_PIL_test_2.slx  <== run model with FCAN blocks commented out in PIL Simulation Mode, succeeds

S32K144_PCAN_ext_test_2.slx   <== has FCAN Tx Mailbox and Rx Complete blocks commented out, to help isolate cause of crash in PIL Simulation Mode

The model below, derived from NXP example models from the toolbox, builds and runs in External Mode, with inbound CAN Messages (ID=0x88) updating the displayed Data and Timestamp values, and incrementing the message received count, and on PCAN-View we can see the Tx message count increases at the rate of 10 per second.

S32K144_PCAN_test.png

If we run the above as an included model and PIL Simulation Mode for the above included model using the top level model shown below:

S32K144_FCAN_ext_PIL_test.png

It crashes on the board as soon as execution starts. Timeout errors in Simulink warn the application may no longer be running. The PCAN-View Tx message counter stops incrementing, confirming the application is dead.

To determine which blocks were involved in the crash, we tried commenting out subsets of blocks to see which, if any, when commented out, avoids the crash. Both the "FCAN Tx Mailbox" and "FCAN Event Rx Complete" have to be commented out for the application to not crash.

Can anyone tell us why the two FCAN blocks might crash the application in PIL Simulation Mode?

Ours is a fresh installation of the NXP toolboxes, S32DS, SDK, and Matlab R2019b:

Model-Based Design Toolbox for S32K1xx Series Version 4.2.0 (R2016a-R2020a)

Thanks

0 Kudos
Reply
2 Replies

1,203 Views
mariuslucianand
NXP Employee
NXP Employee

@paulvlase  can you comment on this?

Marius

0 Kudos
Reply

1,172 Views
rsating
Contributor III

Feedback from Mathworks Technical Support:

In PIL mode, the generated code is cross-compiled for the target hardware and runs on the target processor. Simulink sends stimulus signals to the code on your target processor through a communication channel for each sample interval. PIL simulation generates the standalone code interface. So if you can deploy your code on target hardware as a standalone executable without problem, then we can rule out the possibility that the deployment code is causing the crash. Therefore, it is highly possible that the code that handles stimulus signal is root cause.

How PIL works: https://www.mathworks.com/help/ecoder/ug/about-sil-and-pil-simulations.html?s_tid=srchtitle#brr9tb5-...

Code interface in PIL: https://www.mathworks.com/help/ecoder/ug/about-sil-and-pil-simulations.html?s_tid=srchtitle#brutuzj-...

I found a MATLAB class target.CommunicationChannel which looks promising in helping you get information about communication channel used in PIL. Unfortunately this function is introduced in R2020b and is not available in your current version. If you would like to try R2020b, you can try follow steps in the link below to set up PIL connectivity with your hardware.

target.CommunicationChannel: https://www.mathworks.com/help/ecoder/ref/target.communicationchannel-class.html

Set up PIL connectivity with your hardware: https://www.mathworks.com/help/ecoder/ug/set-up-pil-target-connectivity-by-using-target-package.html

In R2019b, this package supports less functions:
https://www.mathworks.com/help/releases/R2019b/ecoder/ref/target-package.html

0 Kudos
Reply