0

I have connected a PiCAN2 board with raspberry pi running latest Jessie. When I try to send some CAN messages to my PC ( PC is connected via a USB to DB9 CAN interface to the PiCAN2 board) through this PiCAN2 using the can-utils, it runs into ERROR-PASSIVE state as soon as I bring the CAN interface up. But, when I enable loopback mode, I am able to send messages and receive them using two different terminal window on the raspberry pi itself. I enabled loopback mode using sudo /sbin/ip link set can0 type can bitrate 500000 loopback on.

Can some one tell me more about the loopback mode? I want to make sure that my hardware setup for PiCAN2 is correct. Is it possible to confirm that my CAN board is configured correctly because I can send/receive messages using loopback mode?Or this doesn't necessarily mean that it is correct?

I also want to know why I get the ERROR PASSIVE mode - does it indicate that the PiCAN2 is not configured correctly OR does it mean that my USB to DB9 CAN interface has some problem? I am new to this area and any help would be nice. Thank you.

nj_bubbles
  • 78
  • 12
  • If your code is working in Loopback mode, then your code is correct. Do you have Termination resistor in your network? CAN Bus must have 120Ohm terminator. – Swanand Nov 10 '16 at 13:10
  • Yes. I do have a termination resistor of 120Ohm. Actually, I have some improvement right now. It remains in ERROR-ACTIVE mode but I am only getting some error CAN messages and receive buffer overflow message. – nj_bubbles Nov 10 '16 at 13:26
  • Sounds like problem with the bus. – Swanand Nov 10 '16 at 13:28
  • Okay thank you!:) I have another doubt. Will I be receiving these error CAN messages if my termination resistor was not connected? I want to know if getting atleast an error CAN message, means that its not a problem with the CAN hardware setup. – nj_bubbles Nov 10 '16 at 13:37
  • You were getting messages in loopback mode, means your configuration is correct. But you are getting erros on bus means there's problem when CAN Message gets out of Controller on the bus! – Swanand Nov 10 '16 at 13:40
  • I tried to receive some message on the CAN bus. I am sending CAN messages through a software from my PC to Raspberry Pi. But, I am able to receive only continuous error CAn messages. Do you know if I can conclude that the problem might be - on the sending part OR connection cable from PC to PiCAN2 ? – nj_bubbles Nov 10 '16 at 13:47
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/127812/discussion-between-njoshy-and-swanand). – nj_bubbles Nov 10 '16 at 13:55

0 Answers0