Electronic – MCP2515, CAN bus, and transmission failure

canspi

I'm trying to interface with a GPS device that is intended to connect with a vehicle via the CAN bus. I'm using an MCP2515, driven via SPI by a Parallax Propeller project board. I've successfully been able to capture messages from the CAN bus when connected to a vehicle, but when I try sending messages from the MCP2515 to another device the MCP2515 sets the TXERR bit (it remains set indefinitely) and does not appear to send the message.

The basic wiring I have set up is I'm using a SparkFun CAN bus shield which has the MCP2515 and the MCP2551 transceiver. CAN-H and CAN-L are connected directly from the transceiver to the appropriate pins on the OBD-II port (CAN-H pin 6 and CAN-L pin 14). Everything has power and a common ground (the CAN bus board, the Parallax Propeller board and pins 4 and 5 of the OBD-II port and the power source all have the grounds connected). I've tried putting a 110 ohm resistor (the closest I had to the recommended 120) between CAN-H and CAN-L, but that doesn't change the behavior.

The exact phenomenon is I'm attempting to transmit and then checking the TXBnCTRL register afterwards, continually, and the transmit bit is still set, but TXERR (bit 4) is now also set, but nothing else (the value of the register is exactly 0x18 – bit 4: TXERR and bit 3: "transmit request").

The data sheet just says "If the message started to transmit but
encountered an error condition, the TXERR (TXBnCTRL<4>) and MERRF bits (CANINTF<7>) will be set". I'm only seeing the TXERR bit set.

I am just checking if anyone has run into this scenario and knows what I might be missing here.

The topic of terminating the lines with resistors is discussed, among other places, here and here. From my understanding, the diagrams here are showing a big pair of wires, with two or more devices attached to separate points somewhere in the middle, with 120 ohm resistors at each end. But that's not really the scenario that I have. I basically have a device at each end, and I've tried placing the resistors basically wherever it was feasible. I'm running at 500 kHz. That TI documentation says the maximum length is 100 meters, so it's not the cable length. I've included a picture below – the red thing near the middle is the CAN bus shield, which has wires that end up going through that breadboard (which I've tried with and without resistors, no difference) then to the blue Cat 5 cable, then the black ODB splitter thing which I've hacked apart and the blocky thing at the end is the other device (which does get power and lights up, etc.).

I've checked and rechecked all the pins and connections with a multimeter, and as I said if I plug this into my car I do get messages. It seems like it should work. Am I on drugs?

Setup

Best Answer

IF you look at the power supply your MCP2551 transceiver has a higher minimum input voltage than your MCP2515 this caused some issues in my last project as there was quite a big voltage drop once everything was connected the controller MCP2515 was working but the transceiver was under powered

Also I would recommend using only the Transceiver with the propeller here is a nice library for you to try:

http://obex.parallax.com/object/745

I got this working in a few seconds using a propeller and MCP2551 on a breadbord

Related Topic