Embedded device offline upgrading method and system and electronic device
By receiving input signals of preset frequency in the embedded device and generating upgrade instructions, combined with the communication handshake command of the upgrade device and the upgrade data packet, the fast offline upgrade of the embedded device is achieved, solving the problems of long startup time and inconvenient maintenance during upgrade.
Patent Information
- Application Number
- CN202411869021.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-18
- Publication Date
- 2025-03-28
AI Technical Summary
Issues of long startup time and inconvenient maintenance when upgrading embedded devices.
By receiving the input signal of the upgrade device, when the frequency of the input signal is a preset frequency, it enters the upgrade state and generates an upgrade command to send the upgrade command to the upgrade device; in response to the communication handshake success command generated after the upgrade device receives the upgrade command, it obtains the upgrade data packet in the upgrade device, and performs offline upgrade of the embedded device based on the upgrade packet.
It reduces the normal power-on time of embedded devices, realizes the rapid offline upgrade of embedded devices, avoids the problem of inconvenience in maintenance, and is convenient and fast.
Smart Images

Figure CN119718378A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of embedded control devices, and in particular to an embedded device offline upgrade method, system and electronic equipment. Background Art
[0002] In embedded control devices, there are generally two forms of device program upgrades. The first upgrade method generally uses communication interfaces such as network interfaces, serial ports, and CAN interfaces to upgrade the device. The second upgrade method generally uses the MCU online programming interface in the embedded device to upgrade the program.
[0003] The first upgrade method requires dividing the program storage area into a startup program storage area and an application program storage area. The program entry is set in the startup program. During the startup process of the device, the startup program is first entered to check whether there is an upgrade instruction on the communication port. If there is an upgrade instruction, the upgrade state is entered to wait for receiving the upgrade data packet. If there is no upgrade instruction, after waiting for a certain period of time, the embedded device automatically enters the application program and starts to execute the normal functions of the embedded device. Therefore, this upgrade method will extend the startup time of the embedded device and is not suitable for occasions where a shorter startup time is required; the second upgrade method generally requires on-site unpacking and processing, which takes a lot of time when upgrading a large number of devices, and on-site maintenance is very inconvenient. Summary of the invention
[0004] In view of this, it is necessary to provide an offline upgrade method, system and electronic device for embedded devices to solve the technical problems of long startup time and inconvenient maintenance when upgrading embedded devices.
[0005] In order to solve the above problems, the present invention provides an offline upgrade method for an embedded device, which is applied to the embedded device and comprises: receiving an input signal from an upgrade device, and when the frequency of the input information is a preset frequency, entering an upgrade state, generating an upgrade instruction, and sending the upgrade instruction to the upgrade device; In response to a communication handshake success instruction generated by the upgrade device after receiving the upgrade instruction, an upgrade data packet in the upgrade device is obtained, and the embedded device is upgraded offline based on the upgrade data packet.
[0006] In a possible implementation, the preset frequency is 1 kHz to 2 kHz.
[0007] In a possible implementation manner, sending the upgrade instruction to the upgrade device includes: The upgrade instruction is sent to the upgrade device through the serial communication interface.
[0008] In a possible implementation, the step of obtaining the upgrade data packet in the upgrade device in response to the communication handshake success instruction generated after the upgrade device receives the upgrade instruction includes: Setting a timeout period to determine whether the generation time of the communication handshake success instruction exceeds the timeout period; When the generation time is greater than the timeout time, entering the main program; When the generation time is less than or equal to the timeout time, an upgrade data packet in the upgrade device is acquired.
[0009] In a possible implementation, the timeout period is 2S.
[0010] In a possible implementation, the offline upgrading of the embedded device based on the upgrade data packet includes: Storing the upgrade data package in the first storage area; Verifying the upgrade data packet, and when the upgrade data packet passes the verification, updating the complete upgrade data packet to the second storage area, and performing offline upgrade processing on the embedded device based on the upgrade data packet in the second storage area; When the upgrade data packet verification fails, the upgrade data packet in the first storage area is discarded, and the upgrade state is entered until the embedded device completes the offline upgrade.
[0011] In a possible implementation, the main control chip of the embedded device is TMS320F28335, and the upgrade device includes an upgrade interface, a first module and a second module. The first module inputs the input signal to the embedded device through the upgrade interface, and the second module transmits the upgrade data packet to the embedded device through the upgrade interface.
[0012] On the other hand, the present invention also provides an offline upgrade method for an embedded device, which is applied to an upgrade device, comprising: Send input signals to embedded devices; In response to the upgrade instruction of the embedded device, a communication handshake is performed with the embedded device. After the handshake is successful, an upgrade data packet is sent to the embedded device, so that the embedded device is upgraded offline.
[0013] On the other hand, the present invention also provides an embedded device offline upgrade system, including an upgrade device and an embedded device; The upgrading device is used to send an input signal to the embedded device; The embedded device is used to receive the input signal, and when the frequency of the input signal is a preset frequency, enter an upgrade state, generate an upgrade instruction, and return the upgrade instruction to the upgrade device; The upgrade device is also used to respond to the upgrade instruction of the embedded device to perform a communication handshake with the embedded device, and after a successful handshake, send an upgrade data packet to the embedded device to enable the embedded device to perform an offline upgrade.
[0014] In another aspect, the present invention further provides an electronic device, comprising: a processor and a memory; The memory stores a computer-readable program executable by the processor; When the processor executes the computer-readable program, the steps in the above-mentioned offline upgrade method for embedded devices are implemented.
[0015] The beneficial effects of the present invention are as follows: receiving an input signal from an upgrade device, and when the frequency of the input signal is a preset frequency, entering an upgrade state and generating an upgrade instruction; when the frequency of the input signal is not the preset frequency, the embedded device directly enters the main program without the need for additional waiting time, thereby reducing the power-on time for normal startup of the embedded device; the embedded device is connected to the upgrade device via an upgrade interface, and the input signal and the upgrade data packet are sent to the embedded device via the upgrade interface in the upgrade device, so that the embedded device completes an offline upgrade; in situations where there are many embedded devices, the upgrade of the embedded device is automatically completed by inserting the upgrade interface, without the need to unpack the embedded device, thereby solving the problem of inconvenient maintenance and having the characteristics of convenience and speed. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 A flow chart of an embodiment of an embedded device of the offline upgrade method of the embedded device provided by the present invention; Figure 2 A schematic diagram of the structure of an upgrade device for an offline upgrade method of an embedded device provided by the present invention; Figure 3 A schematic diagram of the connection between an embedded device and an upgrade device in the offline upgrade method for an embedded device provided by the present invention; Figure 4 A flow chart of an embodiment of an upgrade device of an offline upgrade method for an embedded device provided by the present invention; Figure 5 A schematic diagram of the structure of an embodiment of an offline upgrade system for an embedded device provided by the present invention; Figure 6 A schematic structural diagram of an embodiment of an electronic device provided by the present invention. DETAILED DESCRIPTION
[0017] The preferred embodiments of the present invention are described in detail below in conjunction with the accompanying drawings, wherein the accompanying drawings constitute a part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not used to limit the scope of the present invention.
[0018] The present invention discloses an offline upgrade method, system and electronic device for embedded devices, which can be used in computers. The method, device or computer-readable storage medium involved in the present invention can be integrated with the above-mentioned device or can be relatively independent.
[0019] A specific embodiment of the present invention discloses an offline upgrade method for an embedded device, which can be executed by a computer, specifically by one or more processors of the computer. Figure 1 As shown, the offline upgrade method of the embedded device is applied to the embedded device, including: S101, receiving an input signal from an upgrade device, and when the frequency of the input signal is a preset frequency, entering an upgrade state, generating an upgrade instruction, and sending the upgrade instruction to the upgrade device; S102, in response to a communication handshake success instruction generated by the upgrade device after receiving the upgrade instruction, obtain an upgrade data packet in the upgrade device, and perform offline upgrade on the embedded device based on the upgrade data packet.
[0020] The upgrade device provides an upgrade signal and an upgrade data packet to the embedded device through an upgrade interface, and the embedded device is a control device.
[0021] Compared with the prior art, the offline upgrade method for embedded devices provided in this embodiment receives an input signal from an upgrade device, enters an upgrade state when the frequency of the input signal is a preset frequency, and generates an upgrade instruction, determines whether the frequency of the input signal is the preset frequency by detecting the input signal, and if the frequency of the input signal is not the preset frequency, the embedded device directly enters the main program without the need for additional waiting time, thereby reducing the power-on time for the normal startup of the embedded device, sends the upgrade instruction to the upgrade device, responds to a communication handshake success instruction generated by the upgrade device after receiving the upgrade instruction, obtains an upgrade data packet in the upgrade device, performs offline upgrade on the embedded device based on the upgrade data packet, and automatically completes the upgrade of the embedded device by inserting the upgrade interface, thereby solving the problem of inconvenient maintenance.
[0022] In some embodiments, in step S101, an input signal of an upgrade device is received. When the frequency of the input signal is a preset frequency, the upgrade state is entered and an upgrade instruction is generated. For a schematic diagram of the structure of the upgrade device, please refer to Figure 2 ,like Figure 2 As shown, the upgrade device includes an upgrade interface, a first module and a second module. The first module is used to output a detected frequency signal, which needs to be paired with a control device; the second module is used to store an upgrade data packet and send the upgrade data packet to the embedded device through the upgrade interface. The upgrade device is connected to the embedded device through the upgrade interface in the upgrade device. The connection diagram of the embedded device and the upgrade device is shown in FIG. Figure 3,like Figure 3 As shown, the upgrade interface in the upgrade device includes an OUT terminal, a TX terminal, an RX terminal, and a GND terminal, which are respectively connected to the IN terminal, the RX terminal, the TX terminal, and the GND terminal in the embedded device. The first module inputs the input signal to the embedded device through the upgrade interface, and the second module transmits the upgrade data packet to the embedded device through the upgrade interface; its input signal includes an upgrade signal, and the frequency of the upgrade signal is the same as the preset frequency, which is 1kHz~2kHz. When the embedded device is started, when the upgrade device is connected to the embedded device, the input signal of the upgrade interface in the upgrade device is received, the input signal is detected, and the input signal of the upgrade interface is detected through the IO port of the embedded device, that is, the frequency of the input signal is detected. When the frequency of the input signal is the preset frequency, that is, when the frequency of the input signal is within the frequency range of the upgrade signal, the input signal is an upgrade signal. When the frequency of the input signal exceeds the frequency range of the upgrade signal, the embedded device automatically enters the main program, and its control device uses the MCU of TMS320F28335 as the main control chip. The control device uses the TMS320F28335 main control chip as the core to complete the relevant functions of the control device through the main program.
[0023] When the input signal is an upgrade signal, the embedded device enters the upgrade state, generates an upgrade instruction, and sends the upgrade instruction to the upgrade device through the serial communication interface; when the input signal is not an upgrade signal, the embedded device enters the main program and the embedded device starts normally.
[0024] Detecting the input signal of the upgrade interface is to detect the frequency of the input signal. When the frequency of the input signal is within the frequency range of the upgrade signal, the upgrade state is entered, otherwise the main program of the control device is entered.
[0025] In some embodiments, in step S102, in response to the communication handshake success instruction generated by the upgrade device after receiving the upgrade instruction, the upgrade data packet in the upgrade device is obtained, a timeout period is set, and it is determined whether the generation time of the communication handshake success instruction exceeds the timeout period. When the generation time is greater than the timeout period, the main program is entered. When the generation time is less than or equal to the timeout period, the upgrade data packet in the upgrade device is obtained, and the timeout period is set by the embedded device, and the timeout period is 2 seconds. After the embedded device enters the upgrade state, the upgrade instruction is sent to the upgrade device. After receiving the upgrade instruction, the upgrade device performs a communication handshake with the embedded device, that is, a custom communication protocol instruction is used to communicate with the upgrade device. The device is set to perform a communication handshake to generate a communication handshake success instruction, and obtain the generation time of the communication handshake success instruction, the generation time of the communication handshake success instruction is the communication handshake time, when the communication handshake time is greater than the timeout time, it means that the upgrade device and the embedded device have not achieved communication handshake, and the communication handshake has failed. At this time, the embedded device is controlled to enter the main program, when the communication handshake time is less than or equal to the timeout time, it means that the communication handshake is successful. At this time, in response to the communication handshake success instruction, the upgrade data packet is transmitted to the embedded device through the upgrade device, that is, the upgrade data packet is transmitted to the embedded device through the upgrade interface in the upgrade device, and the upgrade data packet is stored in the second module of the upgrade device.
[0026] The embedded device is upgraded offline based on the upgrade data packet, the upgrade data packet is stored in the first storage area, the upgrade data packet is verified, and when the upgrade data packet is verified, the upgrade data packet is updated to the second storage area, and the embedded device is upgraded offline based on the upgrade data packet in the second storage area; when the upgrade data packet verification fails, the upgrade data packet in the first storage area is discarded, and the upgrade state is entered until the embedded device completes the offline upgrade. The specific process is: when the embedded device and the upgrade device successfully communicate and handshake, the embedded device monitors the upgrade data packet and stores the upgrade data packet in the first storage area of the embedded device; after the upgrade data packet is received, the upgrade data packet is verified, and when the upgrade data packet is verified, the upgrade data packet is updated to the second storage area of the embedded device, and the embedded device is upgraded offline based on the upgrade data packet in the second storage area to update the data in the second storage area and complete the offline upgrade of the embedded device, when the upgrade data packet verification fails, the upgrade data packet in the first storage area is discarded, and the embedded device is controlled to enter the upgrade state until the embedded device completes the offline upgrade; After the control device enters the state of listening to the upgrade data packet, the upgrade device sends the upgrade data packet to the control device according to the customized communication protocol. After receiving the upgrade data packet, the control device parses the data packet to obtain valid data and stores the valid data in the upgrade data buffer. The upgrade data buffer is the first storage area. When all the upgrade data are received, the complete upgrade data is verified. If the upgrade data packet is verified correctly, the upgrade operation is performed. Otherwise, the current data packet is discarded, the upgrade state is re-entered, and the upgrade data packet is received again. The above process is repeated until the embedded device completes the offline upgrade processing. After the upgrade is completed, the embedded device enters the main program.
[0027] A specific embodiment of the present invention discloses an offline upgrade method for an embedded device, such as Figure 4 As shown, the offline upgrade method of the embedded device is applied to the upgrade device, comprising: S401, sending an input signal to an embedded device; S402, responding to the upgrade instruction of the embedded device and performing a communication handshake with the embedded device. After a successful handshake, the upgrade data packet is sent to the embedded device, so that the embedded device is upgraded offline.
[0028] In some embodiments, in step S401, the upgrade device sends an input signal to the embedded device through the upgrade interface, and the embedded device detects the input signal to determine the upgrade signal. When the input signal is an upgrade signal, the embedded device enters an upgrade state, generates an upgrade instruction, and sends the upgrade instruction to the upgrade device.
[0029] In some embodiments, in step S402, after receiving the upgrade instruction, the upgrade device responds to the upgrade instruction and performs a communication handshake with the embedded device. When the communication handshake time is less than or equal to the timeout time, the upgrade data packet is sent to the embedded device through the upgrade interface. After the embedded device completes monitoring and verification of the upgrade data packet, it performs an offline upgrade based on the upgrade data packet.
[0030] When the embedded device enters the upgrade state, TMS320F28335 sends an upgrade instruction to the upgrade device through the serial communication interface. If the communication handshake is not achieved after more than 2s, the embedded device automatically enters the main program. During the communication between the control device and the upgrade device, the communication rate is automatically matched with the upgrade device. When the control device receives the upgrade data packet, the upgrade data packet is first stored in the internal SRAM storage space of TMS320F28335, that is, the first storage area. After the upgrade data packet is received and verified to be correct, when the upgrade process is performed, the upgrade data packet is updated to the FLASH storage space, that is, the second storage area. The first 32kb space of the FLASH memory stores the startup program, and the upgrade data packet only updates the FLASH storage space after 32kb.
[0031] In order to better implement the offline upgrade method of the embedded device in the embodiment of the present invention, based on the offline upgrade method of the embedded device, correspondingly, Figure 5 As shown, the embodiment of the present invention further provides an embedded device offline upgrade system, the embedded device offline upgrade system 500 includes an upgrade device 501 and an embedded device 502; The upgrading device 501 is used to send an input signal to the embedded device 502; The embedded device 502 is used to receive an input signal, and when the frequency of the input signal is a preset frequency, enter an upgrade state, generate an upgrade instruction, and return the upgrade instruction to the upgrade device 501; The upgrading device 501 is also used to respond to the upgrading instruction of the embedded device 502 and perform a communication handshake with the embedded device 502. After a successful handshake, the upgrading data packet is sent to the embedded device 502, so that the embedded device 502 is upgraded offline.
[0032] like Figure 6 As shown, the present invention also provides an electronic device 600 , which can be a computing device such as a mobile terminal, a desktop computer, a notebook, a palm computer, a server, etc. The electronic device 600 includes a processor 601 , a memory 602 , and a display 603 . Figure 6 Only some components of the electronic device 600 are shown, but it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead.
[0033] In some embodiments, the memory 602 may be an internal storage unit of the electronic device 600, such as a hard disk or memory of the electronic device 600. In other embodiments, the memory 602 may also be an external storage device of the electronic device 600, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 600. Further, the memory 602 may also include both an internal storage unit of the electronic device 600 and an external storage device. The memory 602 is used to store application software and various types of data installed in the electronic device 600, such as program codes installed in the electronic device 600. The memory 602 may also be used to temporarily store data that has been output or is to be output. In one embodiment, an embedded device offline upgrade program is stored on the memory 602, and the embedded device offline upgrade program can be executed by the processor 601, thereby realizing the embedded device offline upgrade method of each embodiment of the present invention.
[0034] In some embodiments, the processor 601 may be a central processing unit (CPU), a microprocessor or other data processing chip, used to run program codes or process data stored in the memory 602, such as an offline upgrade method for embedded devices.
[0035] In some embodiments, the display 603 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch device, etc. The display 603 is used to display identification information of an offline upgrade program of an embedded device and to display a visual user interface. The components 601-603 of the electronic device 600 communicate with each other via a system bus.
[0036] In some embodiments, when the processor 601 executes the embedded device offline upgrade program in the memory 602, the various steps in the embedded device offline upgrade method described in the above embodiments are implemented. Since the embedded device offline upgrade method has been described in detail above, it will not be repeated here.
[0037] Accordingly, the present invention also provides a computer-readable storage medium, which is used to store computer-readable programs or instructions. When the program or instructions are executed by a processor, the steps or functions of the offline upgrade method of an embedded device provided in the above-mentioned method embodiments can be implemented.
[0038] In summary, the offline upgrade method, system and electronic device of the embedded device provided by the present invention receive the input signal of the upgrade device, enter the upgrade state when the frequency of the input signal is a preset frequency, and generate an upgrade instruction, and send the upgrade instruction to the upgrade device; respond to the communication handshake success instruction generated by the upgrade device after receiving the upgrade instruction, obtain the upgrade data packet in the upgrade device, and perform offline upgrade on the embedded device based on the upgrade data packet.
[0039] Those skilled in the art will appreciate that all or part of the processes of the above-mentioned embodiments can be implemented by instructing related hardware through a computer program, and the program can be stored in a computer-readable storage medium, wherein the computer-readable storage medium is a disk, an optical disk, a read-only storage memory, or a random access memory, etc.
[0040] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by any technician familiar with the technical field within the technical scope disclosed by the present invention should be covered within the protection scope of the present invention.
Claims
1. An offline upgrade method for an embedded device, applied to an embedded device, characterized in that: include: receiving an input signal from an upgrade device, entering an upgrade state when the frequency of the input signal is a preset frequency, generating an upgrade instruction, and sending the upgrade instruction to the upgrade device; In response to a communication handshake success instruction generated by the upgrade device after receiving the upgrade instruction, an upgrade data packet in the upgrade device is acquired, and the embedded device is offline upgraded based on the upgrade data packet.
2. The offline upgrade method for embedded devices according to claim 1, characterized in that: The preset frequency is 1kHz~2kHz.
3. The offline upgrade method for embedded devices according to claim 1, characterized in that: The step of sending the upgrade instruction to the upgrade device comprises: The upgrade instruction is sent to the upgrade device through the serial communication interface.
4. The offline upgrade method for embedded devices according to claim 3, characterized in that: The step of responding to the communication handshake success instruction generated by the upgrade device after receiving the upgrade instruction, and obtaining the upgrade data packet in the upgrade device, comprises: Setting a timeout period to determine whether the generation time of the communication handshake success instruction exceeds the timeout period; When the generation time is greater than the timeout time, entering the main program; When the generation time is less than or equal to the timeout time, an upgrade data packet in the upgrade device is acquired.
5. The offline upgrade method for embedded devices according to claim 4, characterized in that: The timeout period is 2S.
6. The offline upgrade method for embedded devices according to claim 4, characterized in that: The offline upgrading of the embedded device based on the upgrade data packet comprises: Storing the upgrade data package in the first storage area; Verifying the upgrade data packet, and when the upgrade data packet passes the verification, updating the upgrade data packet to the second storage area, and performing offline upgrade on the embedded device based on the upgrade data packet in the second storage area; When the upgrade data packet verification fails, the upgrade data packet in the first storage area is discarded, and the upgrade state is entered until the embedded device completes the offline upgrade.
7. The offline upgrade method for embedded devices according to claim 1, characterized in that: The main control chip of the embedded device is TMS320F28335, and the upgrade device includes an upgrade interface, a first module and a second module. The first module inputs the input signal to the embedded device through the upgrade interface, and the second module transmits the upgrade data packet to the embedded device through the upgrade interface.
8. An offline upgrade method for an embedded device, applied to an upgrade device, characterized in that: include: Send input signals to embedded devices; Respond to the upgrade instruction of the embedded device and perform communication handshake with the embedded device. After successful handshake, send the upgrade data packet to the embedded device to enable the embedded device to perform offline upgrade.
9. An offline upgrade system for embedded devices, characterized in that: Including upgrade devices and embedded devices; The upgrading device is used to send an input signal to the embedded device; The embedded device is used to receive the input signal, and when the frequency of the input signal is a preset frequency, enter an upgrade state, generate an upgrade instruction, and return the upgrade instruction to the upgrade device; The upgrade device is also used to respond to the upgrade instruction of the embedded device to perform a communication handshake with the embedded device, and after a successful handshake, send an upgrade data packet to the embedded device to enable the embedded device to perform an offline upgrade.
10. An electronic device, characterized in that: including memory and processor; The memory stores a computer-readable program executable by the processor; When the processor executes the computer-readable program, the steps in the offline upgrade method for an embedded device as described in any one of claims 1 to 8 are implemented.