Building a CAN API for Arduino DUE

Implementing the CAN physical layer.

For the implementation of the physical layer of the Arduino Due CAN interface, we need a mean to translate the CAN messages to/from differential signals across a physical medium such as a twisted pair cable.

CAN transceivers provide that differential physical layer interface between the data link layer (CAN controller inside the SAM3X8E) and the physical wiring of the CAN bus.

CAN has only two bus voltage states; recessive (driver outputs are high impedance) and dominant (one bus line, CANH, is high and the other, CANL, is low), unlike the traditional differential data transmission where a logic 1 is transmitted as a voltage level high on one noninverting transmission line and low on the inverting line. Correspondingly, Logic 0 is transmitted as low on the noninverting line and high on the inverting line.

For obvious space reasons, we need a shield to mount the transceivers, some pull resistors, capacitors and the CANL CANH connectors.

I have chosen two SN65HVD234 CAN transceivers for my first shield (I am considering to use 235's later). Because I am prototyping, for the board I will use a SchmartBoard (RadioShack 2760259). The shield will provide 2 can ports (CAN0 and CAN1).

Here a picture of the transceivers circuit. It's very simple, just a straight connection with the arduino CAN ports. Later on, I have planned to use some features of these transceivers like high-speed and low power modes that will required 4 more Arduino Due pins (2 EN and 2 RS).

Regarding the code, I already have my Arduino Due talking CAN 2.0A but a library optimization is required before upload the files in github. Thank you again for your patience and keep looking out my post.