CN114416627A - Method for realizing variable speed of CAN controller - Google Patents

Method for realizing variable speed of CAN controller Download PDF

Info

Publication number
CN114416627A
CN114416627A CN202111531231.1A CN202111531231A CN114416627A CN 114416627 A CN114416627 A CN 114416627A CN 202111531231 A CN202111531231 A CN 202111531231A CN 114416627 A CN114416627 A CN 114416627A
Authority
CN
China
Prior art keywords
module
information processing
controller
frame
standard
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
Application number
CN202111531231.1A
Other languages
Chinese (zh)
Inventor
问昊龙
吴为
徐孟豪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xidian University
Original Assignee
Xidian University
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 Xidian University filed Critical Xidian University
Priority to CN202111531231.1A priority Critical patent/CN114416627A/en
Publication of CN114416627A publication Critical patent/CN114416627A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/42Bus transfer protocol, e.g. handshake; Synchronisation
    • G06F13/4282Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3664Environments for testing or debugging software
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/382Information transfer, e.g. on bus using universal interface adapter

Abstract

The invention discloses a method for realizing the variable speed of a CAN controller in the technical field of information processing, which comprises the following steps: building an information processing model based on a CAN2.0 standard; modifying the information processing module; establishing a verification environment of the information processing model; testing the information processing model; the method realizes the characteristic of variable transmission data rate of the CAN FD, is developed according to protocol specifications, has good compatibility, has the IO interface compatible with the standard CAN2.0 protocol and the AMBA protocol, and CAN meet the requirements of various CAN2.0 devices; meanwhile, the method is compatible with the verification test environment based on the original CAN2.0 protocol, and CAN realize quick verification through reuse, thereby reducing the development workload; aiming at the test environment of the variable-rate transmission function in the method, most working states can be covered through small parameter adjustment, the reusability is high, the application difficulty is greatly reduced, and further the research and development cost is reduced.

Description

