How CAN Bus Automatic Baudrate Detection Works And What To Consider When Connecting To A Network
Automatic CAN Bus baudrate detection comes in handy when you need to connect to a CAN network without knowing its actual transmission speed. Rather than playing with CAN baudrate settings and testing if you are able to see data, the automatic detection will deliver the right result within seconds, however, depending on busload. A heavy busload will deliver quicker results than a bus with occasional data frames.
In case of SAE J1939, a CAN-based higher-layer protocol for diesel engines, the automatic baudrate detection can be used to connect a device to a vehicle network that runs at either 250k or 500k baud without having to use a configuration system that is individually designed for each engine.
However, testing or connecting a CAN node (ECU) with automatic baudrate detection can be frustrating without looking into more background information.
Here are the rules when testing or connecting such a device:
- The CAN Bus node (ECU) can only detect the CAN Bus transmission rate when it is connected (and starts up) to a running network.
- You cannot test the ECU's detection capabilities by connecting it to a another, single ECU. The other ECU's CAN controller will detect errors on the CAN Bus and it will cease sending data frames.
- You need at least two other ECUs (i.e. a running network) who communicate with each other before you can connect or test the ECU with automatic baudrate detection.
How does automatic baudrate detection work?
The easiest way to detect the CAN baudrate is to switch to Silent Mode (to avoid error frames; see information in the next paragraph) and setup a loop to initialize standard baudrates (e.g. 100k, 125k, 250k, 500k, 1000k). After each initialization, check if you received either a valid data frame or an error. In case of an error, switch to the next baudrate. If you receive valid messages, switch off the Silent Mode and continue operation with the baudrate as detected.
What is Silent Mode?
The Silent mode allows a node to be set to a state, in which it is absolutely passive to the bus, meaning it is "invisible" to the rest of the network and it does not influence the bus in any shape or form. The node does not even provide an ACK frame when a message is placed on the CAN bus correctly. Thus, the Silent mode provides a perfect Listen-Only mode for diagnostic features such as the baudrate detection.
Automatic baudrate detection algorithm used by Copperhill jCOM.J1939 devices
As I mentioned previously, the automatic baudrate detection under SAE J1939 can be used to connect a device to a vehicle network that runs at either 250k or 500k baud without having to use a configuration system that is individually designed for each engine.
All of our jCOM.J1939 devices with automatic baudrate detection will test the bus connection for a maximum of five seconds. If after five seconds no connection was found, the device will switch to the J1939 default baudrate of 250k, otherwise it will continue with the detected baudrate. The process will finish within shortest time, however, depending on busload. A heavy busload will deliver quicker results than a bus with occasional data frames. Some of our devices with extended functionality can be configured to start up with either 250k, 500k, or automatic detection.
SAE J1939 to Bluetooth Gateway With 9-Pin Deutsch Connection Cable
The jCOM.J1939.BT gateway is a high-performance, low-latency, wireless vehicle network adapter for SAE J1939 applications. It allows any host device with a Bluetooth COM port to monitor SAE J1939 data traffic and communicate with the SAE J1939 vehicle network. An SAE J1939 cable, suited for a 9-pin Deutsch connection, is included with the gateway.
The gateway supports the full SAE J1939 protocol according to J1939/81 Network Management (Address Claiming) and J1939/21 Transport Protocol (TP). It is also supported by an extensive programming interface for Windows and Linux/Ubuntu applications, including full C/C++/C# source code for short time-to-market developments.