Site Information

 Loading... Please wait...

Blog

ESP32 Application: Galvanically Isolated CAN Bus Repeater and Baud Rate Converter

Posted by Wilfried Voss on

With this application, I am adding yet another example to the vast CAN library we developed over the years. The use of the Dual Isolated CAN Bus HAT with the ESP32 opens the door to a number of possible applications. The development of a CAN repeater and/or Baud Rate Converter came to mind first, because the actual code is ridiculously simple.

A CAN repeater is primarily used for signal conditioning and can also serve to extend the physical length of a CAN Bus network. A baud rate converter helps connecting devices with different CAN baud rates to connect them to the same network. The code for both applications is pretty much the same. The repeater application uses the same CAN Bus baud rate for both channels, while the converter uses different transmission speeds.

For my test setup, I used our SAE J1939 ECU Simulator Board to transmit one PGN at 500 kbps. Our espBerry with Dual Isolated CAN Bus HAT acts as the repeater/converter. It converts the 500 kbps to 250 kbps and vice versa. In addition, I connected the PEAK PCAN-USB Pro to the network. It transmits three different CAN message frames at 250 kbps.

The above screen shot shows our JCOM1939 Monitor Software, which is connected to the J1939 ECU Simulator board. The screen shows the received and transmitted CAN message frames. Note the selected baud rate of 500 kbps at the upper right-hand corner.

The PCAN View software in turn shows the received and transmitted CAN messages at 250 kbps.

As I mentioned previously, the code is fairly simple. During setup, we initialize both CAN ports using the chosen baud rates. 

In the loop section, we check for received data and forward them to the other port.

Of course, there is further code required for the CAN drivers, and they are included in the downloadable code.

=> Click here to download the Arduino IDE - ESP32 code (.zip file).

A few more things to consider:

  • The Dual Isolated CAN Bus HAT operates within a temperature range of o to 50 Celsius.
  • The code introduced in this post is free software; you can redistribute it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License or (at your option) any later version. The program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. With downloading these programs, you confirm that you have read and agree with these terms and conditions.

espBerry - ESP32 Development Board with Dual Isolated CAN Bus HAT

espBerry - ESP32 Development Board with Dual Isolated CAN Bus HAT

The espBerry DevBoard combines the ESP32-DevKitC development board with any Raspberry Pi HAT by connecting to the onboard RPi-compatible 40-pin GPIO header. 

The Dual Channel CAN Bus expansion HAT, designed for the Raspberry Pi, supports the full CAN2.0 Standard, and it features multi onboard protection circuits, high anti-interference capability, and reliable operation. As a result, it suits applications such as automotive devices or industrial automation.

The HAT is well documented, and there are multiple code samples using the C programming language under the Arduino IDE.

Read more...

Industrial Ethernet Guide - Network Segmentation

The following is part of  A Comprehensible Guide to Industrial Ethernet by Wilfried Voss.When too many devices are attached to a single-cable network, it is advisable to break up the network into separate, smaller network segments, and thus creating Multiple Collision Domains. The primary reason for segmenting is to increase bandwidth and to span the network over [...]

Read More »


Repeaters for CAN Bus, CAN FD And CAN-Based Higher Layer Protocols Such As CANopen And SAE J1939

Adding to the current IXXAT line of CAN bridges and gateways, HMS Networks launched four Ixxat CAN FD repeaters, all supporting both the new CAN FD standard as well as traditional CAN Bus.With the IXXAT CAN FD repeaters, HMS allows the networking of existing CAN Bus systems as well as in CAN FD-based systems.The repeaters enable CAN FD (CAN [...]

Read More »


Galvanically Isolated Repeaters For CAN Bus, CAN FD And CAN Based Higher Layer Protocols

Ixxat, a brand of HMS Networks (Sweden), has released its product line of galvanically isolated CAN FD repeaters. Adding to the current Ixxat line of CAN bridges and gateways, HMS Networks offers four CAN FD repeaters, which are also suitable for Classic CAN Bus networks. The products allow CAN FD and CAN Bus devices to be networked using tree [...]

Read More »


Passive I/Y CAN Bus Repeaters Improve CAN Bus Network Conditions

esd electronics announced their line of passive CAN Bus I- and Y-Repeaters. The I-Repeater improves the node capacity of a CAN Bus network or to insert electrical isolation, while the Y-Repeater creates a branch from one to two CAN Bus lines.All of the repeaters' CAN Bus ports comply with ISO 11898, and each repeater is available without electrical [...]

Read More »


CAN Bus Repeater With Four ISO 11898 Ports

The compact CAN Bus Repeater CRep S4 by EMS Wuensche (Germany) transmits and amplifies signals transparent to the CAN Bus protocol. Each of the four CAN Bus connections has the physical behavior of a single bus node. The repeater module permits a flexible design of the network topology but offers special support for star-structured networks. In addition, tree structures and [...]

Read More »