Baud rate adaptive program flashing method and device

By obtaining and sending the baud rate switching list, determining the target baud rate and establishing a communication connection, the program flushing problem caused by inconsistent baud rate in the on-board electronic controller is solved, and the flushing efficiency is improved.

CN119861945APending Publication Date: 2025-04-22BEIJING JINGWEI HIRAIN TECH CO INC
View PDF 0 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

In existing automotive electronic controllers, the baud rate inconsistent results in the program flashing process that cannot be completed, increasing the difficulty of version management and on-site operation.

Method used

By obtaining the baud rate switching list, sending a baud rate switching command to the downcomer until a reply message is received, determining the target baud rate, and establishing a communication connection to realize program flushing.

Benefits of technology

The efficiency of baud rate adaptive program flashing is improved, so that the upper and lower computers can unify the target baud rate, establish communication connections and perform program flashing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119861945A_ABST
    Figure CN119861945A_ABST
Patent Text Reader

Abstract

The invention provides a Baud rate adaptive program flashing method and device, and relates to the technical field of data transmission. When the method is executed, a Baud rate switching list is obtained, then a Baud rate switching command is sent to a lower computer according to the Baud rate in the Baud rate switching list until a reply message sent by the lower computer is received, then the Baud rate corresponding to the reply message is determined as a target Baud rate, communication connection with the lower computer is established according to the target Baud rate, and the reply message is sent to the lower computer according to the target Baud rate. And finally, performing program flashing based on the communication connection with the lower computer. Therefore, the upper computer and the lower computer are unified into the target Baud rate, so that the upper computer and the lower computer can establish communication connection and perform program flashing, and the efficiency of Baud rate adaptive program flashing is further improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of data transmission, and in particular to a baud rate adaptive program flashing method and device. Background Art

[0002] In existing vehicle electronic controllers, the boot loader program and the diagnostic instrument host computer software are usually used together to realize the program upgrade and flashing function. The main function of the boot loader is to establish communication with the host computer, receive the program file sent by the host computer, and operate the FLASH inside the controller to complete the erasure of the old version of the program and the writing of the new version of the program. The communication forms for flashing include CAN, LIN, and Ethernet, among which CAN communication is the most widely used. In order to realize the normal communication between the boot loader and the host computer, it is necessary to ensure that the CAN baud rate of the boot loader and the host computer is consistent. If the baud rate is inconsistent, the program flashing process cannot be completed.

[0003] First, in actual flashing, for projects with platform requirements, the flashing process is usually the same for different models in the project, but due to the different CAN network architecture designs of specific models, the baud rate of flashing CAN is different. Secondly, for engineers debugging on site, different boot loader versions mean that they need to manage multiple flashing host computers, and do detailed management of the boot loader of the debugged model, which increases the difficulty of version management and on-site operators.

[0004] In summary, how to improve the efficiency of baud rate adaptive program flashing is a problem that those skilled in the art need to solve urgently. Summary of the invention

[0005] In view of this, the present application provides a baud rate adaptive program flashing method and device, aiming to improve the efficiency of baud rate adaptive program flashing.

[0006] In a first aspect, the present application provides a baud rate adaptive program flashing method, comprising:

[0007] Get the baud rate switching list;

[0008] According to the baud rates in the baud rate switching list, a baud rate switching command is sent to the lower computer until a reply message sent by the lower computer is received;

[0009] The baud rate corresponding to the reply message is determined as the target baud rate;

[0010] Establishing a communication connection with the lower computer according to the target baud rate;

[0011] Program flashing is performed based on the communication connection with the lower computer.

[0012] Optionally, before obtaining the baud rate switching list, the method further includes:

[0013] A baud rate switching list is constructed, wherein the baud rate switching list includes a plurality of baud rates.

[0014] Optionally, sending a baud rate switching command to a lower computer according to the baud rates in the baud rate switching list until receiving a reply message sent by the lower computer includes:

[0015] Sending baud rate switching commands to the lower computers in sequence according to the baud rate numbering sequence in the baud rate switching list;

[0016] In response to the reply message sent by the lower computer, stop sending the baud rate switching command to the lower computer.

[0017] Optionally, establishing a communication connection with the lower computer according to the target baud rate includes:

[0018] In response to the lower computer switching the baud rate of the lower computer to the target baud rate, a communication connection is established with the lower computer according to the target baud rate.

[0019] In a second aspect, the present application provides a baud rate adaptive program flashing device, comprising:

[0020] Acquisition module, used to obtain the baud rate switching list;

[0021] A sending module, used for sending a baud rate switching command to a lower computer according to the baud rates in the baud rate switching list, until a reply message sent by the lower computer is received;

[0022] A determination module, used to determine the baud rate corresponding to the reply message as a target baud rate;

[0023] A connection module, used to establish a communication connection with the lower computer according to the target baud rate;

[0024] The flashing module is used to flash the program based on the communication connection with the lower computer.

[0025] Optionally, the device further comprises:

[0026] The construction module is used to construct a baud rate switching list, wherein the baud rate switching list includes multiple baud rates.

[0027] Optionally, the sending module includes:

[0028] A sending unit, configured to send baud rate switching commands to the lower computers in sequence according to the baud rate number sequence in the baud rate switching list;

[0029] A stopping unit is used to stop sending a baud rate switching command to the lower computer in response to a reply message sent by the lower computer.

[0030] Optionally, the connection module includes:

[0031] The connection unit is used for switching the baud rate of the lower computer to the target baud rate in response to the lower computer, and establishing a communication connection with the lower computer according to the target baud rate.

[0032] In a third aspect, an embodiment of the present application provides a computer device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the baud rate adaptive program flashing method described in any one of the implementation methods in the first aspect of the embodiment of the present application.

[0033] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which instructions are stored. When the instructions are executed on a terminal device, the terminal device executes the baud rate adaptive program flashing method described in any implementation method of the first aspect of the embodiment of the present application.

[0034] The present application provides a baud rate adaptive program flashing method. When executing the method, first obtain the baud rate switching list, then send a baud rate switching command to the lower computer according to the baud rate in the baud rate switching list, until a reply message sent by the lower computer is received, then the baud rate corresponding to the reply message is determined as the target baud rate, and then a communication connection is established with the lower computer according to the target baud rate, and finally, the program is flashed based on the communication connection with the lower computer. In this way, the upper computer and the lower computer are unified into the target baud rate, so that the upper computer and the lower computer can establish a communication connection and perform program flashing, thereby improving the efficiency of baud rate adaptive program flashing. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] In order to more clearly illustrate the technical solutions in this embodiment or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0036] Figure 1 A flowchart of a baud rate adaptive program flashing method provided in an embodiment of the present application;

[0037] Figure 2 A schematic diagram of the structure of a baud rate adaptive program flashing device provided in an embodiment of the present application;

[0038] Figure 3 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0039] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. The present application provides a baud rate adaptive program flashing method and device for use in the field of data transmission technology. The above is only an example and does not limit the application field of the method and device name provided by the present application.

[0040] In existing vehicle electronic controllers, the boot loader program and the diagnostic instrument host computer software are usually used together to realize the program upgrade and flashing function. The main function of the boot loader is to establish communication with the host computer, receive the program file sent by the host computer, and operate the FLASH inside the controller to complete the erasure of the old version of the program and the writing of the new version of the program. The communication forms for flashing include CAN, LIN, and Ethernet, among which CAN communication is the most widely used. In order to realize the normal communication between the boot loader and the host computer, it is necessary to ensure that the CAN baud rate of the boot loader and the host computer is consistent. If the baud rate is inconsistent, the program flashing process cannot be completed.

