WO2020140526A1 - 一种can波形模拟装置、模拟方法、can波形发送器 - Google Patents

一种can波形模拟装置、模拟方法、can波形发送器 Download PDF

Info

Publication number
WO2020140526A1
WO2020140526A1 PCT/CN2019/110183 CN2019110183W WO2020140526A1 WO 2020140526 A1 WO2020140526 A1 WO 2020140526A1 CN 2019110183 W CN2019110183 W CN 2019110183W WO 2020140526 A1 WO2020140526 A1 WO 2020140526A1
Authority
WO
WIPO (PCT)
Prior art keywords
waveform
frame
error
transceiver
controller
Prior art date
Application number
PCT/CN2019/110183
Other languages
English (en)
French (fr)
Inventor
郑丰
Original Assignee
珠海格力电器股份有限公司
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by 珠海格力电器股份有限公司 filed Critical 珠海格力电器股份有限公司
Publication of WO2020140526A1 publication Critical patent/WO2020140526A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/14Network analysis or design
    • H04L41/145Network analysis or design involving simulating, designing, planning or modelling of a network
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • H04L2012/40208Bus networks characterized by the use of a particular bus standard
    • H04L2012/40215Controller Area Network CAN
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • H04L2012/40267Bus for use in transportation systems
    • H04L2012/40273Bus for use in transportation systems the transportation system being a vehicle

