Serial port-based DSP (Digital Signal Processor) application program online upgrading method

By adding power outage detection and automatic reconnection mechanisms to the online upgrade method of DSP applications, the utilization of memory and processor space is optimized, and the problems of large resource occupation and interrupt hazards in the existing technology are solved, achieving a more stable and reliable online Upgrade process.

CN119473345APending Publication Date: 2025-02-18WUHAN GOLDSTAR ELECTRIC CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411489247.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-23
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

During the online upgrade of existing DSP applications, there are harms caused by large resource occupation and interruption, which may lead to unstable and even damage to the device.

Method used

Design an online upgrade method for DSP applications based on serial port. By adding power outage detection mechanism and automatic reconnection mechanism to the upgrade program, optimize the memory and processor space occupation, divide the upgrade program into multiple small modules, and in The power outage detection circuit is integrated in the power management module of the DSP host.

Benefits of technology

It realizes the small amount of DSP memory resources occupied during the online upgrade process, and can prevent the harm caused by interrupts, improving the stability and reliability of the upgrade.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119473345A_ABST
    Figure CN119473345A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of serial port communication, and discloses a serial port-based DSP (Digital Signal Processor) application program online upgrading method, which comprises the following steps of: 1, designing an upgrading program to be used as a program which is firstly operated after a DSP is powered on, judging whether upgrading is needed or not, and executing an upgrading process, and 2, designing a circuit with a power-off detection function and integrating the circuit in a power management module of the DPS host. According to the method, smaller data structures and algorithms are selected from data structures of arrays, linked lists, stacks and queues and linear search algorithms to design the upgrading program, so that memory occupation can be reduced, and in the upgrading process, upgrading program codes are divided into small data packets which are sent to a buffer area of an RAM in batches; the data volume transmitted each time can be ensured to be controllable, the pressure on system resources can be reduced by sending the data packets in batches, and particularly on equipment with limited resources, the situation that a large amount of memory or processor time is occupied at a time is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of serial port communication, in particular to a serial port-based DSP application online upgrade method. Background Art

[0002] As a powerful digital signal processing chip, DSP is widely used in many fields, such as communications, audio processing, and image processing. As technology develops and needs change, DSP applications need to be continuously updated to improve performance, add features, or fix vulnerabilities.

[0003] Common DSP program update methods include online and offline upgrades. Online upgrades are further divided into serial communication upgrades and batch code upgrades. The former allows for remote program updates, making it ideal for applications without direct access to hardware devices. The latter is suitable for applications with large application code or limited DSP RAM space, allowing the code to be sent to the DSP in batches for upgrade. However, the current DSP program online upgrade process has the following drawbacks: During the upgrade process, unexpected events such as power failures or communication interruptions can render the DSP unstable and even damage the device. Furthermore, online upgrades require the DSP's processing power and memory resources, which can impact the device's normal operation in resource-constrained environments. Summary of the Invention

[0004] (1) Technical problems solved

[0005] In view of the shortcomings of the existing technology, the present invention provides a serial port-based DSP application online upgrade method, which has the advantages of occupying small DSP memory resources and preventing the harm caused by interruptions during the online upgrade process, thereby solving the problems raised in the background technology.

[0006] (2) Technical solution

[0007] In order to achieve the above-mentioned objectives of occupying small DSP memory resources and preventing the harm caused by interruptions during the online upgrade process, the present invention provides the following technical solutions: a method for online upgrading of DSP applications based on a serial port, which is performed in the following steps:

[0008] Step 1: Design an upgrade program to be the first program to run after the DSP is powered on. It is responsible for determining whether an upgrade is required and executing the upgrade process.

[0009] Step 2: Design a circuit with power failure detection and integrate it into the power management module of the DPS host;

[0010] Step 3: Optimize the DSP memory and processor space usage, and divide the upgrade program into multiple small modules, each responsible for a part of the function;

[0011] Step 4: Add power failure detection and automatic reconnection mechanisms to the upgrade program;

[0012] Step 5: Establish a serial port connection between the DSP and the host, and send an upgrade request to the DPS through the serial port;

[0013] Step 6: After checking the compatibility of the upgrade program with the current system through DSP, back up the currently running DPS application;

[0014] Step 7: Start the upgrade, transfer the upgrade program code to the RAM buffer, erase the original code in the FLASH, and write the upgrade code to the FLASH until the online upgrade is completed;

[0015] Step 8: If a power outage or signal interruption occurs, the upgrade program will immediately save the current upgrade status and continue the upgrade from the breakpoint after power is restored.

[0016] Preferably, the upgrade program in step 1 includes a Bootloader program that is first run after power-on and is responsible for determining whether an upgrade is required and is not erased during the upgrade process.

