Analysis of CAN Scheduling Theory and Practice

Publisher:悠闲自在Latest update time:2012-04-23 Keywords:CAN Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Analysis of CAN Scheduling Theory and Practice

Whether messages in the CAN bus can be delivered on time is an important indicator related to system safety and other issues, which must be verified through scheduling analysis. This article introduces the new research results of CAN scheduling theory, as well as its guiding significance for engineering applications and its implementation difficulties. It is divided into four parts: Tindell's analysis method and Davis's improvement; the author's simplification of Davis's algorithm; some results of worst response time analysis in application; and the difficulties of scheduling analysis in application.

Keywords CAN, scheduling theory, response time, Davis algorithm, Tindell algorithm

Distributed embedded systems are an important development direction of current embedded systems because they can provide stronger performance and save the overall cost of the system. However, since each individual node must be connected to a communication network to work in a coordinated manner, the network becomes a key part. Without the network to provide timely and correct data and commands, the designed system service is out of the question. In the distributed embedded system of automobiles, the current mainstream communication network is the CAN bus. CAN is an event-triggered communication protocol that automatically schedules the transmission of messages based on the priority of the message and the status of the node. Low-priority messages may not be sent in time due to too many high-priority messages occurring at the same time, and high-priority messages may also be lost due to the influence of node status, etc. For the limitations of CAN, please refer to reference [1]. This article mainly discusses the problems of the CAN system from the perspective of scheduling theory. These problems are very relevant to engineering applications and have strong practical significance.

1 Tindell's analysis method and Davis's improvement

In 1994, Tindell [23] first transformed the single-processor task scheduling method into a scheduling method suitable for the CAN bus to obtain the worst-case response time of the message. For safety-related applications, only when the worst-case response time is known accurately can it be reasonable. The implementation of CAN communication on the network goes through two stages: the communication task sends the message to the sending communication controller (CC), and the sending communication controller sends the message to the receiving communication controller. In general, the response time is the time from the occurrence of the event that requires communication to the arrival of the message at the target node, including the processing time in the sending node host, the time from the host to the CC, the arbitration transmission time of the message on the bus, and the processing time from the receiving CC to the host. Once the arbitration-winning message begins to be transmitted, it cannot be terminated, so CAN scheduling is a fixed-priority non-preemptive task scheduling. The parameters used by message m are defined as follows:

Tm - the interval between events that start communication, i.e., the period;
Jm - the maximum variation in time from the occurrence of an event to the start of message sending to CC, i.e., the jitter;
Cm - the time required to transmit message m on the bus (the maximum value formed by bit stuffing should be taken into account);
Dm - the time limit allowed for transmitting message m, determined by the application;
Rm - the actual worst transmission time;
Wm - the worst waiting time when transmitting message m.

The relationship between them is shown in Figure 1.

Click here to view the image in a new window
Figure 1. Time parameters used for scheduling analysis

Wm consists of two parts: the blocking Bm caused by messages with lower priority than m (whose set is written as lp(m)) being transmitted on the bus, and the interference Im caused by messages with higher priority than m (whose set is written as hp(m)) being transmitted on the bus first. When they take the maximum value, Wm becomes the worst waiting time.

Click here to view the image in a new window

For the convenience of printing and easy understanding, different writing methods are used here, where the ceiling function Ceiling returns the upper limit integer closest to (greater than or equal to) the variable, and τ is 1-bit time. Ceiling ( (Wm+Jk+τ)/Tk) represents the maximum number of times high-priority message k will appear in the Wm period. So:

Click here to view the image in a new window

Wm takes discrete values ​​and appears on both sides of the nonlinear equation (4). Fortunately, it is not difficult to solve. In equation (5), we can use W0m=Bm as the initial value and solve it repeatedly.

Click here to view the image in a new window

Formula (7) means that the worst waiting time has exceeded the time limit and message m cannot be scheduled.

By checking whether the messages are schedulable one by one in order of decreasing priority, it is possible to verify whether the entire communication system is schedulable.

At the 2006 Real-Time Network Conference, Bril, Davis, and others published an article about the loopholes in the Tindell algorithm. Later, they proposed a complete improved algorithm [4]. As a counterexample, message C in Table 1 is schedulable using the Tindell algorithm, with a worst-case response time of 3 ms; but the second transmission of message C has exceeded the time limit, as shown in Figure 2. The Tindell algorithm only considers the first transmission of message C.

Table 1 Counterexamples of Tindell's algorithm
Click here to view the image in a new window

Click here to view the image in a new window
Figure 2 The worst response time for message C is 3.5 ms

In addition, if the cycle of messages B and C is shortened to 3.25 ms, according to the Tindell algorithm, the system is still schedulable because the maximum worst response time is not obtained, but in fact the bus utilization rate has exceeded 100%. The core of Davis's method is to introduce the concept of busy cycle and then calculate the worst value of the response time of each transmission in the busy cycle. See Appendix 1 for details. (See the website of this magazine www.mesnet.com.cn - Editor's note.)