Definitions

  • the present disclosure relates to the field of communication technology, and in particular, to a CAN waveform simulation device, simulation method, and CAN waveform transmitter.
  • the purpose of the present disclosure is to overcome the technical problems of incomplete coverage of the CAN message waveform sent by the CAN transmitter in the related art, which cannot effectively diagnose the stability and correctness of the CAN node, and to provide a CAN waveform simulation device, simulation method, CAN waveform transmitter.
  • a CAN waveform simulation method the method is as follows:
  • the CPU converts the pre-simulated waveform into a frame sequence
  • the CAN transceiver converts the received frame sequence to obtain an analog waveform.
  • the CPU generates configuration information according to the frame information of the frame sequence, configures the CAN controller according to the configuration information, the CAN transceiver sends the obtained analog waveform to the CAN controller, and the CAN control
  • the analyzer analyzes or outputs an analog waveform according to the configuration information and compares whether the received analog waveform is the pre-simulated waveform according to the output analog waveform, and outputs an analysis result.
  • the frame information includes one or more of remote frames, data frames and error frames.
  • types of error frames include one or more of fixed format errors, bit flip errors, check errors, response errors, gap field errors, active errors, and passive errors.
  • the CAN transceiver simulates the received frame sequence into a set of levels in a high-low level manner to form an analog waveform, where high level indicates any one or more of the remote frame and the data frame Normal frame, low level means error frame.
  • the CAN controller detects an error frame according to the configuration information, sends an error flag when an error frame is detected, and increases the REC value of the CAN controller by the first when sending the error flag
  • the preset value, the TEC value increases by the second preset value, and the CAN transceiver sends the error flag when it receives the error frame.
  • the frame sequence of the pre-simulated waveform includes the error frame
  • first configure the frame sequence of the normal frame and configure the frame sequence of the normal frame according to a preset error type to configure the error frame Frame sequence.
  • the analog waveform received by the CAN controller includes an error frame
  • the error frame is detected, query whether the REC value and the TEC value are as expected to determine whether it is Describe the pre-simulated waveform.
  • a CAN waveform simulation device including a microcontroller and a CAN transceiver,
  • the microcontroller includes a CPU, which is used to convert a pre-simulated waveform into a frame sequence and send the frame sequence to the CAN transceiver;
  • the CAN transceiver is used to convert the received frame sequence to obtain an analog waveform.
  • the microcontroller further includes a CAN controller, and the CPU is further configured to generate configuration information according to the frame information of the frame sequence, and configure the CAN controller according to the configuration information.
  • the transmitting pin of the CAN controller is connected to the first receiving pin of the CAN transceiver, the receiving pin of the CAN controller is connected to the transmitting pin of the CAN transceiver, the CAN The transmitting pin of the transceiver is also connected to the second receiving pin of the CAN transceiver.
  • the CAN transceiver is also used to send the obtained analog waveform to the CAN controller, and the CAN controller is used to analyze or output the analog waveform according to the configuration information and output the analog waveform according to the output simulation Waveform, compare whether the received analog waveform is the pre-simulated waveform, and output the analysis result.
  • a CAN waveform transmitter includes the CAN waveform simulation device described above.
  • a CAN waveform simulation device, simulation method, and CAN waveform transmitter provided by the present disclosure are used to simulate various waveforms in various actual scenarios or theoretical scenarios to Diagnose the functionality and stability of the CAN bus and each node.
  • FIG. 1 is a block diagram of a CAN waveform simulation device of the present disclosure
  • FIG. 3 is a simulation flowchart of normal frames of the present disclosure
  • FIG. 5 is a simulation flowchart of the error frame of the present disclosure
  • Figures 6-10 are simulation waveforms of this disclosure.
  • the CAN protocol supports 4 different frame types for communication:
  • Data frame send the sending node to the receiving node to transmit data; remote frame: mainly used for requesting information, when node A sends a remote frame to node B, if the data frame information in node B has the same identifier as node A, the node B will respond and send the corresponding data frame to the bus.
  • Error frame A frame sent by any node when the bus detects an error.
  • Overload frame Provide an extra delay between the two data frames before or after the remote frame.
  • the data frame contains the following content: (1) the start of the frame; (2) the arbitration field containing the identifier and the type of information being sent; (3) the control field containing the number of data bits; (4) up to 8 bytes of data Field; (5) cyclic redundancy check (CRC) bit; (6) reply bit; (7) frame end bit.
  • CRC cyclic redundancy check
  • DLC data length code, indicating the number of bytes in the data frame (0 to 8 bits)
  • CRC contains a 16-bit cyclic redundancy check calculation, most of the information is cyclic redundancy check
  • a CAN waveform simulation device includes a microcontroller 1 and a CAN transceiver 2,
  • the microcontroller 1 includes a CPU 11, an SPI bus 12, and a CAN controller 13.
  • the CPU 11 converts the pre-simulated waveform into a frame sequence, generates configuration information based on the frame information of the frame sequence, and configures the CAN controller 13 according to the configuration information.
  • the SPI bus 12 sends the frame sequence to the CAN transceiver 2, when sending, the frame sequence is sent as a binary code stream, and the CAN transceiver 2 receives
  • the frame sequence is reached, the binary code stream is converted into a differential signal through calculation.
  • the CAN transceiver 2 simulates the received frame sequence into a set of level sets in a high-low level manner to form an analog waveform.
  • the above frame information includes One or more of remote frames, data frames and error frames.
  • High level means any one or more normal frames in the remote frame and data frame
  • low level means error frame.
  • the types of the above error frames include fixed format error, bit flip error, check error, response error, interval field error , One or more of active errors and passive errors, the waveform is simulated and stored in the buffer software area, and then the data in the buffer software area is configured to the hardware buffer and sent to the CAN controller 13 above, the CAN controller 13
  • the configuration information analysis or output the analog waveform according to the configuration information and compare the received analog waveform with the pre-simulated waveform according to the output analog waveform, detect the error frame according to the configuration information, and send the error flag when the error frame is detected
  • increase the REC value of the CAN controller by the first preset value for example, add 1, TEC value by the second preset value, for example, add 8, output the analysis result,
  • the above-mentioned transmission pin CAN-TX of the CAN controller 13 is connected to the first reception pin GAN-IP-TX of the CAN transceiver 2, and the reception pin CAN-RX of the CAN controller 13 and the transmission pin of the CAN transceiver 2 GEN-TX connection, the above-mentioned transmission pin GEN-TX of the CAN transceiver 2 is also connected to the second receiving pin CAN-RX of the CAN transceiver 2, the CAN transceiver 2 receives the frame sequence sent by the CPU 1 through the SPI bus 12 on the one hand On the other hand, through the first receiving pin GAN-IP-TX, the CAN controller 13 sends the frame sequence sent by the CAN-TX pin.
  • the CAN transceiver 2 When the CAN transceiver 2 receives the frame sequence, it calculates, converts the analog waveform, and sends The pin GEN-TX is sent to the CAN controller 13, and the CAN controller 13 receives the analog waveform sent by the CAN transceiver 2 through the receiving pin CAN-RX.
  • a CAN waveform transmitter includes the CAN waveform simulation device described above.
  • a CAN waveform simulation method includes the following steps:
  • the CPU generates configuration information according to the frame information of the frame sequence, configures the CAN controller according to the configuration information, the CAN transceiver sends the obtained analog waveform to the CAN controller, and the CAN controller analyzes the configuration information or based on the configuration information Output analog waveform and compare whether the received analog waveform is a pre-simulated waveform according to the output analog waveform, and output the analysis result,
  • the specific implementation is as follows:
  • the CPU converts the pre-simulated waveform into a frame sequence, generates configuration information based on the frame information of the above frame sequence, configures the CAN controller according to the configuration information, and configures and configures the frame sequence in a binary code stream and sends it through
  • the SPI bus sends the above frame sequence to the CAN transceiver.
  • the frame sequence is sent as a binary code stream.
  • the CAN transceiver receives the frame sequence, the binary code stream is converted into a differential signal by calculation, CAN transceiver
  • the device simulates the received frame sequence into a set of levels in high and low levels to form an analog waveform, where high level indicates any one or more normal frames in the remote frame and data frame, and low level indicates an error Frames.
  • the types of error frames include one or more of fixed format errors, bit flip errors, parity errors, response errors, gap field errors, active errors, and passive errors.
  • the waveform is simulated and stored in the buffer software area , And then configure the data in the buffer software area to the hardware buffer and send it to the CAN controller.
  • the CAN controller analyzes the configuration information or outputs the analog waveform according to the configuration information and compares the received analog waveform with the output analog waveform. In order to pre-simulate the waveform, an error frame is detected according to the configuration information. When an error frame is detected, an error flag is sent.
  • the REC value of the above CAN controller is increased by 1
  • the TEC value is increased by 8
  • the analysis result is output
  • REC and TEC on each node of the CAN bus, which are used to count the number of receiving errors and sending errors, respectively.
  • the frame sequence of the pre-simulated waveform includes an error frame
  • first configure the frame sequence of the normal frame and configure the frame sequence of the normal frame according to the preset error type to configure the frame sequence of the error frame.
  • the simulation of the normal frame is shown in FIG. 3 Display, first configure the frame information, including ID, DATA, frame type, data length, then simulate the sof waveform, simulate the id domain waveform, simulate the ctrotal domain waveform, simulate the data domain waveform at the CAN transceiver, then calculate the crc and simulate the crc domain waveform , Insert stuff bit waveform and adjust the start index of each domain and the end index of the current waveform, then simulate the ack domain waveform, and finally simulate the end domain waveform.
  • Stuff bit is when the message on the bus appears 5 consecutive levels between the sof field and the crc field. The six levels must be opposite to the values of the first five consecutive levels.
  • the process of inserting stuff is shown in Figure 4, and the specific steps are described as follows:
  • This process first reads the logic level corresponding to the offset value in the temporary buffer temp frame at this time, and adds 1 to the temp bit to determine if the current position temp frame analog value is the same as the previous Whether the analog value is equal at one time, if it is, the continuous equality flag (samecnt) is increased by 1, otherwise it is cleared to 0, and then judge whether the samecnt is equal to 4, and also determine whether the current analog level index value reaches the starting field of crc If the condition is not true, the value read from tempbuf is written to the pframe buffer, and then the loop cumulative value i is increased by 1. If the previous condition is true, the continuous flag (samecnt) is cleared first.
  • the starting offset of the ctroal, crc, and data fields is incremented by one. Then invert the currently obtained analog level value and write it to the gframe buffer, then write the current simulated level value to the gframe, and finally assign the current simulated level value to the previous level value (preBitValue ). Loop back and forth until the end of the original frame is traversed. Finally, the insertion of the stuff of the entire frame is completed.
  • the pre-simulated waveform output by the above CAN controller includes an error frame
  • query whether the REC value and the TEC value are as expected to determine whether it is a pre-simulated waveform so as shown in Figure 5 .
  • First configure the frame sequence of the normal frame configure the frame sequence of the normal frame according to the preset error type to configure the frame sequence of the error frame, for example, if a certain bit field is wrong, send an error flag, continue to send the normal frame waveform, and query the REC value And TEC values are in line with expectations.
  • Figure 6.1 is the waveform of a normal CAN data frame received by the CAN controller as the RX end on the bus. Therefore, the CAN transceiver needs software to simulate the waveform into a set of levels in a high-low level manner, and finally send it out through the CAN transceiver hardware module.
  • Figure 6.2.1 is the waveform automatically sent by the TX end hardware of the CAN controller
  • Figure 6.2.2 is the waveform level on the bus simulated by the GEN_TX end through the software. At this time, as the CAN controller, the waveform it actively sends is the same as the analog waveform collected from the bus, so the TX terminal can normally send a normal data frame.
  • Figure 7.1 is the CAN controller end as the RX end. After erroneously estimating the waveform of a certain bit in the crc domain, the waveform actually simulated on the bus. You can see that the next bit of the error level starts to send the error flag. At this time, the running program of the CAN controller can see that the CAN REC value is increased by 1, and at the same time, it has not received a frame of data normally, which is in line with expectations.
  • Figure 7.2.1 is the bus waveform of the CAN controller side as the TX side. You can see that an error flag appears after the crc field. Then it continued to send a correct frame.
  • Figure 7.2.2 is a waveform diagram sent by the CAN transceiver, which is consistent with the TX waveform of the CAN controller. At this time, the CAN controller just collects the same bus waveform that it sends, which conforms to the CAN SPEC protocol and meets expectations. .
  • Figure 8.2.2 is the waveform sent by the CAN transceiver. It is consistent with the TX waveform of the CAN controller. At this time, the CAN controller just collects the same bus waveform that it sends, which conforms to the CAN SPEC protocol and meets expectations.
  • Figure 10.1 and Figure 10.2 are waveform diagrams of race conditions on the analog bus.
  • the ID2 domain (dominant) in Figure 10.1 has higher priority than the ID2 domain (invisible) in Figure 10.2.
  • the TX end of the CAN controller is normally transmitted. Waveform, and the TX of the CAN transceiver must keep the same waveform synchronously. Until the TX end of the CAN controller is completed, the CAN transceiver continues to send the waveform from ID3 until the end. Finally, through the register on the CAN controller side, you can know that the CAN controller side can finally send its own data frame normally, and it can also receive the data frame on the CAN transceiver side.
  • the waveform and controller status are in line with CAN SPEC and in line with expectations.
  • a CAN waveform simulation device, simulation method, and CAN waveform transmitter provided by the present disclosure are used to simulate various waveforms in various actual scenarios or theoretical scenarios to Diagnose the functionality and stability of the CAN bus and each node.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Small-Scale Networks (AREA)

