back to index

Banana Pi CAN bus adapter with TJA1050

What

A way to attach CAN bus to Banana Pi single-board computer.

How

A cheap little board with a TJA1050 transceiver chip was obtained off eBay. This was connected to a Banana Pi single-board computer using an adapter built on a protoboard.


Schematics of the little board

It was found that the little board contains its own 120 ohm termination resistor and little EMI-suppressing capacitors. This is beneficial when it is an endpoint, however it may cause problems and require desoldering of the offending parts when the board is used in a multidrop system as a non-end one.

There are two zero-ohm resistors there, apparently used to allow the same board to facilitate different termination possibilities (with non-zero values there).

Signals

The Banana Pi board supports CAN bus via can4linux, with Tx line on the pin 16 and Rx line on the pin 18 of the 40-pin GPIO header. These are at 3.3 volts. The TJA1050 runs at 5 volts. Banana Pi GPIO runs at 3.3 volts. Voltage conversion is therefore needed.

For the Tx pin, the voltage conversion is not needed; the 5V CMOS logic can take 3.3V logic H. There is a 1 kΩ resistor added in series just to be sure.

The Rx pin is attached to a voltage divider formed from a 1k series resistor and a 2k2 resistor against the ground, converting 5 volts to 3.4 volts which is close enough.

(On the photographs, the 2k2 resistor is in an improper position, between pins 14 and 16 instead of between 18 and 20.)

Indication of Rx/Tx signals

The Rx and Tx signals are visualised using a pair of white LEDs. These are fairly bright, so a 4.7 kΩ series resistor is sufficient. To avoid leaking current through the diodes on the Banana Pi pins and shining when they should not, the LEDs are fed from 3.3V pin of the header.

When the /dev/can0 device is not opened, the pins in Banana Pi default configuration are apparently pulled low as both LEDs are shining.

Indication of CAN bus signals

Two white LEDs are connected antiparallel across the bus, with a 4k7 resistor in series. When the bus is not energized, both signals are roughly at the same voltage. When data are sent, the lines are pulled differentially, one up and one down.

In theory this should allow indication of the activity on the bus.

In practice, the voltage is too low to light up the white LEDs when terminators are attached, and barely visible with terminator disabled.

Termination of CAN bus

The board has a jumper with a selectable terminator. The CAN bus should be terminated with 120 ohm resistor on each of its two ends, for total impedance of 60 ohms. The board has two possible terminator values, 60 and 120 ohms, in addition to disabled termination. This allows using it as a middle node, end node, or with just one attached device (or a few devices on a tabletop-sized network where such improper termination doesn't really matter).

Photographs of the assembly


Banana Pi plus CAN board

Banana Pi plus CAN board

Banana Pi plus CAN board

CAN board, detail

CAN board, detail

CAN board, detail

CAN board, detail, without the transceiver board

CAN board, detail

CAN board, detail

CAN board, detail

If you have any comments or questions about the topic, please let me know here:
Your name:
Your email:
Spambait
Leave this empty!
Only spambots enter stuff here.
Feedback: