Hello ,
I am trying to configure a new channel channel that is CAN1 (FlexCAN1 )on pins ptc8 and ptc9.
I configured a flexcan1 as Cancontroller_1 but it is not working.
I am attaching the project. I want to to configuring CAN on ptc8 and ptc9.Please configure and give.
And also the transceiver is working properly that is not the issue.
#S32K3 #MBDT #CAN
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
Hello @avinashstarkenn ,
Unfortunately, I understand that those suggestions were not successful in resolving your issue.
Could you let us know if you are having trouble with creating a configuration or if your errors are part of the model building process?
Additionally, the S32K3xx Toolbox provides examples showcasing the CAN functionality for multiple hardware parts. These examples are found in src\S32K3_Examples\can.
I believe these can serve as a solid starting point for creating a new model and/or modifying the existing ones to achieve different goals.
For your specific use case, I think that starting from the 's32k3xx_can_receive_s32ct' example, modifying the Hardware Part and updating the S32 Configuration Project to fit your hardware can lead to the results you are looking for. After you manage to modify the project to run on your hardware, the next step would be to add the "transmit" functionality, which can be observed in other models, like 's32k3xx_can_transmit_ebt'.
One other example that might prove useful to you is the src\S32K3_Examples\MR-CANHUBK344\mrcanhubk344_can_s32ct one. This example is showcasing a model where 2 CAN instances are configured to communicate with each other. This example is based on an S32K344-Q172 board.
Regards,
Robert V