Abstract

本公开公开了一种CAN波形模拟装置、模拟方法、CAN波形发送器,方法如下:CPU将预模拟波形转换成帧序列;将所述帧序列发送至CAN收发器;所述CAN收发器将接收到的帧序列进行转换得到模拟波形,CPU根据所述帧序列的帧信息生成配置信息,根据配置信息配置CAN控制器,所述CAN收发器将得到的模拟波形发送至所述CAN控制器,所述CAN控制器根据配置信息分析或根据配置信息输出模拟波形并根据输出的模拟波形,对比接收到的模拟波形是否为预模拟波形,输出分析结果。本公开通过模拟各种实际场景或理论场景下的各种波形,用以诊断CAN总线及各节点的功能性和稳定性。

Description

一种CAN波形模拟装置、模拟方法、CAN波形发送器
本公开以2019年1月4日递交的、申请号为201910007907.3且名称为“一种CAN波形模拟装置、模拟方法、CAN波形发送器”的专利文件为优先权文件,其全部内容通过引用结合在本公开中。
技术领域
本公开涉及通信技术领域,具体的涉及一种CAN波形模拟装置、模拟方法、CAN波形发送器。
背景技术
随着电子技术的迅速发展和在汽车上的广泛应用,汽车电子化程度越来越高,汽车上的电控装置也越来越多,例如电子燃油喷射装置、防抱死制动装置、驱动防滑系统、电控自动变速器、安全气囊、主动悬架、电动窗等。集成电路和单片机在汽车上的广泛使用,大大增加了汽车上的电子控制器的数量,使得线路越来越复杂。许多中高档轿车上采用了十几个甚至二十几个电控单元,为了简化线路,提高各电控单元之间的通信速度,降低故障频率,采用车载网络来实现车载电子设备之间的通信,同时提高控制单元间通讯可靠性和降低导线成本的网络总线技术应用成为汽车电子领域的最大热点,其中CAN总线的使用己成为现代汽车网络总线的关键技术,目前市面上通常的CAN波形发射器只能用来发射数据帧、远程帧,等CAN的正常帧,但是例如错误帧、过载帧等错误帧不能随心所欲的构造,只能按固定的格式去构造错误,例如CAN Scope,因此发射器发出来的CAN报文波形覆盖性并不完整,不能有效诊断CAN节点的稳定性和正确性。
发明内容
本公开的目的在于克服相关技术中CAN发射器发出来的CAN报文波形覆盖性不完整,不能有效诊断CAN节点的稳定性和正确性的技术问题,提 供一种CAN波形模拟装置、模拟方法、CAN波形发送器。
一种CAN波形模拟方法,方法如下:
CPU将预模拟波形转换成帧序列;
将所述帧序列发送至CAN收发器;
所述CAN收发器将接收到的所述帧序列进行转换得到模拟波形。
进一步的,所述CPU根据所述帧序列的帧信息生成配置信息,根据所述配置信息配置CAN控制器,所述CAN收发器将得到的模拟波形发送至所述CAN控制器,所述CAN控制器根据所述配置信息分析或根据所述配置信息输出模拟波形并根据输出的模拟波形,对比接收到的模拟波形是否为所述预模拟波形,输出分析结果。
进一步的,所述帧信息包括远程帧、数据帧和错误帧中的一种或多种。
进一步的,所述错误帧的类型包括固定格式错误、位翻转错误、校验错误、应答错误、间隔场错误、主动错误和被动错误中的一种或多种。
进一步的,所述CAN收发器将接收到的所述帧序列以高低电平的方式模拟成一组电平的集合形成模拟波形,其中,高电平表示远程帧和数据帧中任意一种或多种正常帧,低电平表示错误帧。
进一步的,所述CAN控制器根据所述配置信息检测错误帧,在检测到错误帧的情况下,发送错误标志,在发送所述错误标志时,将所述CAN控制器的REC值增加第一预设值,TEC值增加第二预设值,同时所述CAN收发器接收到所述错误帧时,发送所述错误标志。
进一步的,在所述预模拟波形的帧序列包括所述错误帧的情况下,先配置正常帧的帧序列,根据预设的错误类型配置所述正常帧的帧序列以配置所述错误帧的帧序列。
进一步的,在所述CAN控制器接收的模拟波形包括错误帧的情况下,且检测到所述错误帧的情况下,查询所述REC值和所述TEC值是否符合预期,以判断是否为所述预模拟波形。
一种CAN波形模拟装置,包括微控制器和CAN收发器,
所述微控制器包括CPU,所述CPU用于将预模拟波形转换成帧序列,并将所述帧序列发送至所述CAN收发器;
所述CAN收发器用于将接收到的所述帧序列进行转换得到模拟波形。
进一步的,所述微控制器还包括CAN控制器,所述CPU还用于根据所述帧序列的帧信息生成配置信息,根据所述配置信息配置所述CAN控制器。
进一步的,所述CAN控制器的发送管脚与所述CAN收发器的第一接收管脚连接,所述CAN控制器的接收管脚与所述CAN收发器的发送管脚连接,所述CAN收发器的发送管脚还与所述CAN收发器的第二接收管脚连接。
进一步的,所述CAN收发器还用于将得到的模拟波形发送至所述CAN控制器,所述CAN控制器用于根据所述配置信息分析或根据所述配置信息输出模拟波形并根据输出的模拟波形,对比接收到的模拟波形是否为所述预模拟波形,输出分析结果。
一种CAN波形发送器,使用上述的CAN波形模拟方法。
一种CAN波形发送器,包括上述的CAN波形模拟装置。
由上述对本公开的描述可知,与相关技术相比,本公开提供的一种CAN波形模拟装置、模拟方法、CAN波形发送器,通过模拟各种实际场景或理论场景下的各种波形,用以诊断CAN总线及各节点的功能性和稳定性。
附图说明
图1为本公开一种CAN波形模拟装置框图;
图2为本公开一种CAN波形模拟流程图;
图3为本公开正常帧的模拟流程图;
图4为本公开插入stuff bit流程图;
图5为本公开错误帧的模拟流程图;
图6-10为本公开仿真波形。
具体实施方式
以下将结合本公开实施例中的附图对本公开中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅是本公开的一部分实施例,而不是全部的实施例。
下面先对CAN总线的一些名词进行描述:
CAN协议支持用于通信的4中不同的帧类型:
数据帧:送发送节点到接收节点传送数据;远程帧:主要用于请求信息,当节点A向节点B发送一个远程帧,如果节点B中的数据帧信息与节点A有相同的标识符,节点B将做出应答,并发送相应的数据帧到总线上。错误帧:在总线检测错误时,任意一个节点所发送的帧。过载帧:在前后两个数据帧或远程帧之间提供一个额外的延时。数据帧包含如下内容(1)帧的起始;(2)包含标志符和被发送信息类型的仲裁域;(3)包含数据位数的控制域;(4)多达8个字节的数据域;(5)循环冗余检查(CRC)位;(6)应答位;(7)帧结束位。
SOF:数据帧的起始,表示数据帧从此处开始
Id(标志符):
信息优先:当两个或更多节点竞争总线时,决定了信息的优先级;
信息过滤:决定一个传输的信息能否被CAN模块收到。
DLC:数据长度代码,表示在数据帧中字节的个数(0~8位)
Data:4个16位字用于保存一个CAN信息的8字节数据域
CRC:包含一个16位循环冗余检查计算,绝大部分信息均进行循环冗余检查
ACK:数据应答
EOF:数据帧的结束
如图1所示,一种CAN波形模拟装置,包括微控制器1和CAN收发器2,
上述微控制器1包括CPU 11、SPI总线12、CAN控制器13,上述CPU11将预模拟波形转换成帧序列,根据上述帧序列的帧信息生成配置信息,根据配置信息配置CAN控制器13,配置时,将帧序列以二进制码流的方式配置并发送,上述SPI总线12将上述帧序列发送至CAN收发器2,发送时,将帧序列以二进制码流的方式发送,上述CAN收发器2接收到帧序列时,通过计算,将二进制码流转换为差分信号,CAN收发器2将接收到的帧序列以高低电平的方式模拟成一组电平的集合形成模拟波形,其中,上述帧信息包括远程帧、数据帧和错误帧中的一种或多种。高电平表示远程帧和数据帧中任意一种或多种正常帧,低电平表示错误帧,上述错误帧的类型包括固定格式错误、位翻转错误、校验错误、应答错误、间隔场错误、主动错误和被动错误中的一种或多种,将波形模拟好后存放在缓冲软件区,再将缓冲软件区的数据配置到硬件缓冲区,发送至上述CAN控制器13,上述CAN控制器13根据配置信息分析或根据配置信息输出模拟波形并根据输出的模拟波形,对比接收到的模拟波形是否为预模拟波形,根据配置信息检测错误帧,在检测到错误帧的情况下,发送错误标志,在发送错误标志时,将上述CAN控制器的REC值增加第一预设值,例如加1,TEC值增加第二预设值,例如加8,输出分析结果,
上述CAN控制器13的发送管脚CAN-TX与CAN收发器2的第一接收管脚GAN-IP-TX连接,CAN控制器13的接收管脚CAN-RX与CAN收发器2的发送管脚GEN-TX连接,上述CAN收发器2的发送管脚GEN-TX还与CAN收发器2的第二接收管脚CAN-RX连接,CAN收发器2一方面通过SPI总线12接收CPU1发送的帧序列,另一方面通过第一接收管脚GAN-IP-TX接收CAN控制器13发送管脚CAN-TX发送的帧序列,CAN收发器2接收到帧序列时,进行计算,转换模拟波形,通过发送管脚GEN-TX发送至CAN控制器13,CAN控制器13通过接收管脚CAN-RX接收CAN收发器2发送的模拟波形。
一种CAN波形发送器,包括上述的CAN波形模拟装置。
如图2所示,一种CAN波形模拟方法,包括以下步骤:
S1:CPU将预模拟波形转换成帧序列;
S2:通过SPI总线将上述帧序列发送至CAN收发器;
S3:上述CAN收发器将接收到的帧序列进行转换得到模拟波形;
S4:CPU根据上述帧序列的帧信息生成配置信息,根据配置信息配置CAN控制器,上述CAN收发器将得到的模拟波形发送至上述CAN控制器,上述CAN控制器根据配置信息分析或根据配置信息输出模拟波形并根据输出的模拟波形,对比接收到的模拟波形是否为预模拟波形,输出分析结果,
具体实施如下:CPU将预模拟波形转换成帧序列,根据上述帧序列的帧信息生成配置信息,根据配置信息配置CAN控制器,配置时,将帧序列以二进制码流的方式配置并发送,通过SPI总线将上述帧序列发送至CAN收发器,发送时,将帧序列以二进制码流的方式发送,上述CAN收发器接收到帧序列时,通过计算,将二进制码流转换为差分信号,CAN收发器将接收到的帧序列以高低电平的方式模拟成一组电平的集合形成模拟波形,其中,高电平表示远程帧和数据帧中任意一种或多种正常帧,低电平表示错误帧,上述错误帧的类型包括固定格式错误、位翻转错误、校验错误、应答错误、间隔场错误、主动错误和被动错误中的一种或多种,将波形模拟好后存放在缓冲软件区,再将缓冲软件区的数据配置到硬件缓冲区,发送至上述CAN控制器,上述CAN控制器根据配置信息分析或根据配置信息输出模拟波形并根据输出的模拟波形,对比接收到的模拟波形是否为预模拟波形,根据配置信息检测错误帧,在检测到错误帧的情况下,发送错误标志,在发送错误标志时,将上述CAN控制器的REC值加1,TEC值增加8,输出分析结果,在CAN总线的每个节点上均有REC和TEC,分别用于统计接收错误和发送错误的数目。
在预模拟波形的帧序列包括错误帧的情况下,先配置正常帧的帧序列,根据预设的错误类型配置正常帧的帧序列以配置错误帧的帧序列,正常帧的模拟如图3所示,首先配置帧信息,包括ID,DATA、帧类型、数据长度,接着在CAN收发器模拟sof波形,模拟id域波形,模拟ctrotal域波形,模 拟data域波形,接着计算crc并模拟crc域波形,插入stuff bit波形并调整各个域的起始索引和当前波形的结束索引,然后模拟ack域波形,最后模拟结束域波形。由于模拟出一个正确帧的最关键的步骤是模拟插入stuff bit,根据CAN协议知道:Stuff bit就是当总线上的报文在sof域和crc域之间连续出现5个相同的电平时,在第六个电平必须是和前5个连续电平值相反。插入stuff bit流程如图4所示,具体步骤描述如下:
首先初始化检测报文波形连续相同电平检测标志值(samecnt)为0和帧起始位置在缓冲区中的偏移索引(frameStartBitPos),接着根据配置计算crc域,data域,和ctrotal域在模拟波形缓冲区的偏移索引。然后将原始帧缓冲区波形拷贝到临时缓冲区temp frame,设置前一个波形的电平值(preBitValue)为0,并将该电平值写入波形缓冲区pframe。接着判断遍历帧的索引值是否到达帧结尾处,如果是则更新帧的结束位置索引值。如果不是就进入插入stuff bit流程,该过程首先读取临时缓冲区temp frame中此时偏移值对应的逻辑电平,并且将temp bit pos累加1,判断如果当前位置temp frame模拟值是否和前一次模拟值是否相等,如果是,则连续相等标志(samecnt)加1,否则将其清0,接着判断samecnt是否等于4,同时也要判断当前模拟电平索引值是否到达了crc的起始域,如果该条件不成立,则将tempbuf中读取的值写入pframe缓冲区,然后将循环累计值i加1,如果之前条件成立,则先将连续标志(samecnt)清0。再根据此时波形索引偏移值所在帧区域的值来决定是否调整ctroal,crc,data域的起始偏移,如果要调整,则要将待调整域的起始索引值进行加1操作。然后将当前获得的模拟电平的值取反并写入gframe缓冲区,然后再将当前模拟的电平值写入gframe,最后将当前模拟的电平值赋值给前一次的电平值(preBitValue)。以此循环往复,直到遍历至原始帧结尾处。最终完成对整个帧的stuff bit的插入动作。
在上述CAN控制器输出的预模拟波形包括错误帧的情况下,在检测到错误帧的情况下,查询REC值和TEC值是否符合预期,以判断是否为预模拟波形,因此如图5所示,先配置正常帧的帧序列,根据预设的错误类型配置正常帧的帧序列以配置错误帧的帧序列,例如弄错某个bit域,发送错误标志,继续发送正常帧波形,查询REC值和TEC值是否符合预期。
接下来针对几种常见错误的处理,分析总线上应该模拟出来的CAN的波形:
图6.1是CAN控制器作为RX端接受到的一个正常的CAN数据帧在总线上的波形。因此CAN收发器中需要软件将该波形以高低电平的方式模拟成一组电平的集合,最后通过CAN收发器硬件模块将其发送出去。图6.2.1是CAN控制器的TX端硬件自动发送的波形,图6.2.2是GEN_TX端通过软件模拟出来的总线上的波形电平。此时作为CAN控制器来说它主动发送的波形和从总线上采集到的模拟波形一样,因此TX端就可以正常的发送一个正常的数据帧。
图7.1是CAN控制器端作为RX端将crc域中的某个bit的波形估计弄错后总线上实际模拟出来的波形,可以看见在错误电平的下一个bit time接着就开始发送错误标志,此时在CAN控制器的运行的程序可以看到CAN的REC值加1,同时也没有正常收到一帧数据,符合预期。图7.2.1是CAN控制器端作为TX端的总线波形,可以看见在crc域之后出现了错误标志。然后又继续发送了一个正确帧。图7.2.2是CAN收发器端发送的波形图,它和CAN控制器端的TX波形保持一致,此时CAN控制器端也就正好采集到自己发送一样的总线波形,符合CAN SPEC协议,达到预期。
图8.1是CAN控制器端作为RX端bit error的总线波形,这里的bit error选择将crc delimiter弄错,本来是高电平弄成低电平,接着发送错误标志波形,这串波形此时会在CAN收发器的TX端模拟发出,就好像CAN控制器端真实的接受到了这样一个错误帧。图8.2.1是CAN控制器端作为TX端bit error的总线波形,这里的bit error选择将crc delimiter故意弄错,本来是高电平弄成低电平,接着发送错误帧,然后又发送一个正确帧,这部分波形由CAN控制器的CAN控制器TX端发出。图8.2.2是CAN收发器端发送的波形,它和CAN控制器端的TX波形保持一致,此时CAN控制器端也就正好采集到自己发送一样的总线波形,符合CAN SPEC协议,达到预期。
如图9.1,图9.2.1,图9.2.2,stuff bit error波形分析同理bit error分析。
图10.1和图10.2是模拟总线上竞态的波形图,在图10.1的ID2域(显性)比图10.2的ID2域(隐形)优先级高,此时在CAN控制器端的TX端就正常发送波形,同时CAN收发器的TX就必须同步的保持一样的波形。直到CAN控制器的TX端发送完毕,之后CAN收发器端继续接着从ID3发送波形,直到结束。最后通过CAN控制器端的寄存器可以知道,CAN控制器端最后是可以正常发送自己的数据帧,同时也可以接受到CAN收发器端的数据帧。波形和控制器状态都符合CAN SPEC,符合预期。
由上述对本公开的描述可知,与相关技术相比,本公开提供的一种CAN波形模拟装置、模拟方法、CAN波形发送器,通过模拟各种实际场景或理论场景下的各种波形,用以诊断CAN总线及各节点的功能性和稳定性。
上述仅为本公开的若干具体实施方式,但本公开的设计构思并不局限于此,凡利用此构思对本公开进行非实质性的改动,均应属于侵犯本公开保护范围的行为。

