Additional Information

Site Information

 Loading... Please wait...

Blog

Four Channel CAN Bus to USB Gateway Using The Arduino Due

Posted by Wilfried Voss on

Arduino Due with four CAN Bus ports

In the past, I frequently received inquiries regarding the availability of a four-channel CAN Bus gateway. Such devices exist in the marketplace; however, they are usually costly, and, after all, they don't support easy customization or programming. While we at Copperhill Technologies have the ability to create such a gateway, this is primarily a matter of market potential, and we determined that the current demand did not justify the required investment of time and money. The inquiries were usually for single units, and the hardware and firmware development would need months to finish, considering that the goal would be to develop an industrial-strength device.

Nevertheless, we deemed creating a hardware prototype with the necessary driver software as an easy task since we have the prototyping hardware at hand. The result we created (see above photo) comes in the form of an Arduino Due with a dual CAN Bus Interface to support the on-chip CAN controller plus an external dual CAN Bus board with an SPI interface.

The Hardware

The core of the hardware configuration is our Arduino-Based ECU Development Board With Dual CAN Bus Interface, which utilizes the ARM processor's two onboard CAN controllers. The board comes with plenty of documentation and programming samples and even a free-of-charge SAE J1939 protocol stack. Please refer to the product information for more details.

The second component is our Dual Isolated CAN Bus HAT for Raspberry Pi. While the board is primarily intended for the Raspberry Pi, it also connects to any other embedded system. We chose the board because it provides two CAN Bus ports on a single board. The CAN Bus isolation is a plus but is not necessarily required. Alternatively, we could have used two of our MCP2515 CAN Bus Breakout Boards With SPI Interface because they use the same CAN Bus controller, the MCP2515. However, the dual-port board made the wiring a bit easier.

The Wiring

The connection between the Arduino Due and the external CAN Bus board contains:

  1. SPI Serial Interface
  2. Chip Select (Arduino Digital Output)
  3. Interrupt Signal (Arduino Digital Input)
  4. Power Supply (Arduino feeds 5 VDC to the CAN board)

The basic connection between the two SPI ports is as follows:

Arduino        ----> CAN Board
----------------------------------------
SCK            ----> SCK SPI Data Output
MISO           ----> MISO SPI Clock Input
MOSI           ----> MOSI SPI Data Input
SS             ----> CS Chip Select
Digital Output ----> INT Interrupt Output

Since we have a dual SPI interface, we chose the following:

  • CS0 = 10 - CAN0 interface using CS on digital output10
  • CS1 = 9 - CAN1 interface using CS on digital output 9
  • INT0 = 2 - CAN0 interrupt digital input 2
  • INT1 = 3 - CAN1 interrupt digital input 3

We are preparing an application note with detailed wiring diagrams, but for the time being, please refer to:

The CAN Bus Software Libraries

We use the following github resources:

Combining the two software libraries required some tweaking, and we will publish the sketch as soon as the previously mention application note is finished.

Last, but not least...

Please be aware that the above-presented solution does not represent a fully functional CAN Bus to USB gateway. This would require some additional programming. However, we have demonstrated the basic building blocks that will allow you to write your application.

Also, the hardware operates within a limited temperature range of 0 to 50C (32 to 122F), which is suitable for use under laboratory or office conditions but not necessarily in harsh environments such as offroad vehicles.

And yes, the above described application can be easily extended to support CAN-FD, and we will follow up with a corresponding post on our website.

CAN Bus, SAE J1939, NMEA 2000 Programming With ESP32, Supporting USB, Bluetooth, BLE, And WiFi

The  ESP32 Series of modules by Espressif supports the integration of WiFi, Bluetooth, and Bluetooth LE for a wide range of applications, most prominently for IoT (Internet of Things). For instance, using WiFi ensures connectivity within a large radius. Using Bluetooth allows the user to easily detect (with low-energy beacons) a module and connect it to [...]

Read More »


USB Device For I/O Testing And Prototyping Supports, Classical CAN, CAN FD, CANopen

DAB-Embedded introduced its USB2IO interface explorer, a device that connects USB to various I/O interfaces for prototyping and functionality tests of electronic devices with CAN, CAN FD, and CANopen interfaces.The product combines a protocol analyzer, data-logger, communication interface, an embedded functional test platform, and basic signal generator. The device targets electrical engineers, firmware developers, enthusiasts, and [...]

Read More »


Testing The SAE J1939 to RS232 & USB Gateway By Copperhill Technologies

In this post, I will demonstrate the test setup of our SAE J1939 to RS232 & USB Gateway. The JCOM.J1939.SER gateway is a high-performance, low-latency, serial vehicle network adapter for SAE J1939 applications. It allows any host device with an RS232 or USB port to monitor SAE J1939 data traffic and communicate with the SAE J1939 vehicle [...]

Read More »


ARM Cortex M4 Single-Chip MCU Supports CAN Bus, USB, Bluetooth for IoT And Gateway Applications

Renesas introduced its RA4W1, an MCU with an integrated CAN Bus, USB, and Bluetooth 5.0 Low Energy (BLE). The single-chip MCU includes a 48 MHz, 32-bit Arm Cortex-M4 core, and Bluetooth 5.0 core delivered in a 56-pin QFN package.The MCU enables designers of embedded systems to develop IoT (Internet of Things) endpoint devices for Industry 4.0, [...]

Read More »


USB/CAN Interface For Direct Connection To Embedded PC Motherboards

The CPC-USB/embedded by EMS Thomas Wunsche represents a CAN Bus interface designed for use with internal USB ports. Due to its compact size, it is well suitable for applications in embedded PCs. It is installed straight at a SUB-D9 enclosure opening or a slot panel, and it is wired per included cable to a pin connector of [...]

Read More »


3.5" SubCompact Board With 8th Generation Intel® Core™ i7/i5/i3/Celeron® Processor SoC

AAEON, a designer and manufacturer of advanced industrial and embedded computing platforms, introduced its GENE-WHU6 subcompact board, powered by 8th Generation Intel Core processors. Despite its size, the board provides extended functionality, and it can deliver the versatility of a desktop system.GENE-WHU6 fuses processing power with up to 32GB of DDR4 SODIMM RAM for computing performance.Designed for [...]

Read More »


CAN FD To USB Gateway Project With Teensy 3.2 And Microchip MCP2517FD CAN FD Controller

Our Teensy 3.2 With CAN FD Breakout Board provides all the components needed to create your CAN FD to USB-Micro Gateway. The board comes with the Microchip MCP2517FD CAN FD controller, while the Teensy 3.2 provides the USB connection. It also has an onboard 5 VDC regulator and reverse-voltage protection. The MCP2517FD is a cost-effective and small-footprint CAN [...]

Read More »


Low-Cost Do-It-Yourself CAN Bus To WiFi, Bluetooth, BLE, USB, RS485 Gateway Based On Raspberry Pi Zero

In the following, I will discuss a do-it-yourself project utilizing the Raspberry Pi Zero in combination with the CAN Bus Plus RS485 HAT. The combination of serial and wireless ports provided by this system allows the development of a great number of gateway applications. Overall, this small-size hardware includes connections such as CAN Bus, RS485, [...]

Read More »


Industrial-Strength USB To RS232, RS485, TTL (UART) Isolated Converter

WaveShare introduced their industrial USB to RS232/485/TTL isolated converter with original FT232RL. It features embedded protection circuits such as power isolation, ADI magnetical isolation, and TVS diode, and more. Also, the USB TO RS232/485/TTL gateway comes with an aluminum alloy enclosure, making it robust and durable for industrial requirements.The USB TO RS232/485/TTL converter is very easy [...]

Read More »