problems sending CAN messages from NXP S32k144

cancel
Showing results for 
Search instead for 
Did you mean: 

problems sending CAN messages from NXP S32k144

1,023 Views
pierpaolo_dini
Contributor III

Hi, everybody,
I'm using NXP S32k144 to communicate with an Arduino using can protocol.
So far I've used the can_pal example, and as for the reception of messages that Arduino sends to NXP no problem, in fact, I can print all the id on screen.
The problem is when I try to send some messages to Arduino from NXP.
I'm checking the data traffic with a peak device and in fact, I only see the messages I set on the Arduino board.

This is the code I used inside the infinite loop in the main :

pastedImage_1.png

I'd basically like to send a message with id 456 from NXP to Arduino.

I'm definitely doing something wrong with the code, but I don't understand what.
Thanks for the advice.

PS: what if I want to send more than one from the NXP board?

Regards.

Labels (1)
Tags (2)
0 Kudos
5 Replies

852 Views
Jeremy_He
NXP Employee
NXP Employee

Below are a few tips when using CAN on S32K144-EVB.

1. Be sure to use 12V adaptor power input instead of 5V MicroUSB cable. the CAN PHY UJA1169 is 12V powered.

2. if your code on S32K using can FD instead of traditional CAN, be sure the PCAN_VIEW enabled FD, too.  Otherwise, PCAN_VIEW on PC won't receive the data. Instead, if CAN FD is enabled on PCAN_VIEW, a traditional CAN frame from the S32K can be received and showed on PCAN_view.

3. If no data received, I would suggest using an oscilloscope probe check whether data sent out through TX or can High and Low output pins. 

0 Kudos

852 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi  Pierpaolo Dini ,

If you modify the #define TX_MSG_ID (0x456) in can_pal example.
Does the S32K144EVB able to transfer CAN message on CAN bus.(PCAN View can be used to observe the CAN bus)
Please first make sure it works.

can_pal_s32K144 PCAN View.png

Best Regards,

Robin

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

852 Views
pierpaolo_dini
Contributor III

Hi Robin_Shen

first of all, thank you for answering.
I did as you suggested.
I noticed the following things: in the picture I sent you, the structure had the wrong fields, and now I've corrected it; then I noticed that in the while loop if I enter all the settings to send messages, the peak device doesn't see anything but the message sent by Arduino.
If instead in the while loop I insert only the call to the CAN_Send function then I see the following:

pastedImage_1.png

the message with id 0x120 is the one I'm sending with Arduino.
There seems to be a problem with the format of the message sent by NXP(?).

PS: How can I activate the PCAN-View?

Regards.

0 Kudos

852 Views
pierpaolo_dini
Contributor III

Robin_Shen

ah ok, I saw right now what is a pcan-view.
I use busmaster with a pcan-usb, because is not my device and I have used as usual for me (practically pcan-view == busmaster).
sorry for the stupid question.

regretfully I still have a communication problem.

thanks for your support.

0 Kudos

852 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

I am not sure your Arduino and CAN analyzer configured the same protocol as NXP CAN PAL example.

Here you can check the CAN FD protocol configuration:

CAN PAL.png

CAN FD configuration.png

can_pal_s32K144 PCAN View CAN-FD.png

0 Kudos