[0041] First, in actual flashing, for projects with platform requirements, the flashing process is usually the same for different models in the project, but due to the different CAN network architecture designs of specific models, the baud rate of flashing CAN is different. Secondly, for engineers debugging on site, different boot loader versions mean that they need to manage multiple flashing host computers, and do detailed management of the boot loader of the debugged model, which increases the difficulty of version management and on-site operators.

[0042] After research, the inventor proposed the technical solution of this application, first obtain the baud rate switching list, then send a baud rate switching command to the lower computer according to the baud rate in the baud rate switching list, until receiving the reply message sent by the lower computer, then determine the baud rate corresponding to the reply message as the target baud rate, then establish a communication connection with the lower computer according to the target baud rate, and finally, perform program flashing based on the communication connection with the lower computer. In this way, the upper computer and the lower computer are unified into the target baud rate, so that the upper computer and the lower computer can establish a communication connection and perform program flashing, thereby improving the efficiency of baud rate adaptive program flashing.

[0043] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application. It should be noted that, for ease of description, only the parts related to the relevant invention are shown in the accompanying drawings. In the absence of conflict, the embodiments in the present application and the features in the embodiments can be combined with each other.

[0044] See also Figure 1 , Figure 1 A flowchart of a baud rate adaptive program flashing method provided in an embodiment of the present application includes:

[0045] S101: Obtain a baud rate switching list.

[0046] Before executing step S101, a baud rate switching list is first constructed, which covers all possible baud rates for flashing. Each version of the upper and lower computers needs to have a unique baud rate switching list. In addition, a baud rate switching command needs to be formulated, which carries a parameter, which is the number of the baud rate in the baud rate switching list.

[0047] S102: Send a baud rate switching command to the lower computer according to the baud rate in the baud rate switching list until a reply message sent by the lower computer is received.

[0048] The upper computer sends a baud rate switching command to the lower computer in sequence according to the baud rate numbering sequence in the baud rate switching list, and stops sending a baud rate switching command to the lower computer in response to a reply message sent by the lower computer. In some embodiments, the baud rate switching list includes: baud rate 1, baud rate 2, baud rate 3, baud rate 4, etc. The upper computer sends a baud rate switching command to the lower computer in the baud rate numbering sequence in the baud rate switching list. For example, the upper computer first sends a baud rate switching command to the lower computer according to baud rate 1. If the upper computer does not receive a reply message sent by the lower computer within a preset time, the upper computer continues to send a baud rate switching command to the lower computer according to baud rate 2. If the upper computer receives a reply message sent by the lower computer within a preset time, the upper computer no longer sends a baud rate switching command to the lower computer.

[0049] S103: Determine the baud rate corresponding to the reply message as the target baud rate.

[0050] The baud rate corresponding to the reply message in step S102 is determined as the target baud rate. The lower computer writes the target baud rate into a shared storage space, which is a common RAM address that can be accessed by the APP and the boot loader program in the lower computer. In this way, the boot loader program can read the target baud rate received in the APP through the shared storage space, and it can be ensured that the baud rate will not change when the APP jumps to the boot loader program.

[0051] S104: Establish a communication connection with the lower computer according to the target baud rate.

[0052] Switch the communication baud rate of the host computer and the slave computer to the target baud rate. At this time, the baud rates of the host computer and the slave computer are consistent, and communication connection can be carried out. Specifically, the baud rate switching method of the host computer is related to the type of the host computer. For example, the host computer of CANape calls the library function of APE and fills in the parameters of the target baud rate. The host computer can complete the baud rate switching.

[0053] S105: Flashing the program based on the communication connection with the lower computer.

[0054] After the communication baud rate of the upper computer and the lower computer is switched to the target baud rate, the baud rate of the upper computer and the lower computer is the same, and the program flashing begins. Specifically, pre-programming is performed first. After the pre-programming is completed, the lower computer jumps into the bootloader program. During initialization, the boot loader program first reads the target baud rate from the shared storage space and switches the baud rate, thereby completing the main programming and post-programming to realize program flashing.