Claims (14)

  1. 一种CAN波形模拟方法,其特征在于,方法如下:
    CPU将预模拟波形转换成帧序列;
    将所述帧序列发送至CAN收发器;
    所述CAN收发器将接收到的所述帧序列进行转换得到模拟波形。
  2. 根据权利要求1所述的CAN波形模拟方法,其特征在于,还包括:所述CPU根据所述帧序列的帧信息生成配置信息,根据所述配置信息配置CAN控制器,所述CAN收发器将得到的模拟波形发送至所述CAN控制器,所述CAN控制器根据所述配置信息分析或根据所述配置信息输出模拟波形并根据输出的模拟波形,对比接收到的模拟波形是否为所述预模拟波形,输出分析结果。
  3. 根据权利要求2所述的CAN波形模拟方法,其特征在于:所述帧信息包括远程帧、数据帧和错误帧中的一种或多种。
  4. 根据权利要求3所述的CAN波形模拟方法,其特征在于:所述错误帧的类型包括固定格式错误、位翻转错误、校验错误、应答错误、间隔场错误、主动错误和被动错误中的一种或多种。
  5. 根据权利要求1-4任意一项所述的CAN波形模拟方法,其特征在于:所述CAN收发器将接收到的所述帧序列以高低电平的方式模拟成一组电平的集合以形成模拟波形,其中,高电平表示远程帧和数据帧中任意一种或多种正常帧,低电平表示错误帧。
  6. 根据权利要求5所述的CAN波形模拟方法,其特征在于:所述CAN控制器根据所述配置信息检测所述错误帧,在检测到所述错误帧的情况下,发送错误标志,在发送错误标志时,将所述CAN控制器的REC值增加第一预设值,TEC值增加第二预设值,同时所述CAN收发器接收到所述错误帧时,发送所述错误标志。
  7. 根据权利要求6所述的CAN波形模拟方法,其特征在于:在所述预模拟波形的帧序列包括所述错误帧的情况下,先配置所述正常帧的帧序列,根据预设的错误类型配置所述正常帧的帧序列以配置所述错误帧的 帧序列。
  8. 根据权利要求7所述的CAN波形模拟方法,其特征在于:在所述CAN控制器接收的模拟波形包括所述错误帧的情况下,且在检测到所述错误帧的情况下,查询所述REC值和所述TEC值是否符合预期,以判断是否为所述预模拟波形。
  9. 一种CAN波形模拟装置,其特征在于:包括微控制器和CAN收发器,所述微控制器包括CPU,所述CPU用于将预模拟波形转换成帧序列,并将所述帧序列发送至所述CAN收发器;
    所述CAN收发器用于将接收到的所述帧序列进行转换得到模拟波形。
  10. 根据权利要求9所述的CAN波形模拟装置,其特征在于:所述微控制器还包括CAN控制器,所述CPU还用于根据所述帧序列的帧信息生成配置信息,根据所述配置信息配置所述CAN控制器。
  11. 根据权利要求10所述的CAN波形模拟装置,其特征在于:所述CAN控制器的发送管脚与所述CAN收发器的第一接收管脚连接,所述CAN控制器的接收管脚与所述CAN收发器的发送管脚连接,所述CAN收发器的发送管脚还与所述CAN收发器的第二接收管脚连接。
  12. 根据权利要求10或11所述的CAN波形模拟装置,其特征在于:所述CAN收发器还用于将得到的模拟波形发送至所述CAN控制器,所述CAN控制器用于根据所述配置信息分析或根据所述配置信息输出模拟波形并根据输出的模拟波形,对比接收到的模拟波形是否为所述预模拟波形,输出分析结果。
  13. 一种CAN波形发送器,其特征在于:使用权利要求1-8任意一项所述的CAN波形模拟方法。
  14. 一种CAN波形发送器,其特征在于:包括权利要求9-11任意一项所述的CAN波形模拟装置。
