Method, system and equipment for automatically configuring time sequence parameters of CAN (Controller Area Network) controller and medium

Through the automated CAN controller timing parameter configuration method, the complex problems of existing configuration methods are solved, the configuration efficiency and accuracy are improved, and the stability and reliability of the CAN network are improved.

CN119861617APending Publication Date: 2025-04-22HUNAN GREAT WALL GALAXY TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411941007.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-26
Publication Date
2025-04-22

AI Technical Summary

Technical Problem

The timing parameter configuration method of existing CAN controllers is complex, requiring users to be proficient in timing parameter configuration, resulting in low configuration efficiency and increased cost.

Method used

It provides a CAN controller timing parameters automatic configuration method, by obtaining the configuration information input by the user, including enable bit information, baud rate configuration information, characteristic value configuration information and configuration mode information, and automatically calculate and configure timing parameters that meet the requirements of the CAN protocol.

Benefits of technology

It significantly improves the configuration efficiency, accuracy and real-time of CAN controllers in the network, reduces the difficulty of user operation and the risk of manual configuration errors, and improves the stability and reliability of the CAN network.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119861617A_ABST
    Figure CN119861617A_ABST
Patent Text Reader

Abstract

The invention relates to a CAN controller time sequence parameter automatic configuration method, system and device and a medium. The method comprises the following steps: acquiring configuration information written by a user; the configuration information comprises enabling bit information, baud rate configuration information, characteristic value configuration information and configuration mode information. And configuring the transmission rate of the CAN controller in the baud rate register according to the enable bit information and the baud rate configuration information, and reading the mode register corresponding to the configuration mode information through the configuration mode information identified by the mode selection register. And calculating a time sequence parameter configuration result conforming to the CAN controller through a mode register, and automatically configuring the time sequence parameter configuration result into the CAN controller. By adopting the method, the time sequence parameter configuration efficiency of the CAN controller can be improved, and the labor cost can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of CAN timing parameter configuration, and in particular to a method, system, device and medium for automatically configuring timing parameters of a CAN controller. Background Art

[0002] CAN bus protocol is an ISO international standardized serial communication protocol. In North America and Western Europe, CAN bus protocol has become the standard bus for automotive computer control systems and embedded industrial control local area networks. CAN controller, full name Controller Area Network, is a key component of the CAN bus local area control network, responsible for managing and controlling data transmission. It can implement CAN bus protocol parsing and generation, error detection and correction, etc. Fig. 9 The CAN bus schematic diagram is shown in the figure. CAN components support normal transmission mode and fast transmission mode (FD mode). The maximum transmission rates of the two modes are different. The former is up to 1Mbit / s, and the latter is up to 8Mbit / s. When using CAN components, users need to calculate and configure the corresponding timing parameters based on the system clock frequency and the custom transmission baud rate. Some timing parameters are not necessarily unique values. They need to satisfy specific relationships and have multiple combinations. This usage method has extremely high requirements for users and requires users to be proficient in CAN component timing parameter configuration. It is very unfriendly to novices, resulting in low configuration efficiency and increased costs. Summary of the invention

[0003] Based on this, it is necessary to provide a CAN controller timing parameter automatic configuration method, system, device and medium that can improve the configuration efficiency and accuracy of CAN control in the network in order to solve the above technical problems.

[0004] A method for automatically configuring timing parameters of a CAN controller, the method comprising:

[0005] Get the configuration information written by the user. The configuration information includes: enable bit information, baud rate configuration information, characteristic value configuration information and configuration mode information.

[0006] The transmission rate of the CAN controller is configured in the baud rate register according to the enable bit information and the baud rate configuration information, and the configuration mode information is identified by the mode selection register, and the mode register corresponding to the configuration mode information is read.

[0007] The timing parameter configuration result that meets the CAN controller is calculated through the mode register, and the timing parameter configuration result is automatically configured into the CAN controller.

[0008] A CAN controller timing parameter automatic configuration system, the system comprising:

[0009] The information acquisition module is used to acquire the configuration information written by the user. The configuration information includes: enable bit information, baud rate configuration information, characteristic value configuration information and configuration mode information.

[0010] The configuration mode matching module is used to configure the transmission rate of the CAN controller in the baud rate register according to the enable bit information and the baud rate configuration information, and read the mode register corresponding to the configuration mode information through the configuration mode information identified by the mode selection register.