[0017] Preferably, in step 1, the data structures of arrays, linked lists, stacks and queues and linear search algorithms are used to design the upgrade program.

[0018] Preferably, after starting the upgrade in step seven, the upgrade process is further controlled, specifically by the following sub-steps:

[0019] a. Send in batches: Divide the entire upgrade program code into small data packets and send them to the RAM buffer in batches;

[0020] b. Dynamic buffer management: The RAM buffer is dynamically resized based on the amount of received upgrade data packets;

[0021] c. Program burning and verification: After receiving the complete upgrade program code, burn it into the DSP memory and perform verification after burning is completed.

[0022] Preferably, the sub-step further includes status feedback during the upgrade process, and real-time feedback of the current status to the host computer, including upgrade progress, success or failure, error information, etc.

[0023] Preferably, the status feedback during the upgrade process also includes providing an alarm mechanism for unrecoverable errors, such as verification failure, and allowing manual intervention.

[0024] Preferably, the step 2 further includes writing an interrupt service program into the DPS memory, wherein the interrupt service program is used to automatically save the progress of the current upgrade program after power failure.

[0025] Preferably, if a signal interruption occurs in step eight, the upgrade program starts an automatic reconnection mechanism and sets an interrupt priority.

[0026] Compared with the prior art, the present invention provides a method for online upgrading of DSP applications based on a serial port, which has the following beneficial effects:

[0027] 1. The present invention provides a serial port-based DSP application online upgrade method. By setting an interrupt service routine in the upgrade program, storing the upgrade program in an external Flash memory, and implementing the judgment and loading of the upgrade program in the Bootloader, the program can be updated and the running status can be saved. In this way, when the DSP upgrade program is powered off, the current upgrade progress can be saved. A reasonable timeout period is set in the upgrade program. When no data or confirmation signal is received within the predetermined time, the program will automatically try to re-establish the connection. The key transmission nodes are recorded during the upgrade process. When an interruption or power outage occurs, the DPS can resume transmission from the nearest successful node after powering on again and restoring the signal connection, without having to start from the beginning. This improves the stability and reliability of the DSP application online upgrade.

[0028] 2. The present invention provides a serial port-based DSP application online upgrade method. By designing the upgrade program by selecting smaller data structures and algorithms from array, linked list, stack and queue data structures and linear search algorithms, memory usage can be reduced. Faster algorithms can reduce time complexity, thereby improving overall operating efficiency. During the upgrade process, the upgrade program code is divided into small data packets and sent to the RAM buffer in batches, which can ensure that the amount of data transmitted each time is controllable, reduce transmission errors caused by excessively large data packets, and thus improve the stability of the entire upgrade process. Sending data packets in batches can reduce the pressure on system resources, especially on devices with limited resources, and avoid occupying a large amount of memory or processor time at one time. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] Figure 1 Schematic diagram of the steps of the upgrading method of the present invention;

[0030] Figure 2 This is a logic block diagram of the upgrading method of the present invention. DETAILED DESCRIPTION

[0031] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.

[0032] See also Figure 1-Figure 2 , a serial port-based DSP application online upgrade method, is performed as follows:

[0033] Step 1: Design an upgrade program to be the first program to run after the DSP is powered on. It is responsible for determining whether an upgrade is required and executing the upgrade process.

[0034] Step 2: Design a circuit with power failure detection and integrate it into the power management module of the DPS host;

[0035] Step 3: Optimize the DSP memory and processor space usage, and divide the upgrade program into multiple small modules, each responsible for a part of the function;

[0036] Step 4: Add power failure detection and automatic reconnection mechanisms to the upgrade program;

[0037] Step 5: Establish a serial port connection between the DSP and the host, and send an upgrade request to the DPS through the serial port;

[0038] Step 6: After checking the compatibility of the upgrade program with the current system through DSP, back up the currently running DPS application;

[0039] Step 7: Start the upgrade, transfer the upgrade program code to the RAM buffer, erase the original code in the FLASH, and write the upgrade code to the FLASH until the online upgrade is completed;

[0040] Step 8: If a power outage or signal interruption occurs, the upgrade program will immediately save the current upgrade status and continue the upgrade from the breakpoint after power is restored.

[0041] Specifically, the upgrade program in step one includes a Bootloader program that is the first program to be run after power-on. The program is responsible for determining whether an upgrade is required and will not be erased during the upgrade process. The advantage is that the Bootloader program will not be erased during the upgrade process. This ensures that even if an unexpected situation occurs during the upgrade process, such as a power outage or communication error, which causes the upgrade to fail, the upgrade process can be re-entered after the next power-on, rather than causing the device to be unusable. This ensures the continuity of the upgrade process. After power-on, the Bootloader program is entered first, and after the program is received and stored, it can automatically jump to the application program for execution. This can reduce the device startup time and improve the device's response speed and availability. Through the Bootloader program, the new upgrade program can be uploaded to the DPS storage through the serial port. This process can be completed remotely without physical contact with the device, which greatly simplifies the upgrade operation.

