How to realize CAN communication based on TJA1051 in simulink

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

How to realize CAN communication based on TJA1051 in simulink

1,241 Views
HongjieGui
Contributor I

Hello,

        I have a S32K3X4EVB-Q172 Customer Evaluation Board on hand. I successfully realized the CAN communication based on the routines provided by the official. There is a TJA1153_Init block in which call mbdt_tja1153.c file. However, my colleague designed a board based on S32K344 and TJA1051. I try to use the official routines, but it failed to receive and transmit messages. I want to know if there is c file and header file for TJA1051. Moreover, could you give me some advice on how to realize CAN communication based mbd in simulink for S32K344 and TJA1051.

0 Kudos
Reply
1 Reply

1,188 Views
mariuslucianand
NXP Employee
NXP Employee

Hello @HongjieGui,

The TJA1153 requires the custom initialization routine included in the CAN example models provided with the MBDT for S32K3 1.1.0. Because you are using the TJA1051, the TJA_Init custom function call for the TJA1153 is no longer required so you shall delete the custom code addressing the TJA_1153.

Now, it is important to know exactly which part of the TJA1051 has been populated on your custom board. If the part used is TJA1051T/E, this also has the EN pin which needs to be driven HIGH as the Operating modes table from the TJA1051's Datasheet suggests below.  

https://www.nxp.com/docs/en/data-sheet/TJA1051.pdf 

mariuslucianand_1-1656920164513.png

The checklist for you would look like this:

1. Check the part number of the TJA1051 you have.

2. For the Simulink model, open the external configuration tools by opening any CAN block in Simulink, by pressing the Configure button. Please check that the CAN RX and CAN TX pins are configured correctly and that the CAN instance configured is the one connected on your custom evaluation board.

Also, please make sure that the pins S and EN are also configured as an output in the configuration tools.

2. Remove the TJA_Init custom code from the Initialize area and replace it with DIO blocks to write the value required on the EN and S pins. 

mariuslucianand_2-1656921274102.png

Please give this a try and let me know if you have further questions.

Hope this helps,

Marius

 

 

0 Kudos
Reply