[0011] The timing parameter configuration module is used to calculate the timing parameter configuration result that conforms to the CAN controller through the mode register, and automatically configure the timing parameter configuration result into the CAN controller.

[0012] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0013] Get the configuration information written by the user. The configuration information includes: enable bit information, baud rate configuration information, characteristic value configuration information and configuration mode information.

[0014] The transmission rate of the CAN controller is configured in the baud rate register according to the enable bit information and the baud rate configuration information, and the configuration mode information is identified by the mode selection register, and the mode register corresponding to the configuration mode information is read.

[0015] The timing parameter configuration result that meets the CAN controller is calculated through the mode register, and the timing parameter configuration result is automatically configured into the CAN controller.

[0016] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the following steps:

[0017] Get the configuration information written by the user. The configuration information includes: enable bit information, baud rate configuration information, characteristic value configuration information and configuration mode information.

[0018] The transmission rate of the CAN controller is configured in the baud rate register according to the enable bit information and the baud rate configuration information, and the configuration mode information is identified by the mode selection register, and the mode register corresponding to the configuration mode information is read.

[0019] The timing parameter configuration result that meets the CAN controller is calculated through the mode register, and the timing parameter configuration result is automatically configured into the CAN controller.

[0020] The above-mentioned CAN controller timing parameter automatic configuration method, system, device and medium first obtain the configuration information written by the user, including enable bit information, baud rate configuration information, characteristic value configuration information and configuration mode information. This design reduces the complexity of user input, and only key configuration information needs to be entered, without the need to master complex timing calculation principles. Secondly, the system automatically sets the transmission rate of the CAN controller in the baud rate register according to the enable bit information and baud rate configuration information, and identifies the current configuration mode through the mode selection register, thereby further reading the corresponding mode register. In this process, through the built-in calculation logic, the system automatically completes the timing parameter calculation that meets the requirements of the CAN protocol, and directly configures the calculation results into the CAN controller. This automated configuration method not only eliminates the tedious process of users manually calculating timing parameters, but also significantly improves the accuracy and real-time performance of the configuration. In addition, the automation characteristics of the method greatly reduce the risk of human configuration errors and improve the stability and reliability of the CAN network in complex application scenarios. In summary, this technical solution reduces the user's operation difficulty and manual configuration cost through an automated parameter configuration process, significantly improves the configuration efficiency, accuracy and real-time performance of the CAN controller in the network, and meets the application requirements of modern high-performance network communications. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Figure 1 An application scenario diagram of a method for automatically configuring timing parameters of a CAN controller in an embodiment;

[0022] Figure 2 A schematic diagram of a flow chart of a method for automatically configuring timing parameters of a CAN controller in one embodiment;

[0023] Figure 3 An enable register in one embodiment;

[0024] Figure 4 A mode and feature value selection register for one embodiment;

[0025] Figure 5 A frequency division coefficient and time unit number register in one embodiment;

[0026] Figure 6 A sampling point information register in one embodiment;

[0027] Figure 7 A synchronization information register in one embodiment;

[0028] Figure 8 A schematic diagram of a CAN bus in an embodiment;

[0029] Fig. 9 A schematic diagram of a bit timing sequence in one embodiment;

[0030] Fig.10 A flowchart of an automatic configuration step in one embodiment;

[0031] Fig.11 A structural block diagram of a CAN controller timing parameter automatic configuration system in one embodiment;

[0032] Fig.12 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0033] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0034] The CAN controller timing parameter automatic configuration method provided by the present invention can be applied to Figure 1 The configuration framework shown in the figure. The framework includes the configuration network, the automatic configuration module and the CAN controller. The main interfaces that interact with the automatic configuration module are as follows. The interface names of different CAN components may be different. The main interactive interfaces include: can_clk (can controller clock), host_addr (address information), host_cs_b (chip select signal, low effective), host_wr_b (write byte enable), host_rd_b (read byte enable), host_di (input data), host_do (output data). During the write operation, the chip select signal is pulled low, the corresponding bit of the write byte enable is pulled low, and the address signal and input data change accordingly. During the read operation, the chip select signal is pulled low, the corresponding bit of the read byte enable is pulled low, and the address signal and output data change accordingly.