Tindell's pioneering work has a huge impact on subsequent research and applications. Volcano Communications Technology (now Mentor Graphics) developed commercial CAN scheduling analysis software based on this theory. Due to the discovery of the vulnerability, users should check whether the software has a new patch and whether the application completed with it is affected.

2. My Simplification of Davis Algorithm

Davis algorithm first calculates the busy cycle, and then finds the worst waiting time in multiple transmissions of message m during the busy cycle. The calculation can be simplified based on the following considerations:

During the busy cycle, when message m is being transmitted, a high-priority message enters the queue, causing more high-priority messages to be inserted before subsequent messages of m are sent, indicating that there is still a peak in bus demand, which may result in a larger worst-case response time for the subsequent message m.

The worst case is that all high-priority messages enter the queue as soon as message m is sent, that is, the phase leading the first sending slot after message m is sent reaches the maximum.

Therefore, there are two possibilities for calculating the worst response time of message m: use Bm to generate blocking and calculate the worst response time of message m like Tindell; use Cm to generate blocking and calculate the worst response time of the next message m. The queuing time of the next message m is Tm-Jm.

The advantage of the simplified method is that it reduces the number of calculations and thus reduces the workload.

This algorithm is different from the conservative algorithm in Davis algorithm in two aspects: first, it is possible to use Cm to generate blocking, for example, message m is a little earlier than the high-priority message when powering on from sleep mode; second, this algorithm obtains exact rather than conservative results.

Keywords:CAN Reference address:Analysis of CAN Scheduling Theory and Practice

Previous article:DTU hardware circuit diagram
Next article:Design of ship monitoring system with CAN bus redundancy

Recommended ReadingLatest update time:2024-11-16 15:59

stm32 CAN communication TJA1040
CAN protocol features 1.  All units in multi-master control can send messages, and the priority is determined by the identifier (ID). The unit that wins the arbitration (determined to have the highest priority) can continue to send messages, and the unit that loses the arbitration immediately stops sending and start
[Microcontroller]
CAN BUS architecture features, application advantages and case analysis
As the automotive industry continues to pursue goals such as safety and reliability, ultimate performance, comfort and convenience, and low cost, the highly complex system network within the car makes the wiring harness too large, resulting in increased costs and difficulty in continuously improving the network archit
[Automotive Electronics]
CAN BUS architecture features, application advantages and case analysis
Intel's internal Cannon Lake-Y 10nm CPU sample exposed with 3 small chips
Recently, an Intel CPU sample based on the Cannon Lake architecture was exposed on the Internet. The interesting thing is that the sample has 3 small chips. This CPU uses a 10nm process. Although the current models on the market have never adopted such a change, Intel may adopt this hybrid chip design in future models
[Home Electronics]
Application of Fuzzy Control in Data Acquisition and Control System Based on CAN Bus
Fuzzy Sets and Fuzzy Mathematics, founded by Professor LA Zadeh in 1965, provide a theoretical basis for the formation of fuzzy logic control. In recent years, with the continuous expansion of the production scale of various enterprises, the production process control system has become more and more complex. Due to the
[Industrial Control]
Application of Fuzzy Control in Data Acquisition and Control System Based on CAN Bus
Design and implementation of CAN bus node circuit
      CAN (Controller Area Network) is a controller area network. Due to its strong anti-interference ability, no concept of address in communication and unlimited number of nodes, it has been widely used in automobiles, CNC machine tools, instruments, field bus control and other fields. In the design of CAN bus nodes
[Microcontroller]
Design and implementation of CAN bus node circuit
WPG Group launches CAN/LIN communication matrix headlight solution based on Microchip, Onsemi and OSRAM products
On September 15, semiconductor component distributor WPG Holdings announced that its subsidiary Pinjia has launched a CAN/LIN communication matrix headlight solution based on Microchip's PIC16F1779, Onsemi's NCV78343 and OSRAM LED. Figure 1- A physical picture of the CAN/LIN communication matrix headlight solution l
[Automotive Electronics]
WPG Group launches CAN/LIN communication matrix headlight solution based on Microchip, Onsemi and OSRAM products
What are the rules for CAN bus synchronization?
Hardware synchronization The receiving unit performs synchronization adjustment when it detects the start of a frame in the idle state of the bus. Where an edge is detected, the value of SJW is not considered and it is considered to be an SS segment. The process of hardware synchronization is shown in the figur
[Embedded]
What are the rules for CAN bus synchronization?
CAN bus realizes industrial network distributed measurement and control system
1 Introduction Fieldbus technology is a hot topic in the development of automation field today. CAN bus has been widely used for its unique design, low cost, high reliability, real-time performance, strong anti-interference ability, etc. This paper uses CAN bus to design distributed thermal resistor intelligent
[Industrial Control]
CAN bus realizes industrial network distributed measurement and control system
Latest Analog Electronics Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号