[0042] Specifically, in step one, the upgrade program is designed using array, linked list, stack, and queue data structures, as well as linear search algorithms. The advantage is that choosing smaller data structures and algorithms from among these structures can reduce memory usage. Faster algorithms can reduce time complexity, thereby improving overall operational efficiency. Streamlined data structures and algorithms are easier to understand and test, which helps reduce potential errors and bugs and enhances program stability. Simple data structures and algorithms are also easy to maintain and update, and smaller data structures and algorithms consume less memory resources on the DPS. This is crucial for DSP upgrade programs running on resource-constrained devices.

[0043] Specifically, after starting the upgrade in step 7, the upgrade process is also controlled, which is specifically carried out in the following sub-steps:

[0044] a. Send in batches: The entire upgrade program code is divided into small data packets and sent to the RAM buffer in batches. The advantage is that during the upgrade process, the upgrade program code is divided into small data packets and sent to the RAM buffer in batches, which can ensure that the amount of data transmitted each time is controllable, reduce transmission errors caused by excessively large data packets, and thus improve the stability of the entire upgrade process. Sending data packets in batches can reduce the pressure on system resources, especially on devices with limited resources, and avoid occupying a large amount of memory or processor time at one time. The entire upgrade package does not need to be stored in the DPS storage at one time, reducing the demand for storage space. At the same time, if an interruption occurs during the upgrade process, the small data packet can quickly locate the specific part with the problem and can continue the transmission from the interruption point instead of restarting the entire upgrade process. Furthermore, for upgrade scenarios via the network, small data packets can reduce network congestion and data transmission time, which is beneficial for transmission in poor network conditions.

[0045] b. Dynamic buffer management: The RAM buffer is dynamically resized based on the amount of data in the received upgrade data packets. The advantage is that dynamic adjustment of the RAM buffer size can reasonably allocate memory resources according to actual needs, avoiding memory waste or shortage caused by the fixed size of the RAM buffer. The dynamic buffer only occupies additional RAM space when needed, thereby saving storage space. At the same time, dynamic adjustment of the buffer size helps reduce the competition for limited memory resources between multiple tasks or processes and reduces the possibility of resource conflicts.

[0046] c. Program Burning and Verification: After receiving the complete upgrade program code, it is burned into the DSP's memory and verified after the burning is complete. The advantage is that after receiving the complete upgrade program code, the verification step can ensure that the burned program code is complete and correct, and no data loss or corruption occurred during the transmission or burning process. The verification can confirm whether the program code meets expectations, ensure that the DSP operates correctly according to the new program, and avoid device abnormalities caused by incorrect code. Verification immediately after burning can reduce subsequent maintenance costs because once a problem is discovered, it can be quickly resolved instead of performing expensive maintenance after the DPS system is already running.

[0047] Specifically, the sub-step also includes status feedback during the upgrade process, providing real-time feedback to the host computer on the current status, including upgrade progress, success, error messages, etc. The advantage is that real-time status feedback allows the host computer operator to understand detailed information about the upgrade process. The operator can monitor the upgrade process through feedback information to ensure that the upgrade proceeds as planned. The real-time feedback information allows the operator to understand the upgrade progress, reduce uncertainty during waiting, and improve the user experience. At the same time, the status information can be used as a log record of the upgrade process, providing data support for subsequent maintenance and fault analysis. The host computer can also make corresponding control decisions based on the real-time feedback status information, such as pausing the upgrade or rolling back to the previous version, thereby enhancing the control over the upgrade process.

[0048] Specifically, status feedback during the upgrade process also includes providing an alarm mechanism for unrecoverable errors, such as verification failures, and allowing manual intervention. The advantage is that when an error that cannot be automatically recovered occurs during the upgrade process, the alarm mechanism can promptly notify the operator. The operator can then manually intervene and make decisions based on the specific situation, such as attempting to fix the error, rolling back to the previous stable version, or taking other necessary measures. Timely alarms and manual intervention can help reduce production losses or system failures caused by erroneous upgrades.

[0049] Specifically, step 2 also includes writing an interrupt service routine into the DPS memory. This interrupt service routine is used to automatically save the current upgrade program progress after a power outage. Advantageously, the interrupt service routine can be implemented using In-Application Programming (IAP) technology, a technology that allows applications to update themselves while they are running. By storing the upgrade program in external Flash memory and enabling the bootloader to determine and load the upgrade program, program updates and running status can be saved. This allows the current upgrade progress to be saved after a power outage during the DSP upgrade process, ensuring the continuity and reliability of the upgrade process.