[0055] In the embodiment of the present application, the baud rate switching list is first obtained, and then the baud rate switching command is sent to the lower computer according to the baud rate in the baud rate switching list, until a reply message sent by the lower computer is received, and then the baud rate corresponding to the reply message is determined as the target baud rate, and then a communication connection is established with the lower computer according to the target baud rate, and finally, the program is flashed based on the communication connection with the lower computer. In this way, the upper computer and the lower computer are unified into the target baud rate, so that the upper computer and the lower computer can establish a communication connection and perform program flashing, thereby improving the efficiency of baud rate adaptive program flashing.

[0056] The above are some specific implementations of the baud rate adaptive program flashing method provided by the embodiment of the present application. Based on this, the present application also provides a corresponding device. The device provided by the embodiment of the present application will be introduced from the perspective of functional modularization.

[0057] Figure 2A schematic diagram of the structure of a baud rate adaptive program flashing device provided in an embodiment of the present application, the baud rate adaptive program flashing device 200 comprises:

[0058] An acquisition module 210 is used to acquire a baud rate switching list;

[0059] The sending module 220 is used to send a baud rate switching command to the lower computer according to the baud rates in the baud rate switching list until a reply message sent by the lower computer is received;

[0060] A determination module 230, configured to determine the baud rate corresponding to the reply message as a target baud rate;

[0061] A connection module 240 is used to establish a communication connection with the lower computer according to the target baud rate;

[0062] The flashing module 250 is used to flash the program based on the communication connection with the lower computer.

[0063] Optionally, the device 200 further includes:

[0064] The construction module is used to construct a baud rate switching list, wherein the baud rate switching list includes multiple baud rates.

[0065] Optionally, the sending module 220 includes:

[0066] A sending unit, configured to send baud rate switching commands to the lower computers in sequence according to the baud rate number sequence in the baud rate switching list;

[0067] A stopping unit is used to stop sending a baud rate switching command to the lower computer in response to a reply message sent by the lower computer.

[0068] Optionally, the connection module 240 includes:

[0069] The connection unit is used for switching the baud rate of the lower computer to the target baud rate in response to the lower computer, and establishing a communication connection with the lower computer according to the target baud rate.

[0070] The embodiments of the present application also provide corresponding devices and computer storage media for implementing the solutions provided by the embodiments of the present application.

[0071] like Figure 3 As shown, the computer device 01 is in the form of a general computing device. The components of the computer device 01 may include but are not limited to: one or more processors or processing units 03, a system memory 08, and a bus 04 connecting different system components (including the system memory 08 and the processing unit 03).

[0072] Bus 04 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor or a local bus using any of a variety of bus structures. For example, these architectures include but are not limited to Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MAC) bus, Enhanced ISA bus, Video Electronics Standards Association (VESA) local bus and Peripheral Component Interconnect (PCI) bus.

[0073] The computer device 01 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the computer device 01, including volatile and non-volatile media, removable and non-removable media.

[0074] The system memory 08 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 09 and / or cache memory 10. The computer device 01 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 11 may be used to read and write non-removable, non-volatile magnetic media ( Figure 3 not shown, usually called a "hard drive"). Although Figure 3 Not shown in the figure, a disk drive for reading and writing a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing a removable non-volatile optical disk (e.g., a CD-ROM, a DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to the bus 04 via one or more data medium interfaces. The memory 08 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the various embodiments of the present invention.

[0075] A program / utility 12 having a set (at least one) of program modules 13 may be stored, for example, in the memory 08, such program modules 13 including but not limited to an operating system, one or more application programs, other program modules, and program data, each of which or some combination thereof may include an implementation of a network environment. The program modules 13 generally perform the functions and / or methods of the embodiments described herein.

[0076] The computer device 01 can communicate with a display 07, and can also communicate with one or more external devices 02 (e.g., a keyboard, a pointing device, etc.), and can also communicate with one or more devices that enable a user to interact with the computer device 01, and / or communicate with any device that enables the computer device 01 to communicate with one or more other computing devices (e.g., a network card, a modem, etc.). Such communication can be performed through an input / output (I / O) interface 06. In addition, the computer device 01 can also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) through a network adapter 05. Figure 3 As shown, the network adapter 05 communicates with other modules of the computer device 01 via the bus 04. It should be understood that although Figure 3 Not shown, other hardware and / or software modules may be used in conjunction with computer device 01, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0077] The processor unit 03 executes various functional applications and data processing by running the programs stored in the system memory 08, for example, implementing a baud rate adaptive program flashing method provided in an embodiment of the present application.

