Electronic – Is a CAN enabled microcontroller sufficient to drive a CAN bus

can

There are a number of CAN modules built into microcontrollers these days. The PIC18F2480 is an example of that. Is that microcontroller (with built-in CAN) capable of driving a CAN bus on its own or is an external CAN transceiver/controller required?

I believe CAN has both a software and hardware layer and by the looks of it these CAN-enabled microcontrollers appear to have just the software, but it does not state that it can or cannot drive the CAN bus as is.

I'm looking to connect more than six microcontrollers through a CAN bus and would like to know if I need a transceiver across all of them or whether the built-in stuff can handle the communication from a software and hardware perspective.

Assume that I'll have necessary termination resistors and other small discrete components (caps, resistors, etc.)

Best Answer

This is a very good question. As a general rule, CAN requires a transceiver for every node:

enter image description here

However, under certain circumstances, you can actually get away without any transceivers! Those circumstances are:

  • Short bus length (much less than 1 meter)
  • Preferably all microcontrollers are on the same PCB, or stack of PCBs.
  • The bit rate is low
  • The environment isn't too electrically noisy

These aren't hard rules. You might get away with maximum bit rate (1MB/s) if you have a really short bus (10cm).

To achieve this, you need to know a little about what the transceiver does. Like most transceivers, they can output a high or a low to the bus (representing 1 and 0), but the 0 can dominate a 1. I.E. If two transceivers try to speak at the same time, and one is saying 1 and the other is saying 0, then the 0 will win. We can re-create the same situation simply using diodes:

Simple CAN

See the Seimens application note AP2921: On-Board Communication via CAN without Transceiver

But here's something even more interesting: The PIC actually has hardware support for transceiverless CAN!

CIOCON Register

You can configure the CAN TX pin so that is behaves in exactly the same way as the transceiver. This means you can wire up the CAN bus without the diodes. You'll still need the resistor though.

Simpler CAN