[0035] In one embodiment, Figure 2 As shown, a method for automatically configuring the timing parameters of a CAN controller is provided. Figure 1 The configuration framework in is used as an example to illustrate, including the following steps:

[0036] Step 202: Obtain configuration information written by the user.

[0037] The configuration information includes: enable bit information, baud rate configuration information, characteristic value configuration information and configuration mode information.

[0038] Specifically, the configuration information written by the user is obtained through the relevant registers in the automatic configuration module. The automatic configuration module contains the following functional registers:

[0039] 1. Enable register, such as Figure 3As shown, this register has 8 bits, bit 0 is the enable signal, bits 1-7 are reserved, the default value is 0, and the user pulls it high to indicate the use of the automatic configuration function.

[0040] 2. Mode and characteristic value selection register, such as Figure 4 As shown, this register has 32 bits, bit 0 is the mode selection signal, 0 is AUTO mode, 1 is custom mode. When configured in AUTO mode, only bits 1-12 need to be paid attention to, bits 1-4 are user-defined baud rates, bits 5-12 are temporary storage bits for CAN core system clock information. When configured in custom mode, bits 13-31 also need to be paid attention to, bits 13-15 are feature value selection functions, 000 is the frequency division coefficient, 001 is the number of time units, 010 is segment1 parameter, 011 is segment2 parameter, 100 is sjw parameter, and bits 16-31 are specific feature values.

[0041] In AUTO mode, only one set of results will be automatically calculated and then configured into CAN. The starting point of the design in custom mode is that the user can set a set of characteristic values ​​(targets), compare the targets with the calculation results, and configure according to the user's characteristics and needs. These two modes can be configured by the user Figure 4 The 0th bit of the register can be switched freely. Figure 4 The 13th to 15th bits of the register determine the type of characteristic value (target) that the user wants to set, and the specific size of the characteristic value is determined by configuring the 16th to 31st bits.

[0042] 3. Frequency division coefficient and time unit number register, such as Figure 5 As shown, the register has a total of 32 bits, 0-15 bits temporarily store the time unit quantity information, and 16-31 bits temporarily store the frequency division coefficient information.

[0043] 4. Sampling point information register, such as Figure 6 As shown, this register has a total of 32 bits, bits 0-15 temporarily store segment 1 information, and bits 16-31 temporarily store segment 2 information.

[0044] 5. Synchronous information register, such as Figure 7 As shown, this register has a total of 32 bits and is used to temporarily store synchronization parameter configuration information.

[0045] Step 204, configure the transmission rate of the CAN controller in the baud rate register according to the enable bit information and the baud rate configuration information, and read the mode register corresponding to the configuration mode information through the configuration mode information identified by the mode selection register.

[0046] Step 206: Calculate the timing parameter configuration result that meets the CAN controller through the mode register, and automatically configure the timing parameter configuration result into the CAN controller.

[0047] In the above-mentioned CAN controller timing parameter automatic configuration method, the configuration information written by the user is first obtained, including enable bit information, baud rate configuration information, characteristic value configuration information and configuration mode information. This design reduces the input complexity of the user, and only key configuration information needs to be entered, without the need to master the complex timing calculation principle. Secondly, the system automatically sets the transmission rate of the CAN controller in the baud rate register according to the enable bit information and the baud rate configuration information, and identifies the current configuration mode through the mode selection register, thereby further reading the corresponding mode register. In this process, through the built-in calculation logic, the system automatically completes the timing parameter calculation that meets the requirements of the CAN protocol, and directly configures the calculation results into the CAN controller. This automated configuration method not only eliminates the tedious process of the user manually calculating the timing parameters, but also significantly improves the accuracy and real-time performance of the configuration. In addition, the automation characteristics of the method greatly reduce the risk of human configuration errors and improve the stability and reliability of the CAN network in complex application scenarios. In summary, the technical solution reduces the user's operation difficulty and manual configuration cost through the automated parameter configuration process, significantly improves the configuration efficiency, accuracy and real-time performance of the CAN controller in the network, and meets the application requirements of modern high-performance network communications.

[0048] In one embodiment, after the chip system is reset, the user starts the automatic configuration function and enters the configuration information into the configuration network.