PCT/CN2019/110183 2019-01-04 2019-10-09 一种can波形模拟装置、模拟方法、can波形发送器 WO2020140526A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910007907.3 2019-01-04
CN201910007907.3A CN111416761A (zh) 2019-01-04 2019-01-04 一种can波形模拟装置、模拟方法、can波形发送器

Publications (1)

Publication Number Publication Date
WO2020140526A1 true WO2020140526A1 (zh) 2020-07-09

Family

ID=71407247

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/110183 WO2020140526A1 (zh) 2019-01-04 2019-10-09 一种can波形模拟装置、模拟方法、can波形发送器

Country Status (2)

Country Link
CN (1) CN111416761A (zh)
WO (1) WO2020140526A1 (zh)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1191747A2 (en) * 2000-08-02 2002-03-27 National Instruments Corporation System and method for interfacing a can device and a peripheral device
CN101630439A (zh) * 2009-08-12 2010-01-20 中国矿业大学 煤矿混合传输传感器网
CN105959143A (zh) * 2016-05-18 2016-09-21 中国电子科技集团公司第四十研究所 一种基于数字荧光示波器的FlexRay总线协议分析系统及方法
CN206389387U (zh) * 2017-01-17 2017-08-08 上海辰竹仪表有限公司 用于本安防爆领域的can信号传输装置

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103475523B (zh) * 2013-09-10 2016-04-27 浙江大学 带总线错误解析功能的can总线分析系统
US10326865B2 (en) * 2015-03-24 2019-06-18 Concio Holdings LLC Filter or bridge for communications between CAN and CAN-FD protocol modules
CN105978777B (zh) * 2016-06-22 2019-05-24 广州致远电子股份有限公司 一种波形存储方法及装置
CN107222362B (zh) * 2017-05-26 2020-06-30 南京越博动力系统股份有限公司 一种整车can网络自动化测试平台及其优化方法
CN107102637B (zh) * 2017-06-23 2019-07-16 哈尔滨工业大学 基于can的总线信号故障模拟装置产生故障信号的方法
CN107592239A (zh) * 2017-08-31 2018-01-16 中国第汽车股份有限公司 一种can网络电源变动自动化测试装置及其方法

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1191747A2 (en) * 2000-08-02 2002-03-27 National Instruments Corporation System and method for interfacing a can device and a peripheral device
CN101630439A (zh) * 2009-08-12 2010-01-20 中国矿业大学 煤矿混合传输传感器网
CN105959143A (zh) * 2016-05-18 2016-09-21 中国电子科技集团公司第四十研究所 一种基于数字荧光示波器的FlexRay总线协议分析系统及方法
CN206389387U (zh) * 2017-01-17 2017-08-08 上海辰竹仪表有限公司 用于本安防爆领域的can信号传输装置

