11 years, 8 months ago.

CAN communication: NXP LPC1768 fails to read message. Only send message is successful.

I have been trying to establish communication between 2 LPC1768 microcontrollers using CAN protocol. I have been trying to do this without CAN transceivers, using the workaround established in the Seimens application note AP2921 (http://www.mikrocontroller.net/attachment/28831/siemens_AP2921.pdf).

/media/uploads/ZeDarkLord/canra.png

I took the Code from the CAN loopback test example (https://mbed.org/handbook/CAN) and split it up into 2 parts for the receiving and sending. The code for sending is:

http://mbed.org/users/ZeDarkLord/code/CAN_Send_ra/

The sending works fine. The receiving is the problem. The code for receiving messages is:

http://mbed.org/users/ZeDarkLord/code/CAN_Receive_ra/

The statement can2.read(msg) is never true. The code never enters that block.

Am I missing something with respect to the CAN class here? Some bad initialization or something? In terms of hardware, I don't see any problem.

I am having the same issue. Have u got the solution??? plzz help

posted by vibi vijayan 06 Apr 2018

1 Answer

11 years, 3 months ago.

Hi Arpan,

The CAN API actually says to provide a pointer to the CANMessage, so try this instead

if(can2.read(&msg)) {

Edit: I was searching for something and came across this, and didn't look at the date it was posted, so hopefully you have figured it out by now lol :D

i tried that and it is showing an error. i cant create the bin file. plzz help

posted by vibi vijayan 06 Apr 2018