Blog
Recent Posts
SAE J1939 250k/500k Baudrate Converter with Arduino Due - Source Code Included
Posted by
on
The introduction of 500 Kbps (see SAE J1939/14) as an alternative to 250 Kbps, required clarifications on how to solve problems that come with incorporating devices supporting different baud rate settings in the same network. One solution comes with automatic baud rate detection. The SAE J1939/16 document outlines the methods used to detect the baud rate of an SAE J1939 network segment by ECUs that can adjust their CAN baud rate while in use. The specified approach provides a reliable method to detect the CAN baud rate of that network segment without interrupting network communications.
For more information, see our post SAE J1939/16 Automatic Baud Rate Detection Process.
However, there are scenarios where automatic baud rate detection does not apply, e.g., attempts to connect a 250k supporting device into an existing 500k network or vice versa, assuming that the device does not support baud rate detection. For such cases, one will require a baud rate converter. This post describes the implementation of such a converter using our Arduino-Based ECU Development Board with Dual CAN Interface.
Note: The two CAN ports are not galvanically isolated, which does not pose a problem. It is, however, recommended to use isolated CAN ports to prevent grounding loops. The use of galvanically isolated CAN ports will, however, increase the hardware costs tremendously.
The board comes with two CAN ports of which one receives and transmits 250k SAE J1939 data frames, and the second port does so at 500k. The above image represents my test setup with the Arduino Due acting as the baud rate converter. I used two of our SAE J1939 ECU Simulator boards in combination with the JCOM1939 Monitor software for Windows.
I set up one J1939-USB board to represent node 128 at 500k baud:
The second J1939-USB board was set up to represent node 129 at 250k baud:
The next image shows the data traffic at node 128:
Row 1: Node 128 receives address claim from node 129.
Row 2: Node 128 transmits PGN FF01 hex.
Row 3: Node 128 receives PGN FF00 hex from node 129.
A similar scenario happened at node 129:
Row 1: Node 129 receives address claim from node 128.
Row 2: Node 129 receives PGN FF01 from node 128.
Row 3: Node 129 transmits PGN FF00.
After this first test, I assigned transmit frequencies to the PGNs, and the data traffic is demonstrated here:
The above image shows two instances of the JCOM1939 monitor software, one assigned to node 128, the other to node 129.
The Arduino code is fairly simple, and I will only refer to the most important section:
The code shows that CAN port 0 repeats every data frame it receives and transmits it per CAN port 1. The same happens the other way around.
The code can be easily extended to support message mapping, i.e., re-assigning message IDs (PGNs). The application can also be used as a CAN Repeater, Network Extender, and more.
Click here to download the Arduino code...
SAE J1939 Starter Kit And Network Simulator
Our J COM.J1939 Starter Kit And Network Simulator is designed to allow the experienced engineer as well as the beginner to experiment with SAE J1939 data communication without the need of connecting to a real-world J1939 network, i.e. a diesel engine. It may sound obvious, but in order to establish a network, you need at least two nodes, and that fact applies especially to CAN/J1939 where the CAN controller will basically shut down after transmitting data without receiving a response. For that reason, our jCOM.J1939 Starter Kit And Network Simulator consists of two J1939 nodes, namely our jCOM.J1939.USB, an SAE J1939 ECU Simulator Board With USB Port.
ESP32 DC Motor PWM Speed Control (Pulse Width Modulation) - The Hidden Facts
Lately, I have worked on two projects requiring DC motor control per PWM (Pulse Width Modulation). What both projects had in common was a profound lack of documentation regarding PWM control, specifically the side effects that have a significant impact on the programming. This post aims to point to these quirks that may cause considerable headaches [...]
ESP32 Project: USB to Bluetooth Gateway
The ESP32 processor allows the integration of Wi-Fi, Bluetooth, and Bluetooth LE (BLE) for a wide range of IoT (Internet of Things) applications. Using Wi-Fi ensures connectivity within a large radius. At the same time, Bluetooth allows the user to easily detect (with low-energy beacons) a module and connect it to an Android/iOS smartphone or [...]
Arduino-Compatible Microsoft Azure Certified IoT Development Kit with Visual Studio Code Support
This Microsoft Azure Certified IoT DevKit (IOT-AZ3166) is an all-in-one kit optimized for prototyping and developing Internet of Things (IoT) applications leveraging Microsoft Azure services. It supplies an Arduino-compatible board with multiple peripherals such as an OLED display, sensors, hardware debugging chip (ST-Link), and security chip. The project collection offers creative examples for learning and reference, plus [...]
Arduino Portenta H7 - Dual-Core STM32 Processor Board with Two CAN FD Ports and Support for Arduino IoT Cloud
The Portenta H7's central processor is represented by the dual-core STM32H747, including a Cortex M7 at 480 MHz and a Cortex M4 at 240 MHz. The two cores intercommunicate through a Remote Procedure Call mechanism that seamlessly enables calling functions on the other processor. Both processors share on-chip peripherals and can run Arduino Sketches on the Arm [...]
Four Channel CAN Bus to USB Gateway Using The Arduino Due
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 [...]
SAE J1939 250k/500k Baudrate Converter Using Arduino Due With Dual CAN Bus Port
In the past months, customers have approached me regarding a CAN Bus baud rate converter for SAE J1939 networks. The original SAE J1939 Standards Collection was limited to a baud rate of 250k, basically to keep things simple and reliable. I don't know what triggered the decision to add the additional 500k baud rate. From [...]
ESP32 Development Boards and Accessories for IoT Applications
The integration of Wi-Fi, Bluetooth, and Bluetooth LE allows a wide range of applications with the ESP32 modules. Using Wi-Fi ensures connectivity within a large radius, while using Bluetooth allows the user to easily detect (with low-energy beacons) a module and connect it to a smartphone. The chips add priceless functionality and versatility to your [...]
CAN Bus Shield for Arduino, Mbed Platform With Fault-Tolerant MAX33040E CAN Transceiver
The MAX33040Eshld shield evaluation kit by maxim integrated represents a demonstration and development platform for the MAX33040E CAN Bus transceiver. It serves as a standalone evaluation board and the Mbed or Arduino platform to communicate with a CAN Bus network. The board features test points to access critical signal pins of the transceiver. The MAX14931 digital isolator [...]
STM32 Ultra-Low-Power IoT Development Kit With Integrated CAN FD Interface
Rutronik introduced its development kit RUTDevKit-STM32L5 for AI-based (Artificial Intelligence) applications at the edge. The kit also comes with a CAN FD interface.The kit utilizes the 110-MHz STM32L562ZET6Q micro-controller. The 32-bit Arm Cortex-M33 processor with Arm Trustzone function offers hardware-based security features. The core implements a protected processing environment for cyber protection and sensitive code and an [...]