LPCXpresso 11C24 to RPi CAN communication

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

LPCXpresso 11C24 to RPi CAN communication

1,425 Views
brijsthomas
Contributor II

Hi,

i am trying to setup 2-way communication between an LPCXpresso 11C24 and a raspberry pi with PiCAN2 HAT.

When i run the cansniffer on the Pi and run the nxp_lpcxpresso_11c24_periph_ccan_rom example program I don't see any traffic so i'm checking to see where it might've gone wrong. I run the axf binary with 'Debug As' - 'MCUXpresso IDE Linkserver (incl. CMSIS-DAP) probes'.

I can use  external 12V bus supply on the Pi but that doesn't change anything.

I'm using an external 5V supply (from the Pi which can pull 1A) on the can interface of the LPCXpresso (JP4 header).

The Pi has an on-board termination resistor which i have connected.

I see there is 60Ohms + 60Ohms between CAN_H and CAN_L on the LPCXpresso board with a 1nF to filter HF, does this count as a 120Ohms termination resistor or do I need to add one externally (i think not)?

I also tried it with  an extra 120Ohms resitor on the LPC side but it didn't change anything.

I use a Cat5 twisted pair cable.

LPC sides use 500000bytes/s baudrate and RPi side 500000 BITrate

I suspect 1 baud equals 1 bit in this case (i know the differrence between baud and bit)

Is there anything else I need to check before I can read the TEST message that is sent from the LPC?

attached a picture of my setup, the breadboard is only there for the 5V from Pi ->  LPC (the led without resistor :smileysilly: just shows theres +5V)

also bear in mind I don't have a scope or logic analyzer here..

Thanks in advance!

Best regards,

Thomas

Labels (1)
6 Replies

1,157 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Thomas Brijs ,

Thank you for your interest in NXP Semiconductor products and
for the opportunity to serve you.
Q1) Does this count as a 120Ohms termination resistor or do I need to add one externally (i think not)?
-- Yes, it counts, and I think you'd better add a 120 Ohms resistor on the Raspberry Pi side.
Q2) In the LPCOpen library demo, it calculates the bit baud rate too.
Q3) Is there anything else I need to check before I can read the TEST message that is sent from the LPC?
-- Whether you try the loop-back mode for self-testing operation on the Raspberry Pi side.
Q4) Note: Oscilloscope and logic analyzer are essential for CAN testing.
Have a great day,
TIC

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

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

1,157 Views
brijsthomas
Contributor II

Hi Jeremy,

thank you for your time.

The loopback is working fine

 /sbin/ip link set can0 up type can bitrate 500000 loopback on

./cansend can0 400#DEADBEEF

34 delta ID data ... < cansniffer can0 # l=20 h=100 t=500 >
0.000000 400 DE AD BE EF ....

The Pi already has an 120Ohms Rt on board (which had to be enabled by adding a jumper, already did that.)

I'm getting myself a logic analyzer as we speak, meanwhile nothing much else I can do I guess?

0 Kudos

1,157 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Thomas Brijs ,

Thanks for your reply.
Q1) I'm getting myself a logic analyzer as we speak, meanwhile nothing much else I can do I guess?
-- Yes, I think so.

Have a great day,
TIC

 

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

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

1,157 Views
brijsthomas
Contributor II

Hi,

finally got me a scope, the Pi-side is working correctly. I can decode the messages with the serial decoding function.

The LPC-side is where the problem is. Turns out I didn't really need the scope to prove this; adding a debug output to the CAN_error callback made it clear that there is a can bus error on sending the can 'TEST' message.

This is just the demo program so I wonder what could be the problem..

I applied +5V, GND on JP4 and made a connection from STBY to GND.

Where should I be looking next?

0 Kudos

1,157 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Thomas Brijs ,

Thanks for your reply.

Actually, I'm not clear with your reply, whether you mean that the LPC11C24 board doesn't work well when running the nxp_lpcxpresso_11c24_periph_ccan_rom example, if yes, can you tell what exactly kind of error you encounter, please clarify it.


Have a great day,
TIC

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

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

1,157 Views
brijsthomas
Contributor II

Hi Jeremy,

sorry for the lack of details;

after     LPC_CCAN_API->can_transmit(&msg_obj); I get 2 errors at once:

0x82

0x87

This, according to UM10398 are both BIT0 related errors, the first one (0x82) is a warning error and the second one (0x87) means ERR_PASS, ERR_WARN and ERR_BOFF

I can't find more info on these errors or what a  BIT0 error means or why the can bus goes into BUS OFF state

Thanks!

0 Kudos