[0050] Specifically, if a signal interruption occurs in step 8, the upgrade program will initiate an automatic reconnection mechanism and set the interruption priority. The advantage is that if a reasonable timeout is set in the upgrade program, if no data or confirmation signal is received within the predetermined time, the program will automatically attempt to reestablish the connection. During the upgrade process, key transmission nodes are recorded. If an interruption occurs, transmission can be resumed from the nearest successful node instead of starting from the beginning.

[0051] When using it, first prepare the upgrade program. After powering on the DPS, the upgrade program connects to the host and DPS via the serial port. The upgrade program starts sending upgrade requests and then verifies system compatibility. If the system is incompatible, the upgrade is directly exited. If the system is compatible, it starts to detect whether an upgrade is required. If not, the upgrade is directly exited. If an upgrade is required, it starts to back up the original code and then starts to send the upgrade code in packets to the RAM buffer. The new program code erases the original code in the FLASH and burns the new upgrade code into the FLASH. If a power outage occurs during the upgrade process, the upgrade program is automatically saved and re-uploaded from the interruption point after power is restored until the upgrade program code is completely written to the FLASH storage. If the signal is interrupted during the upgrade process, due to the reasonable timeout period set in the upgrade program, if no data or confirmation signal is received within the predetermined time, the program will automatically attempt to re-establish the connection. The key transmission nodes are recorded during the upgrade process. If an interruption occurs, the transmission can be continued from the nearest successful node until the upgrade is completed. After the upgrade code is completely uploaded, it needs to be verified. After verification, the upgraded program code will start running.

[0052] While embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions, and variations may be made to these embodiments without departing from the principles and spirit of the invention, and that the scope of the invention is defined by the appended claims and their equivalents.

Claims

1. A method for online upgrading of a DSP application based on a serial port, characterized in that: Proceed as follows: Step 1: Design an upgrade program to be the first program to run after the DSP is powered on. It is responsible for determining whether an upgrade is required and executing the upgrade process. Step 2: Design a circuit with power failure detection and integrate it into the power management module of the DPS host; Step 3: Optimize the DSP memory and processor space usage, and divide the upgrade program into multiple small modules, each module is responsible for a part of the function; Step 4: Add power failure detection mechanism and automatic reconnection mechanism to the upgrade program; Step 5: Establish a serial port connection between the DSP and the host, and send an upgrade request to the DPS through the serial port; Step 6: After checking the compatibility of the upgrade program with the current system through DSP, back up the currently running DPS application; Step 7: Start the upgrade, transfer the upgrade program code to the RAM buffer, erase the original code in the FLASH, and write the upgrade code to the FLASH until the online upgrade is completed; Step 8: If a power outage or signal interruption occurs, the upgrade program will immediately save the current upgrade status and continue the upgrade from the breakpoint after power is restored.

2. The method for online upgrading of a DSP application based on a serial port according to claim 1, characterized in that: The upgrade program in step 1 includes a Bootloader program that is first run after power-on and is responsible for determining whether an upgrade is required and is not erased during the upgrade process.

3. The method for online upgrading of a DSP application based on a serial port according to claim 1, characterized in that: In the step 1, the data structures of arrays, linked lists, stacks and queues and the linear search algorithm are used to design the upgrade program.

4. The method for online upgrading of a DSP application based on a serial port according to claim 1, characterized in that: After the upgrade is started in step 7, the upgrade process is also controlled, which is specifically carried out in the following sub-steps: a. Send in batches: Divide the entire upgrade program code into small data packets and send them to the RAM buffer in batches; b. Dynamic buffer management: The RAM buffer is dynamically resized according to the amount of data received in the upgrade data packet; c. Program burning and verification: After receiving the complete upgrade program code, burn it into the DSP's memory and perform verification after burning is completed.

5. The method for online upgrading of a DSP application based on a serial port according to claim 4, characterized in that: The sub-steps also include status feedback during the upgrade process, and real-time feedback of the current status to the upper computer, including upgrade progress, success or failure, error information, etc.

6. The method for online upgrading of a DSP application based on a serial port according to claim 5, characterized in that: The status feedback during the upgrade process also includes providing an alarm mechanism for unrecoverable errors, such as verification failure, and allowing manual intervention.

7. The method for online upgrading of a DSP application based on a serial port according to claim 1, characterized in that: The step 2 also includes writing an interrupt service program into the DPS memory, wherein the interrupt service program is used to automatically save the progress of the current upgrade program after power failure.

8. The method for online upgrading of a DSP application based on a serial port according to claim 1, characterized in that: If a signal interruption occurs in step eight, the upgrade program starts an automatic reconnection mechanism and sets an interruption priority.