2
\$\begingroup\$

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

\$\endgroup\$
  • \$\begingroup\$ If in "Listen-Only Mode" it will probably not transmit (I know this for a fact for the IXXAT adapter (that probably uses another chip)). See e.g. page 59 in the datasheet, "10.0 MODES OF OPERATION". Can you check? \$\endgroup\$ – Peter Mortensen Apr 11 '17 at 15:09
  • \$\begingroup\$ The other device is "on" and operational, right? You probably already know this, but without at least one other CAN device on a traditional CAN bus, outside of a specific loopback mode, you'll get an error-frame / have issues transmitting. \$\endgroup\$ – Krunal Desai May 12 '17 at 1:57
  • \$\begingroup\$ Thanks and yeah I track with that. There is another device on the bus but it's possible it's in some sort of listen mode and isn't sending the ack. I haven't pulled this project back out since but if I do I have a scope (which I didn't have when I wrote this) now so I think that's the thing to check for. \$\endgroup\$ – bgp May 12 '17 at 2:09
  • \$\begingroup\$ @bgp We would need to know what your configuration register settings (inside the MCP2515) are in order to help. It could be that the device on the far end of the cable is not acknowledging the transmission. \$\endgroup\$ – user4574 Apr 16 '18 at 21:36
1
\$\begingroup\$

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

\$\endgroup\$
  • \$\begingroup\$ Thanks. It’s been a while but if I pick this back up I’ll keep an eye out for the voltages as you suggest. Sadly I don’t think I ever did get this to work. \$\endgroup\$ – bgp Jan 6 at 22:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.