[0049] In one embodiment, the configuration information written by the user in the configuration network is obtained through an automatic configuration module. The automatic configuration module includes: an enable register, a baud rate register, a characteristic value selection register, a mode selection register, a mode register, a frequency division coefficient register, a time unit register, a sampling point information register and a synchronization information register.

[0050] In one embodiment, according to the value of the 0th bit enable signal in the enable information, the automatic configuration function is used, and the baud rate register is retrieved to parse the baud rate configuration information to obtain the 0th bit mode selection signal of the baud rate register. If the value of the 0th bit mode selection signal is 0, the AUTO mode is started, and the transmission rate of the CAN controller is configured through the AUTO mode. If the value of the 0th bit mode selection signal is 1, the custom mode is started, and the transmission rate of the CAN controller is configured through the custom mode.

[0051] In one embodiment, the configuration mode information is identified by the mode selection register. If the value of the 0th bit character of the configuration mode information is 0, the AUTO mode is started, the system clock frequency is automatically retrieved, the system clock frequency and the CAN controller baud rate are calculated, and the frequency division coefficient and the time unit are obtained:

[0052]

[0053] BT ideal =1 / BR

[0054] Among them, f clock is the system clock frequency, n prescaler is the frequency division coefficient, n TQ is the number of time units, BT ideal is, BR is the baud rate of the CAN controller, t seg1 is the current sampling point of each bit of data, t seg2 The next sampling point for each bit of data. Set constraints based on the current sampling point and the next sampling point:

[0055] t seg1 ≥t seg2 +2TQ

[0056] t seg2 ≥t SJW

[0057] Where TQ is the clock unit, t SJW The configuration parameters of the bit timing register are configured according to the constraints. The configuration parameters are stored in the corresponding frequency division coefficient and time unit number register, sampling point information register and synchronization information register. If the value of the 0th bit of the configuration mode information is 1, the custom mode is started and the Figure 4 Bits 13 to 15 and bits 16 to 31 of the register determine the characteristic value information, and configuration parameters matching the characteristic value information are retrieved from a system database based on the characteristic value information.

[0058] It is worth noting that the CAN controller needs to configure the transmission timing according to the external configuration clock and the user-defined baud rate after calculation. The timing that needs to be configured includes the frequency division coefficient, time unit, sampling point and synchronization time. The calculated values ​​of the timing parameters are stored in Figure 5 , Figure 6 , Figure 7 After the introduction of the automatic configuration function, users only need to enter the custom baud rate when using it. The function will automatically calculate the time parameters that need to be configured and automatically configure after the calculation is completed.

[0059] In one of the embodiments, the calculation result is searched according to the characteristic value information. If there are parameters that meet the characteristic information, the parameters are configured to the CAN controller. If there are no parameters that meet the characteristic information, the system reports an error and ends the automatic matching function.

[0060] It is worth noting that after determining the specific value, configure the bit timing registers Seg_1_reg and Seg_2_reg. The meaning of each parameter is shown in the figure below. Fig. 9 The bit timing diagram is shown. In order to facilitate the use of users, more configuration combination options are given to users during use. AUTO mode and user-defined mode are added in the automatic calculation and configuration process. In AUTO mode, only one set of parameters that meet the requirements will be calculated and automatically configured. In custom mode, all combinations will be calculated and searched and compared with the characteristic values ​​set by the user, so as to filter out the configuration combination specified by the user.

[0061] In one of the embodiments, after the timing parameter configuration result is configured into the CAN controller, the relevant registers are read to detect whether the configuration is successful. If it fails, the automatic configuration function is returned; otherwise, the read value is consistent with the configuration parameter value, and the automatic configuration is completed.

[0062] In one embodiment, if Fig.10 As shown, an automatic configuration step is provided, which specifically includes the following contents:

[0063] Before using the CAN controller, you must first configure the CAN controller. After the entire chip system is reset and the CAN component is in an idle state, the user can decide whether to enable the automatic configuration function based on personal usage. If the user does not enable it, you need to manually calculate and configure the parameters. According to the system clock and the user-defined CAN controller transmission baud rate, the frequency division coefficient, time unit, sampling point, and synchronization time are calculated. The calculation results need to meet specific relationships. The calculation formula is as follows:

[0064]