Method for realizing variable speed of CAN controller
Technical Field
The invention relates to the technical field of information processing, in particular to a method for realizing the variable rate of a CAN controller.
Background
With the rapid development of integrated circuit technology, electronic consumer products, embedded motherboards, and automotive and industrial applications have also rapidly developed, and thus, the demand for high-speed, low-cost, and highly reliable communication has also rapidly increased. One of the technical development hotspots in the field of automation at present, the fieldbus provides strong technical support for the distributed control system to realize reliable and real-time data communication among all nodes.
The CAN bus is one of the most commonly used open field buses at present, and is applied to the field of automotive electronics at the earliest, and with the development of technology, the CAN bus is applied to various fields including navigation, aviation, medical treatment, industrial control and the like, and most of the existing devices conform to the CAN2.0 standard.
With the continuous development of the technology, for the information transmission requirements of automobile intelligentization, automatic driving, advanced assistant driving systems and the like, the traditional CAN bus has more and more limitations in the aspects of transmission bandwidth and data load, the bus load basically reaches the limit, a new bus technology is needed for meeting the requirements of high bandwidth, high throughput, high reliability, strong compatibility, low cost and the like of a vehicle-mounted bus, and a CAN FD bus is generated accordingly.
The CAN FD bus is an upgrade of the traditional CAN bus, inherits the differential signal transmission technology, the bit stream coding technology, the arbitration technology, the error detection technology, the fault isolation technology, the bit synchronization technology and the message confirmation technology, and increases the variable rate technology and the transmission delay compensation technology on the basis, increases the effective data length, enables the CAN FD bus to have higher transmission bandwidth, larger data load and more reliable data transmission, CAN meet the communication requirements of a new generation of vehicle-mounted bus, and is a vehicle-mounted bus technology with great development prospect. At present, the research on the CAN controller is few in China, most of the CAN controller is applied to foreign IP, and the CAN controller is mostly applied to the field of new energy automobiles, which is also caused by multiple factors such as price and technology, so that simple research personnel do not have enough funds and technical information, and the research on CAN FD is hindered, so that a method for realizing the CAN FD characteristic during data transmission, namely the transmission rate is variable, is urgently needed to be designed in actual life.
Disclosure of Invention
The present invention provides a method for implementing a variable rate of a CAN controller, so as to solve the problem of the prior art that a method for implementing a variable transmission rate is urgently needed to be designed.
In order to achieve the purpose, the invention provides the following technical scheme: a method for realizing the variable rate of a CAN controller comprises the following steps:
s1: building an information processing model based on a CAN2.0 standard;
s2: modifying the information processing module;
s3: establishing a verification environment of the information processing model;
s4: testing the information processing model;
step S2, among other things, modifies the desired properties in the information handling model design code, adding the required interface signals and state jumps.
Preferably, the information processing model in step S1 includes a top module, a registers module, a btl module, a bsp module, a ibo module, an acf module, a crc module, and a fifo module, the top module is in signal connection with the registers module, the btl module, and the bsp module, and the bsp module is in signal connection with the ibo module, the acf module, the crc module, and the fifo module.
Preferably, the step S2 specifically includes: adding a macro definition CAN _ FD _ TOLERANT in an external parameter module file, adding an interface signal required for realizing CAN FD characteristics in an bsp module, and adding two signals, namely fdf _ o and go _ rx _ skip _ fdf _ o on the basis of original state conversion to realize the function of controlling the transmission rate; macro definition is carried out on the instantiated module interface at the top module, so that the instantiated module interface meets the requirement of data transmission, and after macro is defined, corresponding interface signals can be correspondingly connected; and redefine a new port connection mode in the instantiated btl module; finally, the partial code is modified for the state transition.
Preferably, the step S3 is to write CAN _ testbench.v, and build a verification environment of the CAN controller, which mainly implements the following functions:
(1) instantiating the can _ top _ raw file at the top layer;
(2) initializing can _ top _ raw by controlling clk, i.e., a clock signal, and rst _ n, i.e., a reset signal;
(3) controlling the work of can _ top _ raw by controlling the writing of signals into the register;
(4) designing a test scene, establishing a task related to the test, simulating an external input signal, and driving the instantiated component can _ top _ raw _ inst.
Preferably, the step S4 includes the following three test tasks:
(1) send _ can _ frame _ basic, send the standard data frame;
(2) send _ can _ FD _ frame _ basic, send standard FD data frame;
(3) send _ can _ frame _ after _ can _ FD _ frame, which is sent after the standard FD frame, mainly tests the response of the FDF bits.
Compared with the prior art, the invention has the beneficial effects that: the invention realizes the characteristic of variable transmission data rate of CAN FD, is developed according to protocol specifications, has good compatibility, has IO interface compatible with standard CAN2.0 protocol and AMBA protocol, and CAN meet the requirements of various CAN2.0 devices; meanwhile, the method is compatible with the verification test environment based on the original CAN2.0 protocol, and CAN realize quick verification through reuse, thereby reducing the development workload; aiming at the test environment of the variable-rate transmission function in the method, most working states can be covered through small parameter adjustment, the reusability is high, the application difficulty is greatly reduced, and further the research and development cost is reduced.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a flow chart of the present invention;
FIG. 2 is a schematic diagram of an information processing model according to the present invention;
FIG. 3 is a diagram illustrating a code block added in step two of the present invention;
FIG. 4 is a schematic diagram of interface signals added in step two of the present invention;
FIG. 5 is a schematic diagram of a port connection modification part in step two of the present invention;
FIG. 6 is a schematic diagram illustrating a modification of the skip part in step two of the present invention;
FIG. 7 is a schematic diagram of a simulation environment of a CAN controller in step three of the present invention;
FIG. 8 is a diagram illustrating a standard data frame transmission result in step four according to the present invention;
FIG. 9 is a diagram illustrating a simulation waveform of the whole information transmission in step four according to the present invention;
FIG. 10 is a diagram illustrating a simulation waveform of the data transmission part in step four according to the present invention;
FIG. 11 is a diagram illustrating simultaneous transmission of CAN FD and CAN messages in step four according to the present invention;
FIG. 12 is a state jump flow diagram of the present invention;
FIG. 13 is a simulation flow chart of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In the description of the present invention, it is to be understood that the terms "upper", "lower", "front", "rear", "left", "right", "top", "bottom", "inner", "outer", and the like, indicate orientations or positional relationships based on the orientations or positional relationships shown in the drawings, are merely for convenience in describing the present invention and simplifying the description, and do not indicate or imply that the device or element being referred to must have a particular orientation, be constructed and operated in a particular orientation, and thus, should not be construed as limiting the present invention.
Referring to fig. 1, the present invention provides a technical solution: a method for realizing the variable rate of a CAN controller comprises the following steps:
s1: building an information processing model based on a CAN2.0 standard;
s2: modifying the information processing module;
s3: establishing a verification environment of the information processing model;
s4: testing the information processing model;
step S2, among other things, modifies the desired properties in the information handling model design code, adding the required interface signals and state jumps.
Referring to fig. 2, the information processing model in step S1 includes a top module, a registers module, a btl module, a bsp module, a ibo module, an acf module, a crc module, and a fifo module, the top module is in signal connection with the registers module, the btl module, and the bsp module, and the bsp module is in signal connection with the ibo module, the acf module, the crc module, and the fifo module.
Step S2 specifically includes: adding macro definition CAN _ FD _ TOLERANT in an external parameter module file, adding an interface signal required for realizing CAN FD characteristics in an bsp module, and adding two signals, namely fdf _ o and go _ rx _ skip _ fdf _ o, on the basis of original state conversion, as shown in FIG. 3, so as to realize the function of controlling the transmission rate; macro definition is performed on the instantiated module interface at the top module, so that the instantiated module interface meets the requirement of data transmission, and after the macro is defined, corresponding interface signals can be correspondingly connected, as shown in fig. 4; and redefine a new port connection mode in the instantiated btl module, as shown in fig. 5; finally, as shown in fig. 6, partial codes are modified for state transition, and modification is performed on the basis of the original design, so that cost is saved, learning cost is reduced, and researchers who have gone through CAN2.0 CAN make improvements more easily.
Step S3 is to write CAN _ testbench.v, and build up a verification environment of the CAN controller, as shown in fig. 7, the following functions are mainly implemented:
(1) instantiating the can _ top _ raw file at the top layer;
(2) initializing can _ top _ raw by controlling clk, i.e., a clock signal, and rst _ n, i.e., a reset signal;
(3) controlling the work of can _ top _ raw by controlling the writing of signals into the register;
(4) designing a test scene, establishing a task related to the test, simulating an external input signal, and driving the instantiated component can _ top _ raw _ inst.
Wherein, step S4 includes the following three test tasks:
(1) send _ can _ frame _ basic, send the standard data frame;
(2) send _ can _ FD _ frame _ basic, send standard FD data frame;
(3) send _ can _ frame _ after _ can _ FD _ frame, which is sent after the standard FD frame, mainly tests the response of the FDF bits.
The method specifically comprises the following steps:
(1) and (3) sending a standard CAN data frame:
calling a test case send _ can _ frame _ basic, configuring a register value 8'hea with an address bit of 8' h0a for the purpose of configuring the upper 8 bits of the identification code as 8'hea, wherein the identification code under the standard format has 11 bits in total, configuring a register value 8' h28 with an address bit of 8'h0b for the purpose of configuring the lower 3 bits of the identification code as 3' h1, configuring the rtr bit as 1'h0, and configuring the DLC bit as 4' h 8; the ID code of the final data frame after the above configuration should be 11' b11101010001, the rtr position should be 1' b0, and the DLC position should be 4' b 1000; the data content is configured as follows: the addresses are sequentially arranged from 8'h0c to 8' h13, the contents in the registers are sequentially byte1 to byte8, and are respectively set to 8'hd6, 8' hbe, 8'h09, 8' hbf, 8'h6c, 8' h3b, 8'hf4 and 8' h 28.
As can be seen from the simulation operation, the start bit sof is 1'b0, and then the ID code is sent, and as can be seen from fig. 8, the delivered value is 11' b11101010001, and the comparison shows that the delivered value is correct; rtr bit, r1 bit and r0 bit are all low level, which is in accordance with the preset, dlc is 4' b1000, which indicates that data with 8byte length will be transferred subsequently; following dlc is the portion of the data frame that is expected except for the interpolation of byte2, byte3, byte4, and byte7 that occurs because the same level is transmitted continuously; and finally, the transmitted data are in accordance with the expectation after the verification is passed.
(2) Sending standard CAN FD data frame:
calling the test case send _ CAN _ FD _ frame _ basic, the configuration ID is 11'b01010101010, the RTR bit is 1' b1, the FDF bit is 1'b1, the DLC is 4' b0111, the data byte is 8'h56, 8' hbe, 8'h09, 8' hbf, 8'h6c, 8' h3b, 8'hf4, and the crc is 15' b1100_0001_0010_111, and after running the simulation case, as shown in fig. 9, the ID, RTR, FDF, DLC and data in the simulation waveform are all expected, and the rate is higher in the data transmission part compared with other parts, the characteristic of CAN FD variable rate transmission is realized, as CAN be seen from fig. 10 being the analysis of the data part in fig. 9, the data transmission part in the test case is completely the same as the data transmission part in the test case, and the functional design is complete.
(3) After sending the standard CAN FD data frame, sending the standard CAN data frame:
calling a test case send _ CAN _ frame _ after _ CAN _ FD _ frame, firstly calling a send _ CAN _ FD _ frame _ basic task, secondly setting the FDF to be 0, jumping to the called send _ CAN _ frame _ basic task, and after simulation operation, obtaining a simulation waveform shown in the following figure 11, as shown in the figure, the simulation firstly enters the transmission of CAN FD information, after the transmission is finished, the FDF jumps to be 0, and at this time, the transmission of CAN information starts; the transmission is respectively the same as the simulation waveforms of the test (1) and the test (2), the switching of CAN and CAN FD transmission is realized, the design not only realizes the transmission characteristic of CAN FD, but also is compatible with the function of CAN2.0, and the state jump flow and the simulation flow are respectively shown in fig. 12 and 13.
In the description herein, references to the description of "one embodiment," "an example," "a specific example" or the like are intended to mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
The preferred embodiments of the invention disclosed above are intended to be illustrative only. The preferred embodiments are not intended to be exhaustive or to limit the invention to the precise embodiments disclosed. Obviously, many modifications and variations are possible in light of the above teaching. The embodiments were chosen and described in order to best explain the principles of the invention and the practical application, to thereby enable others skilled in the art to best utilize the invention. The invention is limited only by the claims and their full scope and equivalents.

