Can MPC5748G devkit read CAN data from J1939 connector.

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

Can MPC5748G devkit read CAN data from J1939 connector.

1,041 Views
GouthamReddy
Contributor I

Hi,

I have recently started working on MPC5748G and I am not able to read CAN data from J1939. 

I tried connecting gnd, CAN_H and CAN_L from J1939 connector to P5 of MPC5748G but couldn't read any messages from it. Can anyone please help me with this issue.

Thank you.

0 Kudos
6 Replies

1,036 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

to use CAN interface on DEVKIT it is recommended to supply the board with external 12V supply.
What is the code running on MPC5748G? You can find several non-SDK or SDK examples within S32 Design Studio. Did you test any of example and modify it so it can communicate with an external tool you have?

BR, Petr

0 Kudos

1,021 Views
GouthamReddy
Contributor I

I have given external 12V supply. I am running flexcan example code from S32DS. But I am not able to see the output. I have modified the code to send the CAN data to UART. But I can't see any data in UART. UART was tested and it works perfectly, I was able to send and receive text from UART. 

Is there any code to send CAN data to UART?

Thank you in advance.

0 Kudos

1,022 Views
GouthamReddy
Contributor I

I have given external 12V supply. I am running flexcan example code from S32DS. But I am not able to see the output. I have modified the code to send the CAN data to UART. But I can't see any data in UART. UART was tested and it works perfectly, I was able to send and receive text from UART. 

Is there any code to send CAN data to UART?

I have attached code files please let me know if there is any issue in the code.

Thank you

0 Kudos

972 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

do not use RXFIFO, or if you need it use MB that is outside of RXFIFO and ID table space.
Try to modify end of rx init function to have just 

CAN_0.MCR.R = 0x0000003F;
while (CAN_0.MCR.B.FRZACK & CAN_0.MCR.B.NOTRDY) {} /* Wait to clear */
/* Good practice: wait for FRZACK on freeze mode entry/exit */


Ideally just clear HALT bit and make rest of MCR as configured before.
Then check if MB4, you configured for reception, is able to receive a message.

BR, Petr

0 Kudos

960 Views
GouthamReddy
Contributor I

I want the MPC5748G devkit to read the CAN data and print the CAN data. So I am not sure if the initialization that I did is correct or not. I want to read standard CAN from CAN0.

1. If I should not use RXFIFO, what should be done instead?

2. When I am able to read the CAN data, where will it be stored and how to access the data to print?

I am guessing the data will be stored in Message Buffers like "CAN_0.MB[x].DATA.B[x];". 

3. Is there any sample code to read CAN from MPC5748G? (The example code given in S32 design studio is not working.)

4. Is there a specific initialization that needs to be done to continuously read CAN data(standard and extended CAN)?

0 Kudos

953 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

1) you will use regular MB, as you did, or as shown in demo example
2) data will be stored into DATA words of used MB as you mentioned
3-4) if checking e.g. simple flexcan_receive example it should work normally. It configures FlexCAN_0 to receive std id=0x555 message into MB4 continuously. So once other node (PC CAN tool, other board, etc) sends std id=0x555 message you should get message in MB4 using this example. 
If have possibility measure bus  and/or TX/RX signals with scope or analyzer to be sure message is sent on the bus and then check status or flexCAN registers.

BR, Petr 

0 Kudos