Thursday, 13 October 2016

CAN Bus Project Part 6 - The MCP2551

This is part 6 of my project to get my Arduino (/Genuino) and TI Launchpad to communicate via CAN.

Previously I've described getting my Arduino (/Genuino) to spit out CAN messages. Today I want to start talking about having the Launchpad receive them.

An Arduino/Genuino attempting to "talk CAN" faces two problems: Firstly, CAN is fairly complex; Trying to code all the CAN logic into an Arduino would be a hefty challenge. Second, even with the correct logic, an Arduino’s pins are physically incapable of generating the fancy ("dominant / recessive") voltages CAN needs.

Fortunately, the MCP2515 from Microchip solves both problems: Your Genuino talks to it (using SPI), and it translates your messages to CAN.

Unlike the Arduino, the Lauchpad comes with CANBus logic built-in (formally, it has 2 x CAN 2.0 A/B controllers) – so you don't need an external MCP2515 IC. 

In common with the Arduino however, the Lauchpad still can't generate the ("dominant/recessive") voltages CAN needs. So, whilst you don't need external CAN logic, you do need an IC to generate CAN voltages. A Microchip MCP2551 (High Speed CAN transceiver) is a suitable choice. It translates CAN voltage levels at its CANH / CANL pins into traditional "high/low” data on its RX pin.


An issue with using the MCP2515 is that it's a 5V device. Whilst this is o.k. for the Arduino, TI Launchpad pins are limited to 3.3V. It's common in electronics to need to shift the voltage level of signals and there're lots of solutions. I used an SN74LVC245A (Octal Bus Transceiver) IC to do the 3.3-to-5V conversion (mostly as I had one lying around).

To make it easy to connect things at the Launchpad-end of the CAN bus, I wire-wrapped the MCP2551, the SN74LVC245A, and some headers together on a vero-board – see photo. You can see one of the CAN termination resistors (explanation here) at the top of the frame.

If you've been following these posts, you'll know we now have all the hardware and Arduino sofware needed to bring a CAN message right up to the Launchpad pins. All that's needed now is to configure the internals of the Lauchpad... see you next time!

2 comments:

  1. data sheet says the mcp2515 can run 2.7V to 5.5V

    ReplyDelete
  2. DC Characteristics VDD = 2.7V to 5.5V Industrial (I): TAMB = -40°C to +85°C
    Extended (E): TAMB = -40°C to +125°

    ReplyDelete