How to achieve optimal configuration of nodes for a given application

A Controller Area Network (CAN) provides robust communication capabilities between multiple network sites, supporting multiple data rates and distances. CAN features data link layer arbitration, synchronization, and error handling, and is widely used in industrial, instrumentation, and automotive applications. Under the framework of the ISO 11898 standard, with the help of distributed multi-host differential signaling and built-in fault handling functions, various protocols such as DeviceNet and CANopen stipulate corresponding implementation methods for the physical layer and data link layer.

By: Dr. Conal Watterson


A Controller Area Network (CAN) provides robust communication capabilities between multiple network sites, supporting multiple data rates and distances. CAN features data link layer arbitration, synchronization, and error handling, and is widely used in industrial, instrumentation, and automotive applications. Under the framework of the ISO 11898 standard, with the help of distributed multi-host differential signaling and built-in fault handling functions, various protocols such as DeviceNet and CANopen stipulate corresponding implementation methods for the physical layer and data link layer. The purpose of this article is to describe how to optimize the setup for a given application, taking into account hardware constraints such as controller architecture, clocking, transceivers, logic interface isolation, etc. The article will focus on network configuration issues – including data rates and cable lengths – explaining when it is necessary to reconfigure a CAN node, and how to achieve an optimal configuration of the node from the start.

Logical Interface Isolation

For harsh industrial and automotive environments, the robustness of the system can be further enhanced by isolating the logic interface of the CAN transceiver, allowing large potential differences between ground nodes while providing immunity to high voltage transients. An isolated CAN node is formed by integrating a CAN transceiver with a digital isolator. The ADM3052, ADM3053, and ADM3054 isolated CAN transceivers offer a variety of interface power options. For DeviceNet networks, the isolated side can be bus powered; therefore, the ADM3052 integrates a linear regulator to provide 5 V from the 24 V bus power. The ADM3053 (shown in Figure 1) integrates an isoPower DC-DC converter to drive the transceiver and the bus side of the digital isolator. Systems that already have an isolated DC-DC converter capable of supplying power across the isolation barrier can use the ADM3054, which only integrates digital isolators and CAN transceivers.

Figure 1. Isolated CAN Node (ADM3053 Transceiver Powered by isoPower DC-DC)

Effects of Propagation Delay

Deploying a CAN node requires an isolated or non-isolated CAN transceiver and a CAN controller or processor with the appropriate protocol stack. A stand-alone CAN controller can be used, or even a controller without a standard protocol stack, however, the microprocessor used in a CAN application may already include a CAN controller. In either case, the CAN controller must be configured to reconcile the data rate and timing on the bus, while the hardware oscillator is used for the controller.

As the length of the cable increases, the high frequency components in the signal are attenuated, so the data rate over long distances is limited. The bus is a kind of multi-master, so all nodes can try to transmit at the same time, arbitration depends on physical layer signaling. Propagation delay also increases with cable length and can interfere with inter-node synchronization and arbitration.

A differential signal on the CAN bus can be in one of two states: active (logic 0, a differential voltage exists between signal lines CANH and CANL) or passive (logic 1, no differential voltage, all CAN transceiver outputs are high impedance ). If two nodes try to transmit at the same time, the active bit transmission overwrites the concurrent passive bit transmission, so while transmitting, all nodes must monitor the bus state and stop the transmission if an overwrite occurs while transmitting the passive bit. In this way, the node transmitting the active bit wins the arbitration, as shown in Figure 2.

Figure 2. Arbitration logic between two CAN nodes

CAN 2.0b defines the implementation of the data link layer and specifies the CAN frame structure for transmission. An arbitration field containing the message ID initiates message transmission. A lower message ID (more zeros at the beginning) will have a higher priority level, and therefore, when transmitting a message, the corresponding node has a higher probability of winning the arbitration.

Although the CAN nodes are synchronized to the bus transmission, they are not fully synchronized due to the propagation delay between two nodes transmitting at the same time. For arbitration to work, the propagation delay must not be too large, otherwise the faster node may sample the bus before detecting the bit state transmitted by the slower node. The worst-case propagation delay is twice the delay between the two farthest nodes. In Figure 3, if nodes A and B are the furthest apart on the bus, the crucial parameter is the sum of the two-way propagation times PropBA and TPropBA.

Figure 3. Arbitration between two CAN nodes under real conditions (including propagation delay)

At lower data rates, the allowed bit times are longer, so the propagation delay (and therefore the cable distance) may also be longer. At the highest standard CAN data rate (i.e. 1 Mbps), the allowable propagation delay is more limited, although the ISO 11898-2 standard specifies that a data rate of 1 Mbps can be supported with a bus length of 40 meters.

The impact of isolation

Under isolation conditions, additional factors must be considered when calculating the two-way propagation delay. Digital isolators reduce propagation delay compared to optocouplers, but even the fastest isolated CAN transceivers are comparable to slower non-isolated transceivers in this regard. If the total allowable propagation delay remains the same, in an isolated system, the maximum cable length is shorter, but the CAN controller can be reconfigured to increase the total allowable propagation delay.

Propagation Delay Compensation

To compensate for the increased propagation delay due to longer buses or isolation, specific parameters related to timing and synchronization must be set for the CAN controller. When configuring the controller, you don’t just choose a data rate, you set the variables that determine the bit time used by the controller. The Baud Rate Prescaler (BRP) for the oscillator or internal clock sets the Time Quantum (TQ), the bit time being a multiple of TQ. Hardware selection of the oscillator, and software configuration of BRP and TQ per bit time sets the data rate.