[0065] When the user uses the automatic configuration function, he first needs to write a specific value to the specific register of the automatic configuration module in the user program. For example, the 0th bit of the enable register is set to 1, indicating that this function is used. The custom baud rate is configured in the register bit representing the baud rate, and the corresponding mode is configured in the register representing the mode selection. If a custom mode is configured, the corresponding characteristic value must also be configured in the register bit representing the characteristic value. When the automatic configuration function starts running, first read the register representing the baud rate to configure the custom baud rate. Then read the mode register to determine which mode to enter. After the reading is completed, the system clock frequency is automatically retrieved for calculation. Determine which mode to enter based on the value inside the mode selection register. If the user selects AUTO mode, the division coefficient and time unit are calculated based on the system clock frequency and the baud rate of the CAN controller. Then calculate the sampling coefficients segment1 and segment2, where t seg1 ≥t seg2 +2TQ, then calculate the synchronization time t seg2 ≥t SJW , this mode will only calculate a set of random parameter combinations that meet the requirements. After the results are calculated, this set of available parameters will be configured into the CAN controller. If the custom mode is selected, all combinations will be calculated, and then the search and comparison will be performed according to the custom characteristic values ​​set by the user. If there are matching parameters, they will be configured into the CAN controller. If there are no matching parameters, an error will be reported and the function will end. After the result is configured into the CAN controller, read the relevant registers to detect whether the configuration is successful. If not, it will return to the configuration step. If the read value is the same as the configured value, it means that the configuration is successful and the function is completed.

[0066] It should be understood that although Figure 1 , 10 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1 , 10 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.

[0067] In one embodiment, Fig.11As shown, a CAN controller timing parameter automatic configuration system is provided, including: an information acquisition module 1102, a configuration mode matching module 1104 and a timing parameter configuration module 1106, wherein:

[0068] The information acquisition module 1102 is used to acquire the configuration information written by the user. The configuration information includes: enable bit information, baud rate configuration information, characteristic value configuration information and configuration mode information.

[0069] The configuration mode matching module 1104 is used to configure the transmission rate of the CAN controller in the baud rate register according to the enable bit information and the baud rate configuration information, and read the mode register corresponding to the configuration mode information through the configuration mode information identified by the mode selection register.

[0070] The timing parameter configuration module 1106 is used to calculate the timing parameter configuration result that complies with the CAN controller through the mode register, and automatically configure the timing parameter configuration result into the CAN controller.

[0071] The specific definition of the CAN controller timing parameter automatic configuration system can be found in the above definition of the CAN controller timing parameter automatic configuration method, which will not be repeated here. Each module in the above CAN controller timing parameter automatic configuration system can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.

[0072] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Fig.12 As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input system connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for automatically configuring the timing parameters of a CAN controller is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input system of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.

[0073] Those skilled in the art will understand that Figure 11-12 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present invention, and does not constitute a limitation on the computer device to which the solution of the present invention is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0074] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:

[0075] Get the configuration information written by the user. The configuration information includes: enable bit information, baud rate configuration information, characteristic value configuration information and configuration mode information.

[0076] The transmission rate of the CAN controller is configured in the baud rate register according to the enable bit information and the baud rate configuration information, and the configuration mode information is identified by the mode selection register, and the mode register corresponding to the configuration mode information is read.

[0077] The timing parameter configuration result that meets the CAN controller is calculated through the mode register, and the timing parameter configuration result is automatically configured into the CAN controller.

[0078] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0079] Get the configuration information written by the user. The configuration information includes: enable bit information, baud rate configuration information, characteristic value configuration information and configuration mode information.

[0080] The transmission rate of the CAN controller is configured in the baud rate register according to the enable bit information and the baud rate configuration information, and the configuration mode information is identified by the mode selection register, and the mode register corresponding to the configuration mode information is read.

[0081] The timing parameter configuration result that meets the CAN controller is calculated through the mode register, and the timing parameter configuration result is automatically configured into the CAN controller.

[0082] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided by the present invention can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0083] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0084] The above-mentioned embodiments only express several implementation methods of the present invention, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the attached claims.

Claims

