A method and device for upgrading a program using a communication serial port of a display terminal
By using the communication serial port upgrade program in the display terminal of the power protection device, automatic switching between the normal communication mode and the upgrade program mode is realized, which solves the problem of coexistence of program upgrade and communication tasks in the existing technology, and reduces hardware costs and design complexity. , simplifying the debugging process.
Patent Information
- Application Number
- CN202111322549.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-09
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2041-11-09
AI Technical Summary
The display terminal of existing power protection devices cannot coexist between program upgrades and communication tasks, resulting in complex and high-cost hardware design, and the need for frequent program upgrades to adapt to different application scenarios.
The display terminal adopts a communication serial port upgrade program, which has normal communication mode and upgrade program mode. It automatically identifies the working mode through message interaction and realizes flexible switching of program upgrade and communication. It uses one serial port to take into account both program upgrade and external communication, reducing hardware cost and design. complexity.
It realizes flexible mode recognition and automatic working mode switching of the display terminal, reduces hardware cost and resource consumption, simplifies the debugging process, and facilitates on-site debugging.
Smart Images

Figure CN114036080B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of display terminals for power protection devices, and in particular to a method and a device for upgrading a program of a display terminal by using a communication serial port. Background Art
[0002] A display terminal for an electric power protection device, which uses an independent CPU, communicates with the host of the electric power protection device based on the RS232 serial port, and exchanges different information with the electric power protection device according to different menu requirements. Due to the different application scenarios of power secondary equipment, different display terminal programs usually need to be customized according to different host programs, so the display terminal program needs to be frequently upgraded.
[0003] In the prior art, the hardware is generally designed with two serial ports, one serial port is used for program upgrade, and the other serial port is used for external communication, but the program upgrade and communication tasks cannot coexist. Summary of the invention
[0004] Based on the above situation of the prior art, the purpose of the present invention is to provide a method and device for upgrading a program of a display terminal using a communication serial port, so that the display terminal can flexibly identify the working mode and adopt the corresponding communication or upgrading process in a timely manner.
[0005] A first aspect of the present invention provides a method for upgrading a program using a communication serial port of a display terminal, wherein the display terminal has two working modes: a normal communication mode and an upgrade program mode.
[0006] In normal communication mode, the display terminal is connected to the host to perform communication interaction and complete the display function;
[0007] In the program upgrade mode, the display terminal is connected to the upgrade tool, and after interacting with the upgrade tool information, it responds to the upgrade command to upgrade the program;
[0008] The method comprises the following steps:
[0009] The display terminal automatically identifies the working mode from the hardware according to the message interaction: when connected to the upgrade tool, it responds to the upgrade program command and no longer communicates with the host; when connected to the host, it automatically identifies and communicates with the host.
[0010] Furthermore, when the display terminal communicates with the host, it cyclically sends a time inquiry message; or, after the display terminal is restarted, it cyclically sends a CRC inquiry message;
[0011] When the display terminal is connected to the upgrade tool, the upgrade tool receives the time inquiry message or the CRC inquiry message and then replies with a confirmation message to the display terminal;
[0012] After receiving the confirmation message from the upgrade tool, the display terminal replies to the upgrade tool with the corresponding CRC and version number information;
[0013] The upgrade tool replies the program upgrade command to the display terminal;
[0014] The display terminal performs program upgrade in response to the program upgrade command of the upgrade tool.
[0015] Furthermore, after the program upgrade is completed, the display terminal is restarted.
[0016] Furthermore, the display terminal program is divided into a bootloader underlying program and an APP running program. The program is upgraded under the bootloader underlying program, and information is exchanged with the host under the APP running program to complete the display function.
[0017] Furthermore, the program upgrade under the BootLoader underlying program includes:
[0018] Initialization function, executed only once:
[0019] Get the software flag. If the flag is in boot state, set the software mode to app state and execute the run function to upgrade the program. If the flag is in app state, check whether the program is complete. If the program is complete, close the serial port and jump directly to the APP program. If the program is incomplete, set the software mode to app state and execute the run function to upgrade the program.
[0020] A second aspect of the present invention provides a device for upgrading a program using a communication serial port of a display terminal, comprising a display terminal having two working modes: a normal communication mode and an upgrade program mode.
[0021] In normal communication mode, the display terminal is connected to the host, performs communication interaction, and completes the display function;
[0022] In the program upgrade mode, the display terminal is connected to the upgrade tool, and after interacting with the upgrade tool information, it responds to the upgrade command to upgrade the program;
[0023] The display terminal is used to execute the above method to upgrade the program.
[0024] In summary, the present invention provides a method and device for upgrading a program using a communication serial port of a display terminal. In the method, the display terminal includes two working modes, namely, a normal communication mode and an upgrade program mode, and automatically identifies the working mode from the hardware according to message interaction: when connected to an upgrade tool, it responds to upgrade program commands and no longer communicates with the host; when connected to the host, it automatically identifies communication with the host. The present invention can reduce hardware costs and design complexity, save hardware resources and reduce hardware costs, and facilitate on-site debugging by debugging personnel. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 It is a schematic diagram showing the working mode of the terminal in an embodiment of the present invention.
[0026] Figure 2 The present invention is a flowchart of a method for displaying a terminal using a communication serial port to upgrade a program in an embodiment of the present invention.
[0027] Figure 3 The figure is a schematic diagram of the execution flow of the Bootloader program in an embodiment of the present invention. DETAILED DESCRIPTION
[0028] In order to make the purpose, technical scheme and advantages of the present invention clearer, the present invention is further described in detail below in conjunction with specific embodiments and with reference to the accompanying drawings. It should be understood that these descriptions are only exemplary and are not intended to limit the scope of the present invention. In addition, in the following description, the description of well-known structures and technologies is omitted to avoid unnecessary confusion of the concept of the present invention.
[0029] A first aspect of the present invention provides a method for upgrading a program using a communication serial port of a display terminal, wherein the display terminal has two working modes: a normal communication mode and an upgrade program mode. Figure 1 As shown: Mode 1, in normal communication mode, the display terminal is connected to the host, actively sends inquiry commands, communicates with the host information exchange, and completes the display function; Mode 2, in upgrade program mode, the display terminal is connected to the upgrade tool, and responds to the upgrade command to upgrade the program after exchanging information with the upgrade tool. The display terminal can automatically identify the working mode. There is no priority between mode 1 and mode 2. According to the message interaction, it can identify from the hardware whether it is connected to the upgrade tool or the host. When connected to the upgrade tool, it responds to the upgrade program command and no longer communicates with the host. When connected to the host, it automatically identifies and communicates normally with the host.
[0030] The method comprises the following steps: Figure 2 As shown:
[0031] The display terminal automatically identifies the working mode from the hardware according to the message interaction: when connected to the upgrade tool, it responds to the upgrade program command and no longer communicates with the host; when connected to the host, it automatically identifies and communicates with the host.
[0032] In order to save hardware resources and reduce costs, display terminal devices usually use a serial port for both program upgrade and communication with external devices. This requires the display terminal to flexibly identify the working mode, communicate with the host when in communication mode, and respond to the upgrade command to upgrade the program when in upgrade mode. The display terminal of the present invention communicates with the host based on the modbus protocol. On the basis of reasonable expansion of the protocol, the display terminal can automatically identify whether it is connected to the host or the upgrade tool, and can prevent communication abnormalities caused by bit errors.
[0033] Furthermore, the operation of mode 1 is divided into two cases: Case 1: when the display terminal communicates with the host, it cyclically sends a time inquiry message; Case 2: after the display terminal is restarted, it cyclically sends a CRC inquiry message;
[0034] When the display terminal is connected to the upgrade tool, the upgrade tool receives the time inquiry message or the CRC inquiry message and replies with a confirmation message to the display terminal;
[0035] After receiving the confirmation message from the upgrade tool, the display terminal replies to the upgrade tool with the corresponding CRC and version number information;
[0036] The upgrade tool replies the program upgrade command to the display terminal;
[0037] The display terminal performs program upgrade in response to the program upgrade command of the upgrade tool.
[0038] Furthermore, after the program upgrade is completed, the display terminal is restarted.
[0039] Furthermore, the display terminal program is divided into a bootloader underlying program and an APP running program. The program is upgraded in the bootloader underlying program, and information is interacted with the host in the APP running program to complete the display function, or information is interacted with the upgrade tool to complete the response to the upgrade command and then jump to the bootloader underlying program to upgrade the program.
[0040] Furthermore, the program upgrade under the BootLoader underlying program includes two parts: initialization function and running function, such as Figure 3 shown.
[0041] (1) Initialization function, executed only once:
[0042] Get the software flag. If the flag is in boot state, set the software mode to app state and execute the run function to upgrade the program. If the flag is in app state, check whether the program is complete. If the program is complete, close the serial port and jump directly to the APP program. If the program is incomplete, set the software mode to app state and execute the run function to upgrade the program.
[0043] (2) Run the function loop to perform the upgrade process.
[0044] Furthermore, the APP program processing includes:
[0045] Based on the original modbus communication, it performs extended processing, which can not only automatically identify DTU connection or upgrade tool connection, but also prevent normal communication abnormalities caused by bit errors.
[0046] After agreement with the upgrade tool, the upgrade tool replies to the display terminal with a confirmation message and a command message for program upgrade.
[0047] Add processing at the message parsing part. When the confirmation message of the display terminal is parsed, reply the display terminal with information such as crc, version number, etc. When the program upgrade command message is parsed, respond to the upgrade command and jump to the bootloader program.
[0048] When polling tasks, add confirmation to connect to the upgrade tool, and then poll to send HMI related information messages. When not connected to the upgrade tool, poll to send time inquiry. After the upgrade is completed, the HMI should be restarted, otherwise the HMI will send HMI related information messages cyclically, which will be considered as error messages by the DTU host and discarded.
[0049] Furthermore, the display terminal includes two serial ports, one serial port is used for program upgrade, and the other serial port is used for communication with a host.
[0050] Furthermore, the serial port for program upgrade is a built-in serial port.
[0051] A second aspect of the present invention provides a device for upgrading a program using a communication serial port of a display terminal, comprising a display terminal having two working modes: a normal communication mode and an upgrade program mode.
[0052] In normal communication mode, the display terminal is connected to the host to perform communication interaction and complete the display function;
[0053] In the program upgrade mode, the display terminal is connected to the upgrade tool, and after interacting with the upgrade tool information, it responds to the upgrade command to upgrade the program;
[0054] The display terminal is used to execute the above method to upgrade the program.
[0055] In summary, the present invention provides a method and device for upgrading a program using a communication serial port of a display terminal. In the method, the display terminal includes two working modes, namely, a normal communication mode and an upgrade program mode, and automatically identifies the working mode from the hardware according to message interaction: when connected to an upgrade tool, it responds to upgrade program commands and no longer communicates with the host; when connected to the host, it automatically identifies communication with the host. The present invention can reduce hardware costs and design complexity, save hardware resources and reduce hardware costs, and facilitate on-site debugging by debugging personnel.
[0056] It should be understood that the above specific embodiments of the present invention are only used to illustrate or explain the principles of the present invention, and do not constitute a limitation of the present invention. Therefore, any modifications, equivalent substitutions, improvements, etc. made without departing from the spirit and scope of the present invention should be included in the protection scope of the present invention. In addition, the appended claims of the present invention are intended to cover all changes and modifications that fall within the scope and boundaries of the appended claims, or the equivalent forms of such scope and boundaries.
Claims
1. A method for upgrading a program using a communication serial port of a display terminal, characterized in that: The display terminal has two working modes: normal communication mode and upgrade program mode: In normal communication mode, the display terminal is connected to the host, performs communication interaction, and completes the display function; In the program upgrade mode, the display terminal is connected to the upgrade tool, and after interacting with the upgrade tool information, it responds to the upgrade command to upgrade the program; The method comprises the following steps: The display terminal automatically identifies the working mode from the hardware according to the message interaction: when connected to the upgrade tool, it responds to the upgrade program command and no longer communicates with the host. After receiving the time inquiry message or the CRC inquiry message, the upgrade tool replies with a confirmation message to the display terminal; after receiving the confirmation message replied by the upgrade tool, the display terminal replies with the corresponding CRC and version number information to the upgrade tool; the upgrade tool replies with the program upgrade command to the display terminal; the display terminal performs program upgrade in response to the program upgrade command of the upgrade tool; when connected to the host, it automatically identifies the communication with the host and cyclically sends the time inquiry message; when the display terminal is restarted, it cyclically sends the CRC inquiry message.
2. The method for upgrading a program using a communication serial port of a display terminal according to claim 1, characterized in that: After the program upgrade is complete, restart the display terminal.
3. The method for upgrading a program using a communication serial port of a display terminal according to claim 1 or 2, characterized in that: The display terminal program is divided into the bootloader underlying program and the APP running program. The program is upgraded under the bootloader underlying program, and the information is exchanged with the host under the APP running program to complete the display function.
4. The method for upgrading a program using a communication serial port of a display terminal according to claim 3, characterized in that: Program upgrades under the BootLoader underlying program include: Initialization function, executed only once: Get the software flag. If the flag is in boot state, set the software mode to app state and execute the run function to upgrade the program. If the flag is in app state, check whether the program is complete. If the program is complete, close the serial port and jump directly to the APP program. If the program is incomplete, set the software mode to app state and execute the run function to upgrade the program.
5. A device for upgrading a program using a communication serial port of a display terminal, characterized in that: Including display terminal, which has two working modes: normal communication mode and upgrade program mode: In normal communication mode, the display terminal is connected to the host, performs communication interaction, and completes the display function; In the program upgrade mode, the display terminal is connected to the upgrade tool, and after interacting with the upgrade tool information, it responds to the upgrade command to upgrade the program; The display terminal is used to execute the method according to any one of claims 1 to 4 to perform program upgrade.
Citation Information
Patent Citations
A method for upgrading dual-mode mobile phone via multiplexing serial port
CN101237649A
IP (Internet Protocol) telecommunication network-oriented multi-protocol message transmitting method
CN102238163A
MOST network-based software upgrading method
CN103634398A
Database type obtaining method, device and electronic device
CN107104949A
IAP technology-based remote upgrading system of Beidou user machine and upgrading method thereof
CN107301067A
