A dual-chip-based program online upgrading system and upgrading method
By enabling online program upgrades through a dual-chip system, the problems of power outages and abnormal risks during the upgrade process in existing technologies are solved, ensuring the stable operation and flexible upgrade of the main control chip during the upgrade process.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HEBEI HANGUANG HEAVY IND
- Filing Date
- 2022-09-01
- Publication Date
- 2026-07-31
AI Technical Summary
Existing online program upgrade methods require manual power-off reset, making it impossible to upgrade at any time. Furthermore, the upgrade process is susceptible to unexpected power outages and FLASH malfunctions, posing a risk.
The system employs a dual-chip online upgrade system, including a main control chip and a BIOS chip. The BIOS chip stores the upgrade flag and backup program files, enabling communication and reset control between the main control chip and the BIOS chip, thus ensuring the normal operation of the main control chip during the upgrade process.
It avoids the risks of unexpected power outages and FLASH malfunctions during the upgrade process, ensures the normal operation of the main control chip, supports upgrades at any time, and reduces the need for manual intervention.
Smart Images

Figure CN115904453B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of online program upgrade technology, specifically relating to an online program upgrade system and method based on dual chips. Background Technology
[0002] With the rapid development of microcontroller technology, DSP, ARM, and other chips are increasingly widely used in digital signal processing, communication, and control. The common method for updating chip programs is to use the chip's own development environment via JTAG or SWD interfaces. However, this traditional method requires disassembling the product, exposing the emulator interface of the main control chip, establishing a communication link through the emulator, and then updating the program using specialized software. This method is extremely inconvenient for the product.
[0003] Current online program upgrade methods typically require manual power-off reset and chip restart before the upgrade can be performed. This method cannot be used to upgrade programs online as needed by users at any time, and it cannot handle the risks of unexpected power outages, FLASH malfunctions, or errors in the program itself during the upgrade process. Summary of the Invention
[0004] In view of this, the present invention provides a dual-chip-based online program upgrade system and method, which can effectively avoid the risks caused by unexpected power outages, FLASH write / erroneous writes, and errors in the program itself during the program upgrade process, ensuring that the main control chip can always operate normally, and can be upgraded at any time according to user needs.
[0005] This invention is achieved through the following technical solution:
[0006] A dual-chip-based online program upgrade system includes: a host computer, a main control chip, a main control chip FLASH module, a BIOS chip, and a BIOS chip FLASH module;
[0007] The main control chip's FLASH module stores the program file from before the upgrade, which serves as the current program file for the program's normal operation.
[0008] The BIOS chip's FLASH module stores upgrade flags and backup program files; the BIOS chip can access these upgrade flags and backup program files within its FLASH module.
[0009] The host computer is used to send upgrade commands and upgrade program files to the main control chip;
[0010] The main control chip transmits the upgrade command to the BIOS chip. The BIOS chip determines and updates the upgrade flag in the BIOS chip FLASH module according to the upgrade command, and generates a corresponding feedback upgrade command. The BIOS chip transmits the feedback upgrade command to the main control chip. The BIOS chip can also send the backup program file in the BIOS chip FLASH module to the main control chip according to the upgrade command. The BIOS chip can also reset the main control chip.
[0011] The main control chip performs an upgrade based on the feedback upgrade command; the main control chip erases the previous program file in the main control chip FLASH module, receives the upgrade program file from the host computer or the backup program file from the BIOS chip FLASH module, and solidifies the upgrade program file or backup program file in the main control chip FLASH module as the current program file;
[0012] The main control chip can call the current program file in the FLASH module of the main control chip.
[0013] Furthermore, an online program upgrade system based on dual chips also includes a debugging interface module, used to connect an external emulator to debug the main control chip and BIOS chip, as well as download program files and backup program files before the first upgrade.
[0014] Furthermore, the debugging interface module includes the JTAG interface of the main control chip and the SWD interface of the BIOS chip.
[0015] Furthermore, upgrade flags include flags for executing the current program, executing the update program, and executing the backup program;
[0016] The feedback upgrade command is one of the following commands: execute the current program command, execute the update program command, or execute the backup program command.
[0017] Specifically, when the result of the upgrade flag is the execute current program flag, the corresponding feedback upgrade instruction is the execute current program instruction;
[0018] When the upgrade flag indicates that the update procedure should be executed, the corresponding upgrade instruction is the update procedure execution instruction.
[0019] When the upgrade flag indicates that the backup program will be executed, the corresponding upgrade instruction is the backup program execution instruction.
[0020] Furthermore, the host computer and the main control chip are connected via a serial port and communicate using RS422 communication; the main control chip's FLASH module is connected to the main control chip via an EMIF bus; the BIOS chip's FLASH module and the BIOS chip communicate using SPI, with the SPI bus mode being mode 3; the main control chip and the BIOS chip are connected via a serial port and communicate using TTL communication.
[0021] A method for online program upgrade based on a dual-chip system, with the following specific logic flow:
[0022] The host computer transmits the upgrade command to the main control chip, and the upgrade begins. After receiving the upgrade command from the host computer, the main control chip hands with the BIOS chip. If the handshake fails, the BIOS chip resets the main control chip and re-hands with it. If the handshake succeeds, the BIOS chip determines the upgrade flag based on the upgrade command.
[0023] When the upgrade instruction is executed, the BIOS chip determines that the upgrade flag is the update program execution flag. The BIOS chip transmits the update program execution instruction to the main control chip, and the update upgrade flag is the backup program execution flag. After receiving the update program execution instruction, the main control chip receives the upgrade program file transmitted from the host computer and saves it to the main control chip FLASH module as the current program file. After the saving is completed, the update upgrade flag is the current program execution flag.
[0024] The BIOS chip resets the main control chip, and the main control chip and BIOS chip re-establish a handshake. If the handshake fails, the BIOS chip resets the main control chip and re-establishes the handshake. If the handshake succeeds, the BIOS chip determines the upgrade flag, which is then set to the "execute current program" flag. The main control chip then calls and runs the current program file in its FLASH module.
[0025] If the main control chip receives the upgrade program file transmitted from the host computer before the timeout, it continues to receive the file until the reception is complete. If the reception of the upgrade program file times out, the BIOS chip resets the main control chip, and the main control chip and BIOS chip re-establish a handshake. If the handshake fails, the BIOS chip resets the main control chip and re-establishes the handshake. If the handshake succeeds, the BIOS chip determines the upgrade flag, which is now set to the backup program execution flag. The BIOS chip transmits the backup program execution command to the main control chip, along with the backup program file. The main control chip receives the backup program file and stores it in its FLASH module as the current program file. After the main control chip finishes receiving the backup program file, the BIOS chip updates the upgrade flag to the current program execution flag.
[0026] Then, the BIOS chip resets the main control chip, and the main control chip and BIOS chip re-establish a handshake. If the handshake fails, the BIOS chip resets the main control chip and re-establishes a handshake. If the handshake succeeds, the BIOS chip determines the upgrade flag, which is then set to the "execute current program" flag. The main control chip then calls and runs the current program file in its FLASH module.
[0027] Furthermore, when the upgrade instruction is executed, the upgrade flag is determined to be the backup program execution flag. The BIOS chip directly transmits the backup program execution instruction to the main control chip, and at the same time transmits the backup program file to the main control chip. The main control chip receives the backup program file and stores it in the main control chip's FLASH module. After the main control chip finishes receiving the backup program file, the BIOS chip updates the upgrade flag to the current program execution flag.
[0028] The BIOS chip resets the main control chip, and the main control chip and BIOS chip re-establish a handshake. If the handshake fails, the BIOS chip resets the main control chip and re-establishes the handshake. If the handshake succeeds, the BIOS chip determines the upgrade flag, which is then set to the current program execution flag. The main control chip then calls and runs the current program file in its FLASH module.
[0029] Furthermore, when the upgrade instruction is executed, the upgrade flag is determined to be the current program flag. The BIOS chip transmits the current program execution instruction to the main control chip, and the main control chip calls and runs the current program file in the main control chip's FLASH module.
[0030] Furthermore, if the main control chip receives the backup program file without timeout, it continues to receive it until the reception is complete. If the main control chip times out receiving the backup program file, the BIOS chip resets the main control chip, and the main control chip and BIOS chip perform a handshake. If the handshake fails, the BIOS chip resets the main control chip and performs the handshake again. If the handshake succeeds, the BIOS chip determines the upgrade flag, which is still the backup program execution flag, and performs the following steps:
[0031] The BIOS chip directly transmits the instruction to execute the backup program to the main control chip, and at the same time transmits the backup program file to the main control chip. The main control chip receives the backup program file and stores it in the main control chip's FLASH module as the current program file. After storage, the update flag is changed to the current program execution flag.
[0032] The BIOS chip resets the main control chip, and the main control chip and BIOS chip re-establish a handshake. If the handshake fails, the BIOS chip resets the main control chip and re-establishes the handshake. If the handshake succeeds, the BIOS chip determines the upgrade flag, which is then set to the current program execution flag. The main control chip then calls and runs the current program file in its FLASH module.
[0033] Beneficial effects:
[0034] (1) The present invention provides a dual-chip-based online program upgrade system comprising: a host computer, a main control chip, a main control chip FLASH module, a BIOS chip, and a BIOS chip FLASH module; the main control chip FLASH module stores the program file before the upgrade as the current program file for normal program operation; the BIOS chip FLASH module stores the upgrade flag and backup program file; the BIOS chip can call the upgrade flag and backup program file in the BIOS chip FLASH module; the host computer is used to send upgrade commands and upgrade program files to the main control chip; the main control chip transmits the upgrade commands to the BIOS chip, and the BIOS chip judges and updates the BIOS chip FLASH module according to the upgrade commands. The BIOS chip generates an upgrade signal and corresponding feedback upgrade command, which is then transmitted to the main control chip. The BIOS chip can also send the backup program file from its BIOS chip FLASH module to the main control chip according to the upgrade command. The BIOS chip can also reset the main control chip. The main control chip performs the upgrade according to the feedback upgrade command. The main control chip erases the previous program file from its FLASH module, receives the upgrade program file from the host computer or the backup program file from the BIOS chip FLASH module, and stores the upgrade program file or backup program file in its FLASH module as the current program file. The main control chip can then call the current program file in its FLASH module. This invention sets up two chips, a main control chip and a BIOS chip, that can communicate with each other. The main control chip can access the main control chip's FLASH module, and the BIOS chip can access the BIOS chip's FLASH module. The BIOS chip's FLASH module stores backup program files. When an update program encounters an error or is interrupted, the BIOS chip can send the backup program file from the BIOS chip's FLASH module to the main control chip. This effectively avoids the risks caused by unexpected power outages, FLASH write errors, or errors in the program itself during the program upgrade process, ensuring that the main control chip can always operate normally.
[0035] (2) This invention also includes a debugging interface module, used to connect an external emulator to debug the main control chip and BIOS chip, and to download program files and backup program files before the first upgrade. When the main control chip or BIOS chip malfunctions, the debugging interface module can be used to debug the main control chip and BIOS chip to ensure normal online program upgrades.
[0036] (3) In this invention, the upgrade flags include a current program execution flag, an update program execution flag, and a backup program execution flag; the feedback upgrade instruction is one of the following: a current program execution instruction, an update program execution instruction, and a backup program execution instruction; wherein, when the upgrade flag determination result is the current program execution flag, the corresponding feedback upgrade instruction is the current program execution instruction; when the upgrade flag determination result is the update program execution flag, the corresponding feedback upgrade instruction is the update program execution instruction; and when the upgrade flag determination result is the backup program execution flag, the corresponding feedback upgrade instruction is the backup program execution instruction. In this invention, the BIOS chip can transmit the corresponding feedback upgrade instruction to the main control chip according to the upgrade flag determination result, causing the main control chip to execute the corresponding program, thereby realizing effective communication between the main control chip and the BIOS chip.
[0037] (4) The specific logic flow of the online program upgrade method based on dual chips of the present invention is as follows: The host computer transmits the upgrade command to the main control chip, the upgrade begins, after the main control chip receives the upgrade command transmitted by the host computer, it shakes hands with the BIOS chip. If the handshake fails, the BIOS chip resets the main control chip and re-shakes; if the handshake succeeds, the BIOS chip determines the upgrade flag according to the upgrade command; when the upgrade command is to execute the update program command, the upgrade flag determined by the BIOS chip is the execute update program flag, the BIOS chip transmits the execute update program command to the main control chip, and updates the upgrade flag to the execute backup program flag; after the main control chip receives the execute update program command, the main control chip receives the upgrade program file transmitted by the host computer and solidifies it into the FLASH module of the main control chip as the current program file. After solidification, the upgrade flag is updated to the execute current program flag; the BIOS chip resets the main control chip, and the main control chip and BIOS chip re-shake; if the handshake fails, the BIOS chip resets the main control chip and re-shakes; if the handshake succeeds, the BIOS chip determines the upgrade flag, at this time the upgrade flag is the execute current program flag, the main control chip calls the FLASH module of the main control chip. The system executes the current program file in the block. If the main control chip receives the upgrade program file from the host computer before the timeout, it continues receiving until completion. If the upgrade program file reception times out, the BIOS chip resets the main control chip, and the main control chip and BIOS chip re-establish a handshake. If the handshake fails, the BIOS chip resets the main control chip and re-establishes the handshake. If the handshake succeeds, the BIOS chip determines the upgrade flag, which is now set to execute the backup program flag. The BIOS chip transmits the execute backup program instruction to the main control chip, along with the backup program file. The main control chip receives the backup program file and stores it in its FLASH module as the current program file. After receiving the backup program file, the BIOS chip updates the upgrade flag to execute the current program flag. Then, the BIOS chip resets the main control chip, and the main control chip and BIOS chip re-establish a handshake. If the handshake fails, the BIOS chip resets the main control chip and re-establishes the handshake. If the handshake succeeds, the BIOS chip determines the upgrade flag, which is now set to execute the current program flag. The main control chip then calls and runs the current program file in its FLASH module.
[0038] Through the above process, during online upgrades, this invention receives update program commands from the host computer and can receive the upgrade program file from the host computer for upgrades. At the same time, the BIOS chip's update upgrade flag is set to execute the backup program flag. Therefore, if the main control chip times out of receiving the upgrade program file from the host computer, or if there is an unexpected power outage, FLASH write error, or error in the program itself during the upgrade process, the BIOS chip can reset the main control chip and then transmit the backup program file to the main control chip according to the execute backup program flag to restore the normal operation of the program.
[0039] At the same time, the BIOS chip can also reset the main control chip without manual power-off reset, and can be upgraded at any time according to the user's needs.
[0040] (5) In this invention, the upgrade instruction is executed when the backup program instruction is executed. The upgrade flag is the backup program execution flag. The BIOS chip directly transmits the backup program execution instruction to the main control chip, and simultaneously transmits the backup program file to the main control chip. The main control chip receives the backup program file and stores it in its FLASH module. After receiving the backup program file, the BIOS chip updates the upgrade flag to the current program execution flag. The BIOS chip resets the main control chip, and the main control chip and BIOS chip re-establish a handshake. If the handshake fails, the BIOS chip resets the main control chip and re-establishes the handshake. If the handshake succeeds, the BIOS chip determines the upgrade flag, which is now the current program execution flag. The main control chip then calls and runs the current program file in its FLASH module. This invention also includes an upgrade instruction to execute the backup program. If an error occurs in the program file before the upgrade, the host computer can send an execution backup program instruction to actively control the process, replacing the previous program file with the backup program file to ensure normal program operation.
[0041] (6) In this invention, if the main control chip receives the backup program file without timeout, it continues to receive until the reception is complete; if the main control chip receives the backup program file but timeout, the BIOS chip resets the main control chip, and the main control chip and BIOS chip perform a handshake; if the handshake fails, the BIOS chip resets the main control chip and performs a handshake again; if the handshake succeeds, the BIOS chip determines the upgrade flag, which is still the backup program execution flag, and performs the following steps: the BIOS chip directly transmits the backup program execution instruction to the main control chip, and at the same time transmits the backup program file to the main control chip; the main control chip receives the backup program file and stores it in the main control chip's FLASH module as the current program file; after storage, the upgrade flag is updated to the current program execution flag; the BIOS chip resets the main control chip, and the main control chip and BIOS chip perform a handshake again; if the handshake fails, the BIOS chip resets the main control chip and performs a handshake again; if the handshake succeeds, the BIOS chip determines the upgrade flag, which is now the current program execution flag; the main control chip calls the current program file in the main control chip's FLASH module and runs it. In this invention, the BIOS chip can repeatedly call the backup program file in the BIOS chip FLASH module and send it to the main control chip. If the main control chip times out of receiving the backup program file, the BIOS chip resets the main control chip. The BIOS chip determines the upgrade flag, which is still the backup program execution flag. The main control chip executes the backup program instruction again, further ensuring that the program can be restored to normal operation in case of accidental power failure, FLASH erasure or writing abnormality, or error in the program itself during the program upgrade process. Attached Figure Description
[0042] Figure 1 This is a hardware block diagram of the online program upgrade system;
[0043] Figure 2 This is a flowchart illustrating the online program upgrade method. Detailed Implementation
[0044] The present invention will now be described in detail with reference to the accompanying drawings and embodiments.
[0045] Example 1:
[0046] This embodiment provides a dual-chip-based online program upgrade system, see appendix. Figure 1 This includes: host computer, main control chip, main control chip FLASH module, BIOS chip, and BIOS chip FLASH module;
[0047] The main control chip's FLASH module stores the program file from before the upgrade, which serves as the current program file for the program's normal operation.
[0048] The BIOS chip's FLASH module stores upgrade flags and backup program files; the BIOS chip can access these upgrade flags and backup program files within its FLASH module.
[0049] The host computer is used to send upgrade commands and upgrade program files to the main control chip;
[0050] The main control chip transmits the upgrade command to the BIOS chip. The BIOS chip can determine and update the upgrade flag in the BIOS chip FLASH module according to the upgrade command, and generate a corresponding feedback upgrade command. The BIOS chip transmits the feedback upgrade command to the main control chip. The BIOS chip can also send the backup program file in the BIOS chip FLASH module to the main control chip according to the upgrade command. The BIOS chip can also reset the main control chip.
[0051] The main control chip performs an upgrade based on the feedback upgrade command; the main control chip erases the previous program file in the main control chip FLASH module, receives the upgrade program file from the host computer or the backup program file from the BIOS chip FLASH module, and solidifies the upgrade program file or backup program file in the main control chip FLASH module as the current program file;
[0052] The main control chip can call the current program file in the FLASH module of the main control chip.
[0053] Furthermore, an online program upgrade system based on dual chips also includes a debugging interface module, used to connect an external emulator to debug the main control chip and BIOS chip, as well as download program files and backup program files before the first upgrade.
[0054] Furthermore, upgrade flags include flags for executing the current program, executing the update program, and executing the backup program;
[0055] The feedback upgrade command is one of the following commands: execute the current program command, execute the update program command, or execute the backup program command.
[0056] Specifically, when the result of the upgrade flag is the execute current program flag, the corresponding feedback upgrade instruction is the execute current program instruction;
[0057] When the upgrade flag indicates that the update procedure should be executed, the corresponding upgrade instruction is the update procedure execution instruction.
[0058] When the upgrade flag indicates that the backup program will be executed, the corresponding upgrade instruction is the backup program execution instruction.
[0059] Furthermore, the processor used in the main control chip has higher performance and better stability than that in the BIOS chip; since the functions implemented by the BIOS chip are simpler than those of the main control chip, it uses a processor with lower performance and lower stability than the main control chip, resulting in lower cost and higher cost performance.
[0060] Furthermore, the host computer and the main control chip are connected via a serial port and communicate using RS422 communication; the main control chip's FLASH module is connected to the main control chip via an EMIF bus; the BIOS chip's FLASH module and the BIOS chip communicate using SPI, with the SPI bus mode being mode 3; the main control chip and the BIOS chip are connected via a serial port and communicate using TTL communication.
[0061] Furthermore, the debugging interface module includes the JTAG interface of the main control chip and the SWD interface of the BIOS chip.
[0062] Furthermore, the main control chip uses a processor with the model number LCDSP0102. This processor core is a high-performance C6713 floating-point DSP with a working frequency of 200MHz, a performance of 1200MFLOPS, and 1600MIPS.
[0063] The BIOS chip uses an ARM processor, model STM32F103C8T6, which is a 32-bit microcontroller based on the ARM Cortex-M core STM32 series with a working frequency of 72MHz.
[0064] The BIOS chip FLASH module uses a low-power NAND Flash chip, model W25N01GV, with a capacity of 1Gbit.
[0065] The main control chip FLASH module uses the S29GL512P Flash chip with a capacity of 512Mbit.
[0066] The serial port connecting the host computer and the main control chip is MAX3490ESA, with a maximum baud rate of 921600bps.
[0067] Example 2:
[0068] This embodiment provides a dual-chip-based online program upgrade method, based on the dual-chip-based online program upgrade system in Embodiment 1, see Appendix. Figure 2 The specific logical flow is as follows:
[0069] The host computer transmits the upgrade command to the main control chip, and the upgrade begins. After receiving the upgrade command from the host computer, the main control chip hands over with the BIOS chip. If the handshake fails, the BIOS chip resets the main control chip and re-enters the handshake. If the handshake succeeds, the BIOS chip determines the upgrade flag based on the upgrade command, and the upgrade flag results in one of three cases:
[0070] (1) The upgrade instruction is to execute the update program instruction. The upgrade flag determined by the BIOS chip is the execute update program flag. The BIOS chip transmits the execute update program instruction to the main control chip, and the update upgrade flag is the execute backup program flag. After the main control chip receives the execute update program instruction, the main control chip receives the upgrade program file transmitted by the host computer and saves it into the FLASH module of the main control chip as the current program file. After the saving is completed, the update upgrade flag is the execute current program flag.
[0071] The BIOS chip resets the main control chip, and the main control chip and BIOS chip re-establish a handshake. If the handshake fails, the BIOS chip resets the main control chip and re-establishes the handshake. If the handshake succeeds, the BIOS chip determines the upgrade flag, which is then set to the "execute current program" flag. The main control chip then calls and runs the current program file in its FLASH module.
[0072] If the main control chip receives the upgrade program file transmitted from the host computer before the timeout, it continues to receive the file until the reception is complete. If the reception of the upgrade program file times out, the BIOS chip resets the main control chip, and the main control chip and BIOS chip re-establish a handshake. If the handshake fails, the BIOS chip resets the main control chip and re-establishes the handshake. If the handshake succeeds, the BIOS chip determines the upgrade flag, which is now set to the backup program execution flag. The BIOS chip transmits the backup program execution command to the main control chip, along with the backup program file. The main control chip receives the backup program file and stores it in its FLASH module as the current program file. After the main control chip finishes receiving the backup program file, the BIOS chip updates the upgrade flag to the current program execution flag.
[0073] Then, the BIOS chip resets the main control chip, and the main control chip and BIOS chip re-establish a handshake. If the handshake fails, the BIOS chip resets the main control chip and re-establishes a handshake. If the handshake succeeds, the BIOS chip determines the upgrade flag, which is then set to the "execute current program" flag. The main control chip then calls and runs the current program file in its FLASH module.
[0074] (2) When the upgrade instruction is executed, the upgrade flag is the backup program execution flag. The BIOS chip directly transmits the backup program execution instruction to the main control chip, and at the same time transmits the backup program file to the main control chip. The main control chip receives the backup program file and stores it in the main control chip FLASH module. After the main control chip finishes receiving the backup program file, the BIOS chip updates the upgrade flag to the current program execution flag.
[0075] The BIOS chip resets the main control chip, and the main control chip and BIOS chip re-establish a handshake. If the handshake fails, the BIOS chip resets the main control chip and re-establishes the handshake. If the handshake succeeds, the BIOS chip determines the upgrade flag, which is then set to the current program execution flag. The main control chip then calls and runs the current program file in its FLASH module.
[0076] (3) When the upgrade instruction is executed, the upgrade flag is the current program flag. The BIOS chip will transmit the current program instruction to the main control chip. The main control chip will call the current program file (i.e. the program file before the upgrade) in the FLASH module of the main control chip and run it.
[0077] Furthermore, if the main control chip receives the backup program file without timeout, it continues to receive it until the reception is complete. If the main control chip times out receiving the backup program file, the BIOS chip resets the main control chip, and the main control chip and BIOS chip perform a handshake. If the handshake fails, the BIOS chip resets the main control chip and performs the handshake again. If the handshake succeeds, the BIOS chip determines the upgrade flag, which is still the backup program execution flag, and performs the following steps:
[0078] The BIOS chip directly transmits the instruction to execute the backup program to the main control chip, and at the same time transmits the backup program file to the main control chip. The main control chip receives the backup program file and stores it in the main control chip's FLASH module as the current program file. After storage, the update flag is changed to the current program execution flag.
[0079] The BIOS chip resets the main control chip, and the main control chip and BIOS chip re-establish a handshake. If the handshake fails, the BIOS chip resets the main control chip and re-establishes the handshake. If the handshake succeeds, the BIOS chip determines the upgrade flag, which is then set to the current program execution flag. The main control chip then calls and runs the current program file in its FLASH module.
[0080] In summary, the above are merely preferred embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A dual-chip based program online upgrading system, characterized in that, include: Host computer, main control chip, main control chip FLASH module, BIOS chip, BIOS chip FLASH module; The main control chip's FLASH module stores the program file from before the upgrade, which serves as the current program file for the program's normal operation. The BIOS chip's FLASH module stores upgrade flags and backup program files; the BIOS chip can access these upgrade flags and backup program files within its FLASH module. The host computer is used to send upgrade commands and upgrade program files to the main control chip; The main control chip transmits the upgrade command to the BIOS chip. The BIOS chip determines and updates the upgrade flag in the BIOS chip FLASH module according to the upgrade command, and generates a corresponding feedback upgrade command. The BIOS chip transmits the feedback upgrade command to the main control chip. The BIOS chip can also send the backup program file in the BIOS chip FLASH module to the main control chip according to the upgrade command. The BIOS chip can also reset the main control chip. Upgrade flags include the flag for executing the current program, the flag for executing the update program, and the flag for executing the backup program; The feedback upgrade instruction is one of the following: execute the current program instruction, execute the update program instruction, or execute the backup program instruction. Specifically, when the upgrade flag is determined to be the execute current program flag, the corresponding feedback upgrade instruction is the execute current program instruction; when the upgrade flag is determined to be the execute update program flag, the corresponding feedback upgrade instruction is the execute update program instruction; and when the upgrade flag is determined to be the execute backup program flag, the corresponding feedback upgrade instruction is the execute backup program instruction. The main control chip performs an upgrade based on the feedback upgrade command; the main control chip erases the previous program file in the main control chip FLASH module, receives the upgrade program file from the host computer or the backup program file from the BIOS chip FLASH module, and solidifies the upgrade program file or backup program file in the main control chip FLASH module as the current program file; The main control chip can call the current program file in the FLASH module of the main control chip.
2. The dual-chip based program online upgrading system according to claim 1, wherein, It also includes a debugging interface module, which is used to connect an external emulator to debug the main control chip and BIOS chip, as well as download program files and backup program files before the first upgrade.
3. The dual-chip based program online upgrading system according to claim 2, wherein, The debugging interface module includes the JTAG interface of the main control chip and the SWD interface of the BIOS chip.
4. The dual-chip based program online upgrading system according to any one of claims 1-3, wherein, The host computer and the main control chip are connected via a serial port and communicate using RS422 communication. The main control chip's FLASH module is connected to the main control chip via an EMIF bus. The BIOS chip's FLASH module and the BIOS chip communicate using SPI, with the SPI bus mode being mode 3. The main control chip and the BIOS chip are connected via a serial port and communicate using TTL communication.
5. A method for online program upgrade based on a dual-chip, based on the online program upgrade system based on a dual-chip as described in any one of claims 1-4, characterized in that, The specific logic flow is as follows: The host computer transmits the upgrade command to the main control chip, and the upgrade begins. After receiving the upgrade command from the host computer, the main control chip shakes hands with the BIOS chip. If the handshake fails, the BIOS chip resets the main control chip and the handshake is restarted. If the handshake is successful, the BIOS chip determines the upgrade flag based on the upgrade command; When the upgrade instruction is executed, the BIOS chip determines that the upgrade flag is the update program execution flag. The BIOS chip then transmits the update program execution instruction to the main control chip, and the update upgrade flag is the backup program execution flag. After receiving the instruction to execute the update program, the main control chip receives the upgrade program file transmitted from the host computer and saves it into the FLASH module of the main control chip as the current program file. After the saving is completed, the update upgrade flag is set to the current program execution flag. The BIOS chip resets the main control chip, and the main control chip and the BIOS chip re-establish a handshake. If the handshake fails, the BIOS chip resets the main control chip and initiates a new handshake. If the handshake is successful, the BIOS chip determines the upgrade flag. At this time, the upgrade flag is the current program execution flag, and the main control chip calls the current program file in the main control chip FLASH module and runs it. If the main control chip receives the upgrade program file transmitted from the host computer before the timeout, it continues to receive the file until the reception is complete. If the reception of the upgrade program file times out, the BIOS chip resets the main control chip, and the main control chip and BIOS chip re-establish a handshake. If the handshake fails, the BIOS chip resets the main control chip and re-establishes the handshake. If the handshake succeeds, the BIOS chip determines the upgrade flag, which is now set to the backup program execution flag. The BIOS chip transmits the backup program execution command to the main control chip, along with the backup program file. The main control chip receives the backup program file and stores it in its FLASH module as the current program file. After the main control chip finishes receiving the backup program file, the BIOS chip updates the upgrade flag to the current program execution flag. Then, the BIOS chip resets the main control chip, and the main control chip and BIOS chip re-establish a handshake. If the handshake fails, the BIOS chip resets the main control chip and re-establishes a handshake. If the handshake succeeds, the BIOS chip determines the upgrade flag, which is then set to the "execute current program" flag. The main control chip then calls and runs the current program file in its FLASH module.
6. The online program upgrade method based on a dual-chip as described in claim 5, characterized in that, The upgrade instruction is executed when the backup program instruction is executed. The upgrade flag is the backup program execution flag. The BIOS chip directly transmits the backup program execution instruction to the main control chip, and at the same time transmits the backup program file to the main control chip. The main control chip receives the backup program file and stores it in the main control chip FLASH module. After the main control chip receives the backup program file, the BIOS chip updates the upgrade flag to the current program execution flag. The BIOS chip resets the main control chip, and the main control chip and the BIOS chip re-establish a handshake. If the handshake fails, the BIOS chip resets the main control chip and initiates a new handshake. If the handshake is successful, the BIOS chip determines the upgrade flag. At this time, the upgrade flag is the current program execution flag, and the main control chip calls the current program file in the main control chip FLASH module and runs it.
7. The online program upgrade method based on a dual-chip as described in claim 5 or 6, characterized in that, The upgrade instruction is determined when executing the current program instruction. The upgrade flag is the current program execution flag. The BIOS chip transmits the current program execution instruction to the main control chip. The main control chip calls the current program file in the main control chip's FLASH module and runs it.
8. The online program upgrade method based on a dual-chip as described in claim 5 or 6, characterized in that, If the main control chip receives the backup program file without timeout, it continues to receive until the reception is complete; if the main control chip receives the backup program file but timeout, the BIOS chip resets the main control chip, and the main control chip and BIOS chip perform a handshake. If the handshake fails, the BIOS chip resets the main control chip and initiates a new handshake. If the handshake is successful, the BIOS chip determines the upgrade flag. If the upgrade flag is still the backup program execution flag, the following steps are performed: The BIOS chip directly transmits the instruction to execute the backup program to the main control chip, and at the same time transmits the backup program file to the main control chip. The main control chip receives the backup program file and stores it in the main control chip's FLASH module as the current program file. After storage, the update flag is changed to the current program execution flag. The BIOS chip resets the main control chip, and the main control chip and the BIOS chip re-establish a handshake. If the handshake fails, the BIOS chip resets the main control chip and initiates a new handshake. If the handshake is successful, the BIOS chip determines the upgrade flag. At this time, the upgrade flag is the current program execution flag, and the main control chip calls the current program file in the main control chip FLASH module and runs it.