Error correction type serial communication DSP (Digital Signal Processor) online upgrading system and method
By designing an error-correctable serial communication protocol in the DSP online upgrade system, online baud rate adjustment and data frame retransmission are realized, which solves the problem of long upgrade time caused by fixed baud rate and programming errors, improves upgrade efficiency and success rate.
Patent Information
- Application Number
- CN202411564426.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-05
- Publication Date
- 2025-01-24
- Estimated Expiration
- 2044-11-05
AI Technical Summary
In the online upgrade process of DSP of embedded devices, the fixed baud rate and write errors need to be powered off and re-coded, resulting in a long upgrade time and low efficiency.
Design an error-correctable DSP online upgrade system for serial port communication. By modifying the baud rate online and having a retransmission function, the transmission success probability is improved, and the program can be reprogrammed from the wrong location when programming errors occur.
Improving the reliability and upgrade rate of data transmission, and reducing the time and manual operation required for upgrading.
Smart Images

Figure CN119363729A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of DSP online upgrade application program of serial communication technology, and in particular relates to a DSP online upgrade system and method of serial communication with error correction. Background Art
[0002] With the continuous development of electronic technology and the changes in user needs, it is necessary to frequently upgrade and update the application programs of embedded devices. Usually, when the conditions are convenient and the number of devices to be upgraded is small, the program can be burned through the DSP's JTAG emulator. However, in reality, there are often many embedded devices, and the board to be upgraded has been tightly inserted into the device, and it is not possible to connect the JTAG emulator. Therefore, nowadays, the serial port is usually used to send the application target code for online upgrade. This method does not require the removal of the device casing, which improves the convenience of upgrading. However, the commonly used method now uses a fixed baud rate, and if an error occurs in burning FLASH during the process, the power must be turned off and the code must be burned again. In this way, when the line or electromagnetic environment is relatively bad during the upgrade, it usually takes several repeated operations to successfully upgrade, wasting a lot of time. Summary of the invention
[0003] 1. Technical issues to be resolved
[0004] The technical problem to be solved by the present invention is to design a DSP program online upgrade system and method with error-correctable serial communication to improve the probability of successful transmission and reduce the upgrade time.
[0005] (II) Technical solution
[0006] In order to solve the above technical problems, the present invention provides a DSP online upgrade system with error-correctable serial communication, the system comprising a host computer and a DSP device;
[0007] An online upgrade module is run on the host computer. The online upgrade module is used to send the application to be upgraded to the DSP device through the serial port according to the specified protocol. The online upgrade module parses the application to be upgraded, splits a file into multiple data frames, and adds the fields of frame header, frame footer, frame sequence number, frame length, frame check, frame sector number, and frame address to each data frame, and then sends the data frame to the DSP device through the serial port.
[0008] A running monitoring module is installed on the DSP device, which is used to jump to the application or upgrade the application. The running monitoring module first attempts to pair with the host computer. If there is no pairing request, it means that there is no need to upgrade the application, and then jumps to the existing application entry in the DSP device. If there is a pairing request and the pairing is successful, the baud rate is set and the application is burned and verified according to the received serial port data to realize the application upgrade.
[0009] The invention also provides a DSP online upgrading method realized by utilizing the system.
[0010] The invention also provides a serial port communication method implemented based on the system.
[0011] The invention also provides a serial port communication method implemented based on the system.
[0012] The invention also provides a serial communication system implemented based on the system.
[0013] The invention also provides a serial communication system implemented based on the system.
[0014] (III) Beneficial effects
[0015] The advantages of the present invention compared with the prior art are:
[0016] 1. This method can modify the baud rate online by designing the serial port protocol. When the cable quality is poor, the probability of successful transmission can be increased by lowering the baud rate.
[0017] 2. This method has a retransmission function. When the DSP device does not receive a certain packet of data, the packet of data can be repeated; or when a burning error occurs during the upgrade of the DSP device, the burning starts again from the data packet where the error occurs, thus reducing the time required for the upgrade. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 It is a schematic diagram of the system structure of the present invention;
[0019] Figure 2 It is a flow chart of the DSP device monitoring program designed by the present invention;
[0020] Figure 3 It is a program flow chart of the host computer designed by the present invention. DETAILED DESCRIPTION
[0021] In order to make the purpose, content and advantages of the present invention more clear, the specific implementation methods of the present invention are further described in detail below in conjunction with the drawings and examples.
[0022] In order to solve the problem that the JTAG emulator needs to be connected when upgrading embedded devices, an online upgrade method of sending application data packets through a serial port is usually used. However, the commonly used method now uses a fixed baud rate, and if an error occurs in burning FLASH during the process, the power must be turned off and the code must be re-written. In this way, when the line quality is poor or the electromagnetic environment is relatively harsh during the upgrade, it is usually necessary to repeat the operation several times before the upgrade is successful, wasting a lot of time. Therefore, the present invention proposes a DSP online upgrade system and method for error-correctable serial communication. The main innovation of this method is that a serial port protocol is designed, the baud rate can be changed online, and the reliability of data transmission is improved when the line quality is not good. And when a data frame fails to burn FLASH, the application data frame can be resent from the sector where the burning failed, avoiding the process of starting from the beginning after powering off, and reducing the time required for the upgrade.
[0023] refer to Figure 1 , Figure 2 , Figure 3 The present invention provides a DSP online upgrade system with error-correctable serial communication, including a host computer and a DSP device, and implements DSP online upgrade based on the system.
[0024] The host computer mainly runs the online upgrade module, which sends the application to be upgraded to the DSP device through the serial port according to the specified protocol; the online upgrade module parses the application to be upgraded, splits a large file into multiple data frames, and adds the fields of frame header, frame footer, frame sequence number, frame length, frame check, frame sector number, and frame address to each data frame, and then sends the data frame to the DSP device through the serial port.
[0025] The DSP device mainly runs the monitoring module, which is used to jump to the application or upgrade the application. Among them, the running monitoring module first tries to pair with the host computer. If there is no pairing request, it means that there is no need to upgrade the application, and then jumps to the existing application entry in the DSP device. If there is a pairing request and the pairing is successful, the baud rate is set and the application is burned and verified according to the received serial port data to realize the application upgrade.
[0026] The specific implementation steps of the monitoring module of the DSP device are as follows:
[0027] The monitoring module of the DSP device is powered on;
[0028] Receive serial port data;
[0029] Determine whether the pairing request frame is received. If the pairing request frame from the host computer is not received within 5 seconds, jump to the existing application entry function address in the DSP device; if the pairing request frame from the host computer is received within 5 seconds and the pairing is successful, send a pairing success frame to the online upgrade module of the host computer, and then execute the next step;
[0030] Determine whether a baud rate change frame is received. If so, reset the serial port baud rate. Otherwise, proceed to the next step.
[0031] Determine whether a sector erase command frame is received. If a sector erase command frame is received, parse the sector number to be erased in the sector erase command frame, and perform an erase operation on the corresponding sector. After the erase is successful, send a sector erase success frame. If the sector erase command frame is not received, execute the next step.
[0032] Determine whether the application data frame is received. If the application data frame is received, calculate the frame check according to the frame protocol; the criterion for calculating the frame check is to take the sum of the data of other fields of the data frame except the frame tail and frame check, and then take the lower eight bits, compare the calculation result with the value of the frame check field in the data frame to see if they are consistent, as the basis for whether the reception is correct. If the application data frame is received correctly, parse the sector and the burning address to which the data frame belongs, and then write it into the FLASH and check it. If writing the FLASH fails, send a data packet burning failure frame. If writing the FLASH succeeds, send a data packet burning success frame. If the application data frame is not received correctly, execute the next step; if the application data frame is not received, execute the next step;
[0033] Determine whether the burning end command frame is received. If the burning end command frame is received, send the data packet burning completion frame, otherwise return to receive serial port data again.
[0034] The specific implementation steps of the online upgrade module of the host computer are as follows:
[0035] 1) Initialize the serial port, set the initial value of i to 1, and send a code request frame to the operation monitoring module of the DSP device;
[0036] 2) Determine whether a pairing success frame is received. If so, proceed to the next step; otherwise, return and resend the pairing request frame;
[0037] 3) If there is a need to change the baud rate, a baud rate change frame is sent to the operation monitoring module;
[0038] 4) Read the hex file of the application to be upgraded, read 1024 valid bytes at a time, if it is less than 1024 bytes, read the remaining bytes until all the data of the application are parsed, and add the frame header, frame tail, frame sequence number i, frame sector number, burning start address, frame check and other fields to form the data frame of the application, and send the data frame of the application to the operation monitoring module of the DSP device through the serial port;
[0039] 5) Determine whether a data packet burning success frame is received. If no data packet burning success frame is received within 1 second, repeatedly send the data frame of the application to the running monitoring module. If no data packet burning success frame is received after 3 retransmissions, it is prompted that the application upgrade has failed, and step 6) is executed; if a data packet burning success frame is received within 1 second, determine whether the hex file of the application has been parsed. If so, it is considered that all data frames of the application have been sent at this time, and jump to step 7); otherwise, i is increased by 1, and return to step 4) to continue reading the hex file of the application;
[0040] 6) Determine whether a data packet programming failure frame is received. If a data packet programming failure frame is received, obtain the sector number of the programming error, send a sector erase command frame of the corresponding sector, and after receiving a sector erase success frame, obtain the frame sequence number of the first data frame belonging to the corresponding sector, and resend the application data frame from this frame sequence number until all the application data frames are sent; if no sector erase success frame is received within more than 1s, repeat the sector erase command frame. If no sector erase success frame is received after resending 3 times, it indicates that the application upgrade has failed;
[0041] 7) Send the programming end command frame.
[0042] The specific composition of the above frames (different types of data frames contain frame numbers or sector numbers) is shown in Table 1, where datalen represents the total number of bytes in this frame.
[0043] Table 1
[0044]
[0045]
[0046] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the technical principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A DSP online upgrade system with error-correctable serial communication, characterized in that: The system includes a host computer and DSP equipment; An online upgrade module is run on the host computer. The online upgrade module is used to send the application to be upgraded to the DSP device through the serial port according to the specified protocol. The online upgrade module parses the application to be upgraded, splits a file into multiple data frames, and adds the fields of frame header, frame footer, frame sequence number, frame length, frame check, frame sector number, and frame address to each data frame, and then sends the data frame to the DSP device through the serial port. A running monitoring module is installed on the DSP device, which is used to jump to the application or upgrade the application. The running monitoring module first attempts to pair with the host computer. If there is no pairing request, it means that there is no need to upgrade the application, and then jumps to the existing application entry in the DSP device. If there is a pairing request and the pairing is successful, the baud rate is set and the application is burned and verified according to the received serial port data to realize the application upgrade.
2. The system according to claim 1, characterized in that The specific implementation steps of the monitoring module of the DSP device are as follows: The monitoring module is powered on; Receive serial port data; Determine whether the pairing request frame is received. If the pairing request frame from the host computer is not received within 5 seconds, jump to the existing application entry function address in the DSP device; if the pairing request frame from the host computer is received within 5 seconds and the pairing is successful, send a pairing success frame to the online upgrade module of the host computer, and then execute the next step; Determine whether a baud rate change frame is received. If so, reset the serial port baud rate. Otherwise, proceed to the next step. Determine whether a sector erase command frame is received. If a sector erase command frame is received, parse the sector number to be erased in the sector erase command frame, and perform an erase operation on the corresponding sector. After the erase is successful, send a sector erase success frame. If the sector erase command frame is not received, execute the next step. Determine whether an application data frame is received, and if so, calculate the frame check according to the frame protocol; The criterion for calculating the frame check is to take the sum of the data in other fields of the data frame except the frame tail and frame check, and then take the lower eight bits, compare the calculation result with the value of the frame check field in the data frame to see if they are consistent, as the basis for whether the reception is correct. If the data frame of the application is received correctly, the sector and the burning address to which the data frame belongs are parsed, and then written into the FLASH and checked. If writing the FLASH fails, a data packet burning failure frame is sent. If writing the FLASH succeeds, a data packet burning success frame is sent. If the data frame of the application is not received correctly, execute the next step; if the application data frame is not received, execute the next step; Determine whether the burning end command frame is received. If the burning end command frame is received, send the data packet burning completion frame, otherwise return to receive serial port data again.
3. The system according to claim 2, characterized in that The specific implementation steps of the online upgrade module of the host computer are as follows: 1) Initialize the serial port, set the initial value of i to 1, and send a code request frame to the operation monitoring module of the DSP device; 2) Determine whether a pairing success frame is received. If so, proceed to the next step; otherwise, return and resend the pairing request frame; 3) If there is a need to change the baud rate, a baud rate change frame is sent to the operation monitoring module; 4) Read the hex file of the application to be upgraded, read 1024 valid bytes at a time, if it is less than 1024 bytes, read the remaining bytes until all the data of the application are parsed, and add the frame header, frame tail, frame sequence number i, frame sector number, burning start address, frame check and other fields to form the data frame of the application, and send the data frame of the application to the operation monitoring module of the DSP device through the serial port; 5) Determine whether a data packet burning success frame is received. If no data packet burning success frame is received within 1 second, repeatedly send the data frame of the application to the running monitoring module. If no data packet burning success frame is received after 3 retransmissions, it is prompted that the application upgrade has failed, and step 6) is executed; if a data packet burning success frame is received within 1 second, determine whether the hex file of the application has been parsed. If so, it is considered that all data frames of the application have been sent at this time, and jump to step 7); otherwise, i is increased by 1, and return to step 4) to continue reading the hex file of the application; 6) Determine whether a data packet programming failure frame is received. If a data packet programming failure frame is received, obtain the sector number of the programming error, send a sector erase command frame of the corresponding sector, and after receiving a sector erase success frame, obtain the frame sequence number of the first data frame belonging to the corresponding sector, and resend the data frame of the application from this frame sequence number until all the data frames of the application are sent; If the sector erase success frame is not received within 1s, the sector erase command frame is sent repeatedly. If the sector erase success frame is still not received after 3 retransmissions, it indicates that the application upgrade has failed. 7) Send the programming end command frame.
4. A DSP online upgrade method implemented by using the system as claimed in claim 1, 2 or 3.
5. The method according to claim 4, characterized in that The composition of each frame is as follows:
6. The method according to claim 4, characterized in that Each frame uses a double frame header.
7. A serial communication method implemented based on the system as claimed in claim 1, 2 or 3.
8. A serial communication method implemented based on the system as claimed in claim 4, 5 or 6.
9. A serial communication system implemented based on the system implementation as claimed in claim 1, 2 or 3.
10. A serial communication system implemented based on the system implementation as claimed in claim 4, 5 or 6.
Citation Information
Patent Citations
FLASH memorizer long-distance on-line upgrade method based on field programmable gate array (FPGA)
CN103136028A
Quick and stable serial port software upgrading method
CN107885523A
Fuel cell inspection device program programming method based on CAN communication
CN116909587A
Firmware upgrade method and system, upper computer and optical module
WO2015051647A1