Hello @avinashstarkenn ,
Based on the .mex file you provided, I assume you are using the S32K312 board. Please let me know if you are using another board.
I checked the schematic for the S32K312 board and it seems like the CAN1 requires an external transceiver.
To configure the pins for CAN functionality, I will share two articles which showcase how to configure the pins.
How to configure pins (In that example, the DIO pins are configured) - https://community.nxp.com/t5/NXP-Model-Based-Design-Tools/Interacting-with-Digital-Inputs-Outputs-on...
How to configure the CAN pins and peripheral - https://community.nxp.com/t5/NXP-Model-Based-Design-Tools/Communicating-over-the-CAN-Bus/ta-p/175845...
The second article talks about the process of configuring the CAN pins (RX, TX, etc.) and then configuring the CanController, CanHardwareObject and the CanIf peripheral.
There is one more thing i noticed in your CanHardwareObject configuration: the RX (receive) objects must be ordered before the TX (transmit) objects in the list. In other words, The first TX object must have a Can Object ID higher than all the other CanHardwareObjects configured as RX.
Additionally, I noticed your CanController_1 has no items in the CanRxFifo field. That setting requires the corresponding Can1_Rx_Fifo to have the Can Hw Object Count field set to 1.
Let me know if following these instructions and suggestions helped you achieve a functional configuration.
Regards,
Robert V