Also Published As

Publication number Publication date
CN111416761A (zh) 2020-07-14

Similar Documents

Publication Publication Date Title
CN108028790B (zh) 异常检测方法、异常检测装置及异常检测系统
US11296965B2 (en) Abnormality detection in an on-board network system
US6157972A (en) Apparatus and method for processing packetized information over a serial bus
US8509257B2 (en) CAN node, and communication method of communication system including CAN node
US11245547B2 (en) Monitoring controller area network (CAN) nodes
CN106598018B (zh) 控制器区域网络(can)装置以及用于操作can装置的方法
US8180940B2 (en) Method and system for transmission of cyclic and acyclic data over a transmission channel that takes into account real-time capability
CN106878124A (zh) 用于控制车辆内大容量诊断通信的方法和车辆控制器
JP3117000B2 (ja) 通信システムおよびそれに使用される電子制御装置
CN113412604B (zh) 串行总线系统的用户站和在串行总线系统中通信的方法
KR101334017B1 (ko) 차량 네트워크의 메시지 무결성 체크 시스템 및 방법
CN111614531B (zh) 用于监视lin节点的方法、介质、监视设备
CN109861795B (zh) Canfd总线系统采样点配置与测试方法及相应的数据传输方法
US6738843B2 (en) Method and system for generating multiple self-ID packets on the 1394 bus using a standard PHY chip
WO2020140526A1 (zh) 一种can波形模拟装置、模拟方法、can波形发送器
US11928019B2 (en) Serial management interface with improved reliability
KR101704300B1 (ko) Can 메시지 송수신 방법 및 이를 실행하는 시스템
KR0165887B1 (ko) 바이트폭 반복필터
EP1305922B1 (en) Ground level shift detection in can systems
JP5958335B2 (ja) 通信ノード、及び通信システム
KR20060017035A (ko) 복수의 센서 데이터를 하나의 캔 메시지로 전송하는 방법
Laufenberg et al. CAN Simulation Framework-From Classic CAN to CAN XL
Xu et al. Implementation of FlexRay protocol with an automotive application
CN114726482B (zh) 一种spi数据传输方法
KR102595722B1 (ko) 통신 네트워크, 이에 연결된 노드를 식별하는 방법 및 장치

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19907664

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19907664

Country of ref document: EP

Kind code of ref document: A1