1. A method for automatically configuring timing parameters of a CAN controller, characterized in that: The method comprises: Obtain configuration information written by the user; the configuration information includes: enable bit information, baud rate configuration information, characteristic value configuration information and configuration mode information; Configuring the transmission rate of the CAN controller in the baud rate register according to the enable bit information and the baud rate configuration information, and reading the mode register corresponding to the configuration mode information through the configuration mode information identified by the mode selection register; The timing parameter configuration result that meets the CAN controller is calculated through the mode register, and the timing parameter configuration result is automatically configured into the CAN controller.

2. The method according to claim 1, characterized in that: Before obtaining the configuration information written by the user, include: After the chip system is reset, the user starts the automatic configuration function and enters the configuration information into the configuration network.

3. The method according to claim 2, characterized in that Get the configuration information written by the user, including: Acquire the configuration information written by the user in the configuration network through the automatic configuration module; The automatic configuration module includes: an enable register, a baud rate register, a characteristic value selection register, a mode selection register, a mode register, a frequency division coefficient register, a time unit register, a sampling point information register and a synchronization information register.

4. The method according to claim 3, characterized in that Configuring the transmission rate of the CAN controller in the baud rate register according to the enable bit information and the baud rate configuration information, including: According to the value of the 0th bit enable signal in the enable pull information, the automatic configuration function is used, and the baud rate register is called to parse the baud rate configuration information to obtain the 0th bit mode selection signal of the baud rate register. If the value of the 0th bit mode selection signal is 0, the AUTO mode is started, and the transmission rate of the CAN controller is configured through the AUTO mode; if the value of the 0th bit mode selection signal is 1, the custom mode is started, and the transmission rate of the CAN controller is configured through the custom mode.

5. The method according to claim 4, characterized in that: The configuration mode information identified by the mode selection register, and reading the mode register corresponding to the configuration mode information, include: The configuration mode information identified by the mode selection register, if the 0th bit character value of the configuration mode information is 0, the AUTO mode is started, the system clock frequency is automatically retrieved, the system clock frequency and the CAN controller baud rate are calculated, and the frequency division coefficient and time unit are obtained: BT ideal =1 / BR Among them, f clock is the system clock frequency, n prescaler is the frequency division coefficient, n TQ is the number of time units, BT ideal is, BR is the baud rate of the CAN controller, t seg1 is the current sampling point of each bit of data, t seg2 The next sampling point for each bit of data; Set constraints based on the current sampling point and the next sampling point: t seg1 ≥t seg2 +2TQ t seg2 ≥t SJW Where TQ is the clock unit, t SJW for synchronization time; configuring the configuration parameters of the bit timing register according to the constraint conditions; storing the configuration parameters in the corresponding frequency division coefficient and time unit number register, sampling point information register and synchronization information register respectively; If the character value of the 0th bit of the configuration mode information is 1, the custom mode is started, and the 13th to 15th bits and the 16th to 31st bits of the mode and characteristic value selection register are read to determine the characteristic value information, and the configuration parameters matching the characteristic value information are retrieved from the system database based on the characteristic value information.

6. The method according to claim 4, characterized in that Retrieving configuration parameters matching the characteristic value information in a system database according to the characteristic value information includes: The calculation result is searched according to the characteristic value information. If there are parameters that meet the characteristic information, the parameters are configured to the CAN controller. If there are no parameters that meet the characteristic information, the system reports an error and ends the automatic matching function.

7. The method according to any one of claims 1 to 6, characterized in that: After calculating the timing parameter configuration result that meets the CAN controller through the mode register and automatically configuring the timing parameter configuration result into the CAN controller, the method includes: After the timing parameter configuration result is configured into the CAN controller, the relevant registers are read to detect whether the configuration is successful. If it fails, the automatic configuration function is returned; otherwise, the read value is consistent with the configuration parameter value, and the automatic configuration is completed.

8. A CAN controller timing parameter automatic configuration system, characterized in that: The system comprises: An information acquisition module is used to acquire configuration information written by a user; the configuration information includes: enable bit information, baud rate configuration information, characteristic value configuration information and configuration mode information; A configuration mode matching module, configured to configure the transmission rate of the CAN controller in a baud rate register according to the enable bit information and the baud rate configuration information, and to read a mode register corresponding to the configuration mode information through the configuration mode information identified by a mode selection register; The timing parameter configuration module is used to calculate the timing parameter configuration result that conforms to the CAN controller through the mode register, and automatically configure the timing parameter configuration result into the CAN controller.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.