Claims (5)

1. A method for realizing the variable speed of a CAN controller is characterized by comprising the following steps:
s1: building an information processing model based on a CAN2.0 standard;
s2: modifying the information processing module;
s3: establishing a verification environment of the information processing model;
s4: testing the information processing model;
step S2, among other things, modifies the desired properties in the information handling model design code, adding the required interface signals and state jumps.
2. The method of claim 1 for implementing a variable rate CAN controller, wherein: the information processing model in the step S1 includes a top module, a registers module, a btl module, a bsp module, a ibo module, an acf module, a crc module, and a fifo module, the top module is in signal connection with the registers module, the btl module, and the bsp module, and the bsp module is in signal connection with the ibo module, the acf module, the crc module, and the fifo module.
3. The method of claim 1 for implementing a variable rate CAN controller, wherein: the step S2 specifically includes: adding a macro definition CAN _ FD _ TOLERANT in an external parameter module file, adding an interface signal required for realizing CAN FD characteristics in an bsp module, and adding two signals, namely fdf _ o and go _ rx _ skip _ fdf _ o on the basis of original state conversion to realize the function of controlling the transmission rate; macro definition is carried out on the instantiated module interface at the top module, so that the instantiated module interface meets the requirement of data transmission, and after macro is defined, corresponding interface signals can be correspondingly connected; and redefine a new port connection mode in the instantiated btl module; finally, the partial code is modified for the state transition.
4. The method of claim 1 for implementing a variable rate CAN controller, wherein: step S3 is to write CAN _ testbench.v., and build up a verification environment of the CAN controller, which mainly implements the following functions:
(1) instantiating the can _ top _ raw file at the top layer;
(2) initializing can _ top _ raw by controlling clk, i.e., a clock signal, and rst _ n, i.e., a reset signal;
(3) controlling the work of can _ top _ raw by controlling the writing of signals into the register;
(4) designing a test scene, establishing a task related to the test, simulating an external input signal, and driving the instantiated component can _ top _ raw _ inst.
5. The method of claim 1 for implementing a variable rate CAN controller, wherein: the step S4 includes the following three test tasks:
(1) send _ can _ frame _ basic, send the standard data frame;
(2) send _ can _ FD _ frame _ basic, send standard FD data frame;
(3) send _ can _ frame _ after _ can _ FD _ frame, which is sent after the standard FD frame, mainly tests the response of the FDF bits.
CN202111531231.1A 2021-12-15 2021-12-15 Method for realizing variable speed of CAN controller Pending CN114416627A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111531231.1A CN114416627A (en) 2021-12-15 2021-12-15 Method for realizing variable speed of CAN controller

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111531231.1A CN114416627A (en) 2021-12-15 2021-12-15 Method for realizing variable speed of CAN controller

Publications (1)

Publication Number Publication Date
CN114416627A true CN114416627A (en) 2022-04-29

Family

ID=81266829

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111531231.1A Pending CN114416627A (en) 2021-12-15 2021-12-15 Method for realizing variable speed of CAN controller

Country Status (1)

Country Link
CN (1) CN114416627A (en)

Similar Documents

Publication Publication Date Title
US7594226B2 (en) Implementation of packet-based communications in a reconfigurable hardware element
WO2018040016A1 (en) Protocol converter and protocol conversion method
CN112988495B (en) Multifunctional test method, device and system for SOC chip multiplex pin
CN114089713A (en) Communication method based on UDS, ECU and upper computer
JP3415849B2 (en) Data bus controllers and processes
JP2001016234A (en) Can controller and one-chip computer incorporating the can controller
Lawrenz Worldwide Status of CAN–Present and Future
CN114416627A (en) Method for realizing variable speed of CAN controller
US5636343A (en) Microcomputer with built-in serial input-output circuit and collision detection circuit responsive to common input-output line being occupied
CN113341853B (en) IP core, FPGA chip, alternating current servo driver and communication method
Deepika et al. Design of dual master I2C bus controller and interfacing it with DC motor
Feng et al. CAN bus application in automotive network control
CN114488871A (en) Control method, frequency converter and computer readable storage medium
US8327049B2 (en) Electrical process interface device
CN111198841A (en) Profibus _ DP slave station based on reworks system
Phail Controller Area Network-An In-Vehicle Network Solution
CN115663549B (en) Multi-interface conversion device and vehicle
Lorenz Advanced gateways in automotive applications
Li et al. Design of stm32-based canopen motion control master in transfer robot
CN115509146B (en) Distributed communication resource integration method for flight maintenance simulator
Wang et al. CAN/LIN hybrid network for automobile
US11080061B2 (en) Pre-loading of instructions
Hui et al. Research on communication controller between FlexRay and Modbus
Ge et al. Application of CANopen in Servo Motor Control
CN115834803A (en) Copilot display screen, display method and vehicle

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