[0078] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0079] Through the description of the above implementation methods, it can be known that those skilled in the art can clearly understand that all or part of the steps in the above-mentioned embodiment method can be implemented by means of software plus a general hardware platform. Based on such an understanding, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a storage medium, such as a read-only memory (ROM) / RAM, a magnetic disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network communication device such as a router) to execute the methods described in each embodiment of the present application or some parts of the embodiments.

[0080] Each embodiment in this specification is described in a progressive manner, and the same and similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative work.

[0081] The above description is merely an exemplary embodiment of the present application and is not intended to limit the protection scope of the present application.

Claims

1. A baud rate adaptive program flashing method, characterized in that: Applied to the host computer, including: Get the baud rate switching list; According to the baud rates in the baud rate switching list, a baud rate switching command is sent to the lower computer until a reply message sent by the lower computer is received; The baud rate corresponding to the reply message is determined as the target baud rate; Establishing a communication connection with the lower computer according to the target baud rate; Program flashing is performed based on the communication connection with the lower computer.

2. The method according to claim 1, characterized in that Before obtaining the baud rate switching list, the method further includes: A baud rate switching list is constructed, wherein the baud rate switching list includes a plurality of baud rates.

3. The method according to claim 1, characterized in that: The step of sending a baud rate switching command to a lower computer according to the baud rates in the baud rate switching list until receiving a reply message sent by the lower computer comprises: Sending baud rate switching commands to the lower computer in sequence according to the baud rate numbering order in the baud rate switching list; In response to the reply message sent by the lower computer, stop sending the baud rate switching command to the lower computer.

4. The method according to claim 1, characterized in that: Establishing a communication connection with the lower computer according to the target baud rate includes: In response to the lower computer switching the baud rate of the lower computer to the target baud rate, a communication connection is established with the lower computer according to the target baud rate.

5. A baud rate adaptive program flashing device, characterized in that: Applied to the host computer, including: Acquisition module, used to obtain the baud rate switching list; A sending module, used for sending a baud rate switching command to a lower computer according to the baud rates in the baud rate switching list, until a reply message sent by the lower computer is received; A determination module, used to determine the baud rate corresponding to the reply message as a target baud rate; A connection module, used to establish a communication connection with the lower computer according to the target baud rate; The flashing module is used to flash the program based on the communication connection with the lower computer.

6. The device according to claim 5, characterized in that The device also includes: The construction module is used to construct a baud rate switching list, wherein the baud rate switching list includes multiple baud rates.

7. The device according to claim 5, characterized in that The sending module comprises: A sending unit, configured to send baud rate switching commands to the lower computers in sequence according to the baud rate number sequence in the baud rate switching list; A stopping unit is used to stop sending a baud rate switching command to the lower computer in response to a reply message sent by the lower computer.

8. The device according to claim 5, characterized in that The connection module comprises: The connection unit is used for switching the baud rate of the lower computer to the target baud rate in response to the lower computer, and establishing a communication connection with the lower computer according to the target baud rate.

9. A computer device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the baud rate adaptive program flashing method as described in any one of claims 1 to 4 is implemented.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, and when the instructions are executed on a terminal device, the terminal device executes the baud rate adaptive program flashing method as described in any one of claims 1 to 4.