CN117376058A - CAN bus baud rate self-adaption method - Google Patents
CAN bus baud rate self-adaption method Download PDFInfo
- Publication number
- CN117376058A CN117376058A CN202311666740.4A CN202311666740A CN117376058A CN 117376058 A CN117376058 A CN 117376058A CN 202311666740 A CN202311666740 A CN 202311666740A CN 117376058 A CN117376058 A CN 117376058A
- Authority
- CN
- China
- Prior art keywords
- duration
- baud rate
- bus
- phase buffer
- segment
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 23
- 230000003044 adaptive effect Effects 0.000 claims description 5
- 230000005540 biological transmission Effects 0.000 claims description 4
- 238000012423 maintenance Methods 0.000 abstract description 4
- 238000009434 installation Methods 0.000 abstract description 3
- 238000011161 development Methods 0.000 description 3
- 238000004519 manufacturing process Methods 0.000 description 2
- 230000002093 peripheral effect Effects 0.000 description 2
- 238000005070 sampling Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 238000007689 inspection Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000001360 synchronised effect Effects 0.000 description 1
- 230000007704 transition Effects 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L12/00—Data switching networks
- H04L12/28—Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
- H04L12/40—Bus networks
- H04L12/4013—Management of data rate on the bus
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L12/00—Data switching networks
- H04L12/28—Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
- H04L12/40—Bus networks
- H04L2012/40208—Bus networks characterized by the use of a particular bus standard
- H04L2012/40215—Controller Area Network CAN
Landscapes
- Engineering & Computer Science (AREA)
- Quality & Reliability (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Small-Scale Networks (AREA)
Abstract
The invention discloses a CAN bus baud rate self-adaption method, which is characterized in that a controller is connected with CAN equipment of a product, and the method comprises the following steps: s1, starting CAN equipment; s2, the controller receives CAN bus message information sent by the CAN equipment and matches the baud rate matched with the CAN bus message information; s3, the controller judges whether the adapted baud rate is consistent with the actual baud rate of the CAN bus of the main chip in the controller at the moment; and S4, if the phase buffer segment 1 and the phase buffer segment 2 in the main chip in the controller are consistent, the controller stores the duration of the phase buffer segment 1 and the duration of the propagation segment in the main chip, and if the phase buffer segment 1 and the duration of the phase buffer segment 2 in the main chip are inconsistent, the controller adjusts the duration of the phase buffer segment 1 and the duration of the propagation segment in the main chip, so that the actual baud rate of the CAN bus of the main chip is switched. The method of the invention CAN self-adapt to the bus baud rate, reduce the product configuration of the clients and the CAN baud rates with the same function, and reduce the error rate of installation and after-sales maintenance.
Description
Technical Field
The invention relates to the field of CAN bus baud rate adjustment. More particularly, the invention relates to a CAN bus baud rate adaptive method.
Background
In the network development process of the whole vehicle, different branch layouts are required to be made on the network topology of the whole vehicle in order to consider the bus load rate of the whole vehicle, and the baud rate of CAN branches of the layout bus is also different on the layout of the same type of products in different vehicle enterprises and types, if the bus rate difference of the different vehicle types is required to be developed in the products for goods supply, a method capable of automatically adapting the baud rate of the CAN lines of the whole vehicle is required, and the benefits of after-sale replacement maintenance and the management and transportation cost CAN be solved.
Disclosure of Invention
To achieve these objects and other advantages and in accordance with the purpose of the invention, as embodied and broadly described herein, a method for adaptive CAN bus baud rate, a controller connected to a CAN device of a product, comprises the steps of:
s1, starting CAN equipment;
s2, the controller receives CAN bus message information sent by the CAN equipment, and matches the baud rate matched with the CAN bus message information according to the CAN bus message information;
s3, the controller judges whether the adapted baud rate is consistent with the actual baud rate of the CAN bus of the main chip in the controller at the moment;
s4, if the phase buffer segment 1 and the phase buffer segment 2 in the main chip in the controller are consistent, the controller stores the duration of the phase buffer segment 1, the duration of the phase buffer segment 2 and the duration of the propagation segment, wherein the CAN baud rate=1/CAN bit time, and the CAN bit time=the duration of the phase buffer segment 1+the duration of the phase buffer segment 2+the duration of the propagation segment+1;
if the phase buffer section 1 and the phase buffer section 2 in the main chip are inconsistent, the controller adjusts the duration of the phase buffer section 1 and the duration of the transmission section, and then switches the actual baud rate of the CAN bus of the main chip to enable the actual baud rate to be matched with the information of the CAN bus message; after the baud rate is successfully adapted, the controller stores the duration of the phase buffer segment 1, the duration of the phase buffer segment 2 and the duration of the propagation segment in the main chip at the moment, so that the current CAN bus message information is adapted.
In another technical scheme, in the process of switching the CAN baud rate of the main chip bus, the product does not send any CAN message information.
In another technical scheme, in the step S2, after the controller receives the CAN bus message information sent by the CAN device, the controller judges whether the data frame of the received CAN bus message information is continuous, if the data frame is continuous 5 frames, the baud rate adapted to the CAN bus message information is matched continuously according to the CAN bus message information.
The invention at least comprises the following beneficial effects: the method of the invention CAN adapt to the bus baud rate, and CAN reduce the product configuration of the clients and the CAN baud rates with the same function, and reduce the error rate of installation and after-sale maintenance.
Additional advantages, objects, and features of the invention will be set forth in part in the description which follows and in part will become apparent to those having ordinary skill in the art upon examination of the following or may be learned from practice of the invention.
Drawings
Fig. 1 is a flow chart of a CAN bus baud rate adaptive method according to the present invention.
Detailed Description
The present invention is described in further detail below with reference to the drawings to enable those skilled in the art to practice the invention by referring to the description.
The following description is presented to enable one of ordinary skill in the art to make and use the invention. The preferred embodiments in the following description are by way of example only and other obvious variations will occur to those skilled in the art. The basic principles of the invention defined in the following description may be applied to other embodiments, variations, modifications, equivalents, and other technical solutions without departing from the spirit and scope of the invention.
It will be appreciated by those skilled in the art that in the present disclosure, the terms "longitudinal," "transverse," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," "outer," etc. refer to an orientation or positional relationship based on that shown in the drawings, which is merely for convenience of description and to simplify the description, and do not indicate or imply that the apparatus or elements referred to must have a particular orientation, be constructed and operated in a particular orientation, and therefore the above terms should not be construed as limiting the present invention.
It will be understood that the terms "a" and "an" should be interpreted as referring to "at least one" or "one or more," i.e., in one embodiment, the number of elements may be one, while in another embodiment, the number of elements may be plural, and the term "a" should not be interpreted as limiting the number.
The baud rate, which is a variable of the data rate, is expressed as Baudrate, which represents the number of binary numbers transmitted per second. In colloquial terms, baud rate is the speed/rate at which data is transmitted over a network. This is expressed in bits/second. Thus, the number of bits transmitted over the communication network in one second is the baud rate.
As shown in fig. 1, a preferred embodiment of the present invention provides a CAN bus baud rate adaptive method, comprising the steps of:
s1, starting CAN equipment;
s2, the controller receives CAN bus message information sent by the CAN equipment, and matches the baud rate matched with the CAN bus message information according to the CAN bus message information;
s3, the controller judges whether the adapted baud rate is consistent with the actual baud rate of the CAN bus of the main chip in the controller at the moment;
and S41, if the phase buffer segment 1 and the phase buffer segment 2 in the main chip in the controller are consistent, the controller stores the duration of the phase buffer segment 1, the duration of the phase buffer segment 2 and the duration of the propagation segment, wherein the CAN baud rate=1/CAN bit time, and the CAN bit time=the duration of the phase buffer segment 1+the duration of the phase buffer segment 2+the duration of the propagation segment+1.
S42, if the phase buffer segment 1 and the phase buffer segment 2 in the main chip are inconsistent, the controller adjusts the duration and the duration of the transmission segment, and then the actual baud rate of the CAN bus of the main chip is switched to adapt to the information of the CAN bus message; after the baud rate is successfully adapted, the controller stores the duration of the phase buffer segment 1, the duration of the phase buffer segment 2 and the duration of the propagation segment in the main chip at the moment, so that the current CAN bus message information is adapted.
Wherein the message information consists of a plurality of bits, each time CAN equipment transmits one bit, the phase buffer section 1, the phase buffer section 2, the synchronous section and the propagation section are required to be involved,
the time unit (Tg) refers to a unit time provided by a CAN clock in the CAN device, and as with other chip peripherals, any peripheral module needs to provide a suitable clock to work normally.
CAN baud rate=1/CAN bit time, and CAN bit time CAN be understood as the time required for CAN equipment to transmit one bit, specifically, CAN bit time=phase buffer segment 1 duration+phase buffer segment 2 duration+synchronization segment duration+propagation segment duration, from the foregoing, each CAN equipment transmits one bit to be composed of several "segments", that is, each segment is composed of four segments of phase buffer segment 1, phase buffer segment 2, synchronization segment and propagation segment, and each segment needs to occupy several "time units (Tg)", that is, each segment has a corresponding duration, and CAN baud rate=1/CAN bit time, so that it is necessary to obtain the baud rate of CAN by determining the durations of these segments, that is, determining the number of time units of each segment. Similarly, since the duration of the synchronization segment is generally 1 time unit, if the CAN bus baud rate is to be adjusted, the adjustment of the duration of the phase buffer segment 1 and the phase buffer segment 2 and the duration of the propagation segment CAN be realized.
Wherein, the synchronization section: for synchronizing each node on the CAN bus, the jump edge of the input signal occurs in the synchronization segment, and the duration of the synchronization segment is fixed to 1 Tg, so that in the formula CAN bit time=phase buffer segment 1 duration+phase buffer segment 2 duration+propagation segment duration+1, 1 is the duration of the synchronization segment, i.e. 1 time unit. The sync segment is used to synchronize the nodes on the bus, with the transition edge of one bit being within this period.
Propagation section: for compensating for physical transmission delay times between nodes. The pre-pass delay time is twice the signal propagation time on the bus, including the bus driver delay time. The length of the propagation section generally has a range of values, and the different controllers are not exactly identical.
Phase buffer section 1 and phase buffer section 2: are used to compensate for the most vibration errors between nodes, allowing the segment to be lengthened by resynchronisation (SJW). Sampling of the bus level sampling points is performed at the end of the period.
The CAN bus baud rate self-adaptive method of the embodiment automatically adjusts the bus baud rate, thereby reducing the product configuration of clients and the same function with different CAN baud rates, and reducing the error rate of installation and after-sales maintenance.
In another technical scheme, in the process of switching the CAN baud rate of the main chip, the product does not send any CAN message information, so that error information generated by a bus is avoided, and the error information is prevented from being interfered to the CAN bus.
In another technical scheme, in the step S2, after the controller receives the CAN bus message information sent by the CAN device, the controller judges whether the data frame of the received CAN bus message information is continuous, if the data frame is continuous 5 frames, the baud rate adapted to the CAN bus message information is matched continuously according to the CAN bus message information. The reason for setting the continuous judgment of 5 frames is to ensure the reliability of the data, and the distortion is caused by too few frames and errors exist.
The method can solve the problem that the product is not required to accept specific message information in a specific message accepting mode, and handshake operation is carried out to adapt to similar products with different vehicle types and different rates, so that development cost is increased, specific development is required to be carried out on handshake protocols, universality is not strong, and the quality of the product cannot be judged.
The method CAN solve the problem of adapting to similar products with different speeds of different vehicle types by marking different identification product types and marking different identifications, which indicates that the CAN baud rate of the products is different, thereby increasing the transportation cost and the management cost and increasing the inspection procedures of production and manufacture.
Although embodiments of the present invention have been disclosed above, it is not limited to the details and embodiments shown and described, it is well suited to various fields of use for which the invention would be readily apparent to those skilled in the art, and accordingly, the invention is not limited to the specific details and illustrations shown and described herein, without departing from the general concepts defined in the claims and their equivalents.
Claims (3)
1. The CAN bus baud rate self-adaption method is characterized in that a controller is connected with CAN equipment of a product, and the method comprises the following steps:
s1, starting CAN equipment;
s2, the controller receives CAN bus message information sent by the CAN equipment, and matches the baud rate matched with the CAN bus message information according to the CAN bus message information;
s3, the controller judges whether the adapted baud rate is consistent with the actual baud rate of the CAN bus of the main chip in the controller at the moment;
s4, if the phase buffer segment 1 and the phase buffer segment 2 in the main chip in the controller are consistent, the controller stores the duration of the phase buffer segment 1, the duration of the propagation segment and the duration of the propagation segment in the main chip, wherein the CAN baud rate=1/CAN bit time, and the CAN bit time=the duration of the phase buffer segment 1+the duration of the phase buffer segment 2+the duration of the propagation segment+1;
if the phase buffer section 1 and the phase buffer section 2 in the main chip are inconsistent, the controller adjusts the duration of the phase buffer section 1 and the duration of the transmission section, and then switches the actual baud rate of the CAN bus of the main chip to enable the actual baud rate to be matched with the information of the CAN bus message; after the baud rate is successfully adapted, the controller stores the duration of the phase buffer segment 1, the duration of the phase buffer segment 2 and the duration of the propagation segment in the main chip at the moment, so that the current CAN bus message information is adapted.
2. The CAN bus baud rate adaptive method of claim 1, wherein during CAN bus baud rate switching of the main chip, the product does not send any CAN message information.
3. The method according to claim 1, wherein in S2, after the controller receives the CAN bus message information sent by the CAN device, the controller determines whether the data frames of the received CAN bus message information are continuous, and if the data frames are continuous 5 frames, the method continues to match the baud rate adapted to the CAN bus message information according to the CAN bus message information.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311666740.4A CN117376058A (en) | 2023-12-07 | 2023-12-07 | CAN bus baud rate self-adaption method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311666740.4A CN117376058A (en) | 2023-12-07 | 2023-12-07 | CAN bus baud rate self-adaption method |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117376058A true CN117376058A (en) | 2024-01-09 |
Family
ID=89408158
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311666740.4A Pending CN117376058A (en) | 2023-12-07 | 2023-12-07 | CAN bus baud rate self-adaption method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117376058A (en) |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN207560000U (en) * | 2017-10-30 | 2018-06-29 | 深圳市三旺通信技术有限公司 | The controller LAN optic fiber converter of baud rate self-adapting |
CN111565138A (en) * | 2019-02-13 | 2020-08-21 | 厦门雅迅网络股份有限公司 | CAN bus baud rate self-adaption method based on dual systems and storage medium |
CN112835343A (en) * | 2021-01-04 | 2021-05-25 | 东风汽车股份有限公司 | Method for rapidly checking error frames of CAN (controller area network) bus of whole vehicle |
CN113688086A (en) * | 2021-08-23 | 2021-11-23 | 湖南芯力特电子科技有限公司 | Baud rate matching detection system of high-speed CAN transceiver for local network |
CN114500149A (en) * | 2022-01-05 | 2022-05-13 | 东风柳州汽车有限公司 | Baud rate self-adaptive adjusting method, device, equipment and storage medium |
CN115695476A (en) * | 2022-10-18 | 2023-02-03 | 广东Tcl智能暖通设备有限公司 | Multi-split air conditioner node communication method and system, electronic equipment and storage medium |
-
2023
- 2023-12-07 CN CN202311666740.4A patent/CN117376058A/en active Pending
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN207560000U (en) * | 2017-10-30 | 2018-06-29 | 深圳市三旺通信技术有限公司 | The controller LAN optic fiber converter of baud rate self-adapting |
CN111565138A (en) * | 2019-02-13 | 2020-08-21 | 厦门雅迅网络股份有限公司 | CAN bus baud rate self-adaption method based on dual systems and storage medium |
CN112835343A (en) * | 2021-01-04 | 2021-05-25 | 东风汽车股份有限公司 | Method for rapidly checking error frames of CAN (controller area network) bus of whole vehicle |
CN113688086A (en) * | 2021-08-23 | 2021-11-23 | 湖南芯力特电子科技有限公司 | Baud rate matching detection system of high-speed CAN transceiver for local network |
CN114500149A (en) * | 2022-01-05 | 2022-05-13 | 东风柳州汽车有限公司 | Baud rate self-adaptive adjusting method, device, equipment and storage medium |
CN115695476A (en) * | 2022-10-18 | 2023-02-03 | 广东Tcl智能暖通设备有限公司 | Multi-split air conditioner node communication method and system, electronic equipment and storage medium |
Non-Patent Citations (3)
Title |
---|
李国洪: "基于 Infineon CAN 器件的总线通信速率侦测方法", 《华北航天工业学院学报》, pages 393 - 9 * |
王家乐;程健;刘怡;桑庆双;: "基于CAN总线的低温等离子体设备***", 仪表技术与传感器 * |
邓莹;徐家明;牛方兴;王高举;刘双平;刘壮;: "基于CAN通信自适应的商用车诊断***开发及应用", 汽车电器, no. 08 * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US4939753A (en) | Time synchronization of control networks | |
CN103218331B (en) | Synchronous mode is adopted to switch and the self-adjusting bus unit of frame priority and method | |
JP4393768B2 (en) | Real-time channel calibration method and apparatus | |
CN106603367A (en) | CAN bus communication method for time synchronization | |
US9645958B2 (en) | Method and device for transmitting data having a variable bit length | |
JPH06169314A (en) | Bus system for local operation network | |
CN103098419A (en) | Method and apparatus for serial data transmission at a switchable data rate | |
US8204035B2 (en) | Network node | |
CN109639512B (en) | Hot backup method of VTS multi-sensor information comprehensive processing system | |
CN107465474A (en) | The clock synchronization system and method for digital control system bus apparatus | |
CN102202386A (en) | Clock synchronization method, device and system | |
US20020199051A1 (en) | Transmitting and receiving circuit and transmitting and receiving method | |
CN117376058A (en) | CAN bus baud rate self-adaption method | |
US20050083891A1 (en) | Method and apparatus for updating frame number | |
CN100566308C (en) | The time be used to provide the system node and the method for media arbitration in the tank systems | |
US20130242798A1 (en) | Apparatus for duplicating router in building automatic control system and controlling method thereof | |
KR20170125405A (en) | Time synchronization device and time synchronization system | |
US20070273511A1 (en) | Wireless synchronization systems and methods | |
US20220309022A1 (en) | Techniques for bus interval timing management in a usb extension system | |
US11115236B2 (en) | Subscriber station for a bus system and method for transmitting data in a bus system | |
CN113722254B (en) | Multi-host communication bus system suitable for industrial control site | |
CN111247501B (en) | Device and method for transmitting data between two physical interfaces | |
CN104333771A (en) | Synchronous control method and device of video streams | |
JPH04299630A (en) | Method for reconnecting repeater and port which is divided at repeater | |
CN110581745B (en) | Method and device for correcting time synchronization and frequency deviation of communication node |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |