Skip to content

Connecting CAN Transceiver to Arduino Due

Tamkin Rahman edited this page Apr 1, 2018 · 1 revision

The CAN transceiver used is: SN65HVD231QDRG4Q1

Pinouts:

Transceiver:

image

Note that there is a line instead of a dot at the top of our purchased transceivers.

Digikey Link: https://www.digikey.ca/product-detail/en/texas-instruments/SN65HVD231QDRG4Q1/296-24421-1-ND/2057479

Due:

image

Connections:

Tranceiver Due
D CAN_TX
R CAN_RX
VCC 3.3V
GND GND
RS GND
Vref No connection

At least 1 pair of CANH and CANL must have 120k Ohms across it. Ideally 2 pairs (but not more). This is done to prevent signal reflection.

For each CANH (i.e. for multiple tranceivers), connect them to each other (e.g. on a bus).

For each CANL, connect them to each other.

Arduino Library

The Arduino library used is: https://github.com/collin80/due_can

To initialize the CAN node:

Can0.begin(CAN_BPS_250K);

To send test messages on that node, the following can be used:

void sendData()
{
	CAN_FRAME outgoing;
	outgoing.id = 0x401;
	outgoing.extended = false;
	outgoing.priority = 4; //0-15 lower is higher priority
        outgoing.length = 8;

        outgoing.data.value = 0x0102030405060708;
	Can0.sendFrame(outgoing);
}

To receive test messages on that node, the "CAN_TrafficSnooper" example can be used.

Refer to the given examples for more details.

References:

http://www.ti.com/lit/ds/symlink/sn65hvd231q.pdf https://www.boxelectronica.com/img/cms/due_1.png

Clone this wiki locally