The controller’s bit time is divided into three or four time periods, as shown in Figure 3. The total number of TQs per bit time includes a synchronization and set number of propagation delay (PROP), phase segment 1 (PS1), and phase segment 2 (PS2). Sometimes, PROP and PS1 are added together. The configuration adjusts the sampling points to support propagation delay and resynchronization.

Placing the sampling point later in the bit time can support longer propagation delays, but like the overall data rate, the sampling point depends on other timing variables, which have their own limits. For example, the internal clock/oscillator may be fixed and only integer BRP and TQ numbers can be used. Therefore, the desired data rate required for a particular cable length may not be achieved at all, so the cable must be shortened, or the data rate reduced.

Resynchronization will lengthen PS1 and shorten PS2. The length and shortening are the TQ numbers specified by the synchronous hop width (SJW). Therefore, PS2 must not be shorter than SJW. The number of TQs required by the SJW depends on the clock tolerance of the CAN controller. For SJW and PS2, the crystal oscillator generally supports the minimum number of TQs.

Configuration of the CAN Controller

In order to achieve a robust network with reliable timing and synchronization between nodes, the system must be able to tolerate the propagation delay at the selected data rate and CAN controller clock conditions. If not, you can choose to reduce the data rate, shorten the bus, or use a different CAN controller clock rate. The configuration process consists of the following three steps.

Step 1: Check Clock and Prescaler – Match Data Rate

First verify what are the possible configurations given the target data rate and CAN controller clock conditions. The TQ interval must be calculated based on the clock and various BRP values, and possible combinations are only those where the TQ interval is an integer multiple of the bit time. Depending on the stage of the system design, other CAN controller clock rates may also be considered. In the calculation example shown in Table 1, a maximum data rate of 1 Mbps is given, using a Microchip® MCP2515 stand-alone CAN controller and an ADSP-BF548 Blackfin processor with a built-in CAN controller. The MCP2515 fOSC depends on the external hardware oscillator used, while the ADSP-BF548 fSCLK depends on the hardware CLKIN and internal PLL settings (CLKIN multiplier for VCO, VCO divider for SCLK). Only certain combinations of CAN controller clock and BRP (integer number of TQs) support data rates of 1 Mbps, as shown in bold. This limits the bit timing settings, so once a bus data rate is selected, only some options are available.

Table 1. Number of TQs at 1 Mbps for given f and BRP

Step 2: Determine the bit field configuration

The next step is to determine the number of TQs required for each bit segment. The most difficult case is to support maximum propagation delay at a data rate of 1 Mbps, eg, 40 meters long cable, isolated nodes. Ideally, the bit period should be configured so that the sampling point is as late in the bit as possible. In Table 1, for each integer total number of TQs, one TQ must be provided to the SYNC segment, and the PS2 (or TSEG2) segment must be large enough to accommodate the CAN controller message processing time (as long as the BRP is greater than 4, the MCP2515 is 2 TQ, ADSP-BF548 is less than 1 TQ). Also, for the MCP2515, PROP and PS1 can each have up to 8 TQ; for the ADSP-BF548, TSEG1 (PROP + PS1) can have up to 16 TQ.

Figure 4 and Figure 5 show the possible total TQ configurations for the MCP2515 and ADSP-BF548, respectively, to support the nearest sample point for a valid clock and BRP combination at 1 Mbps. The optimal TQ total for the MCP2515 is 19, requiring a hardware oscillator of 38 MHz and a BRP of 1. For the ADSP-BF548, all configurations are at least 85% sample points except for a total of 5 TQs, but the optimal setting is 10 TQ, requiring fSCLK = 50 MHz and BRP = 5.

Figure 4. Possible Total TQ Configurations for MCP2515 (1 Mbps Rate, Maximum Propagation Delay)

Figure 5. Possible total TQ configuration for ADSP-BF548 (1 Mbps rate, maximum propagation delay)

Step 3: Match Transceiver/Isolation Latency and Bus Length to Configuration

After helping the CAN controller achieve the optimal sampling point, the final step is to compare the allowed propagation delay with the CAN transceiver/isolator and bus length used. Assuming an optimal configuration of the ADSP-BF548 at 10 TQ (fSCLK = 50 MHz, BRP = 5), the maximum possible propagation delay is 900 ns. For the ADM3053 isolated CAN transceiver with integrated isolated power supply, the maximum loop delay in the data sheet (TxD off, receiver inactive) is 250 ns. It must be doubled (500 ns) to support both transmit and receive delays at the two nodes on the farthest ends of the bus.

Assuming a cable propagation delay of 5 ns/m, the ADSP-BF548 can support a bus length of 40 meters (which is the maximum at 1 Mbps according to the ISO 11898 specification), the bit time of the ADSP-BF548 is 10 TQ in total, TSEG 2 bits Segments are only 1 TQ. In practice, a slightly earlier sampling point is sufficient, since extreme transceiver propagation delays on one node may even lead to simple retransmissions (automatically handled by the data link layer CAN controller), however, since the CAN controller I There is a small delay between the /O and the CAN transceiver, so it is recommended to configure the sampling point as late as possible.

in conclusion

Isolation is good for robustness, but it also increases propagation delay in both transmit and receive directions. This delay must be doubled to allow two nodes to participate in quorum. If the allowable propagation delay of the system is fixed, after adding isolation measures, the cable length or data rate can be reduced. Another approach is to reconfigure the CAN controller to support the maximum propagation delay that guarantees the required data rate and bus length, even if the nodes are isolated.

The Links:   DM9000EP DG2406427