Site Information

 Loading... Please wait...

Arduino Due CAN Bus (Controller Area Network) Interfaces

Posted by Wilfried Voss on

This post is part of a series on CAN Bus and SAE J1939 Prototyping with the ARM Cortex M3 processor.

Arduino DueAs it turns out, the Arduino Due, just like a myriad of other embedded systems with CAN interfaces, was developed under the best intentions, but these intentions were focussed on providing a low-price ARM processor solution for the Arduino programming environment. This was accomplished, however, not without sacrifices (Think Ethernet port that is supported by the processor but left empty) and shortage of software support and documentation. 

I hate to appear as negative, but I am sick and tired of endless reading of data sheets and schematics to obtain information that should be part of the standard documentation. Any new product should not be released without a "farm system" that provides experience and exposure not just for beginners but also those engineers who'd like to focus on programming, not on hardware research.

This is especially true for the two CAN ports as supported by the Arduino Due. The official Arduino website states: "CAN: CANRX and CANTX - These pins support the CAN communication protocol but are not yet supported by the Arduino APIs." See: https://www.arduino.cc/en/Main/ArduinoBoardDue

Well, the "documentation" on that page ignores the fact that there is a second CAN port. And not to worry, there is software available due to the help of some brave and enthusiastic Arduino followers (just follow my series CAN Bus and SAE J1939 Prototyping with the ARM Cortex M3 processor).

The following image shows the available CAN port connections:

The first CAN port, represented by CANRX0 and CANTX0 is easy to find due to its visible print on the Arduino Due board. The second CAN Bus port reveals itself only through digging through the Arduino Due schematics.

The availability of two CAN bus ports provides a great advantage in regards to testing your CAN connection, because you can create a loopback between the two CAN channels, meaning whatever you send out through one port will be received on the other. This method will save you time during the initial development.

However, be aware that the CAN ports in their current form are useless when you intend to connect them to a real CAN bus network, may it be a vehicle or an industrial control system. 

While many popular embedded systems (e.g. mbed LPC1768, Arduino Due, Teensy 3.x, etc.) provide their respective CAN interfaces, these CAN capabilities are per default useless without their respective CAN transceivers. A CAN transceiver is a line driver that converts the controller’s TTL signal to the actual CAN level, which is a differential voltage. The use of differential voltage contributes to the vast reliability of CAN. Out of cost constraints, boards like the Arduino Due and the mbed LPC1768 have no onboard CAN transceivers. Basically, CAN transceivers would add more costs to the board and why pay for it when you don't need it? CAN transceivers, due to power management requirements, come always as a separate chip.

In order to add CAN bus transceivers to your Arduino Due, you will need either a CAN transceiver breakout board or the CAN Shield for Arduino Due:


Programming Arduino Getting Started with Sketches

by Simon Monk

programming-arduino-getting-started-with-sketches-by-simon-monk.jpgClear, easy-to-follow examples show you how to program Arduino with ease! "Programming Arduino: Getting Started with Sketches" helps you understand the software side of Arduino and explains how to write well-crafted Sketches (the name given to Arduino programs) using the C language of Arduino. This practical guide offers an unintimidating, concise approach for non-programmers that will get you up and running right away.

Programming Arduino: Getting Started with Sketches explains basic concepts and syntax of C with simple language and clear examples designed for absolute beginners - no prior knowledge of programming is required. It leads you from basic through to advanced C programming concepts and features dozens of specific examples that illustrate concepts and can be used as-is or modified to suit your purposes.

  • All code from the book is available for download.
  • Helps you develop working Sketches quickly.

Coverage includes: C Language Basics; Functions; Arrays, Strings; Input / Output; Standard Library Goodies; Storage; LCD Displays; Programming for the Web; Program Design; C++ and Library Writing

More Information...