STM32 IAP remote upgrading method based on HTTP request

Through the HTTP -based STM32 IAP remote upgrade method, the problem of cumbersome upgrade and low degree of automation in the existing technology has been solved, and the automation remote upgrade and real -time status monitoring of STM32 IAP have improved the safety and efficiency of upgrade.

CN119383180AInactive Publication Date: 2025-01-28天津七一二移动通信股份有限公司
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411977263.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-01-28
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing STM32 IAP upgrade technology has problems such as inconsistent transmission and upgrading file methods, high manual programming work intensity, cumbersome adaptation of different transmission protocols, inability to automatically upgrade, in real-time monitoring of upgrade status and inconvenient verification.

Method used

Using the STM32 IAP remote upgrade method based on the HTTP request, through a unified network communication module and the HTTP protocol, the transmission and verification of the upgraded file, automatically detect the new version and complete the upgrade operation, monitor the upgrade state in real time, and adopt a unified check method. Verify the rationality of the upgrade file.

Benefits of technology

The automation and real -time monitoring of STM32 IAP remote upgrade, reducing the manual workload, unifying the transmission protocol and upgrading process, and improving the safety and efficiency of upgrade.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119383180A_ABST
    Figure CN119383180A_ABST
Patent Text Reader

Abstract

The invention relates to an STM32 IAP remote upgrading method of a basic HTTP request. The STM32 core controller, the ESP8266 network communication module and the far-end server are connected into a whole, after the far-end server receives an upgrading file and an instruction, the upgrading file is transmitted to the ESP8266 network communication module in an HTTP request mode, and remote firmware upgrading of the core controller is carried out. The method can realize the following steps: automatically acquiring the upgrading file, safely and efficiently transmitting the upgrading file remotely, verifying the security of the upgrading file, monitoring the upgrading state in real time, automatically storing historical data, conveniently querying the upgrading historical data, and realizing intelligent remote upgrading according to a unified transmission upgrading scheme.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to an STM32 IAP remote upgrade system, and in particular to an STM32 IAP remote upgrade method based on HTTP request. Background Art

[0002] STM32 IAP (In-Application Programming) is a technology for implementing firmware upgrades on STM32 microcontrollers. It allows users to update or upgrade the firmware on the microcontroller through software without removing or reprogramming the microcontroller. It is an important means of application in the development process. The advancement of IAP technology is of great significance to actual development and upgrades. At present, IAP upgrades are in the primary stage. IAP upgrades are implemented through manual, Bluetooth, WiFi and other technologies. IAP upgrades are completed by maintaining different protocols and designing different software implementation solutions, which do not meet the requirements of consistent communication protocols and standard upgrade methods. According to different protocols and cumbersome software development work, IAP upgrades will bring many inconveniences.

[0003] At present, the STM32 upgrade methods are mainly divided into ISP and IAP. ISP requires manual upgrade through the built-in Bootloder program of STM32, and it is also necessary to control the boot pin level of the core controller to make it enter the Bootloder mode. This method is relatively cumbersome. At this stage, IAP technology needs to write a custom Bootloder program first and complete the specified module protocol through manual, Bluetooth, wifi and other technologies to implement the IAP upgrade method. Nowadays, there are the following problems: 1. The method of implementing IAP transmission upgrade files is not unified, and different intermediate modules need to be adapted to complete the transmission of upgrade files. 2. Due to the different selected transmission modules, the customized programs are also different, and the manual programming work intensity is high. 3. Different transmission protocols need to be adapted, and the work is cumbersome. 4. When there is a new version of the upgrade file, the upgrade operation cannot be automatically performed, and manual cooperation is required, which is not flexible. 5. When upgrading the system, it is not possible to monitor the upgrade status in real time. 6. Verification is inconvenient. Summary of the invention

[0004] In view of the status and shortcomings of the prior art, the present invention provides a STM32 IAP remote upgrade method based on HTTP request. The purpose to be achieved by the present invention is: 1. The STM32 IAP remote upgrade method uses a unified and secure transmission file.

[0005] 2. The STM32 IAP remote upgrade method uses a unified network communication module, so that the IAP operation can be completed using a set of series programs.

[0006] 3. The STM32 IAP remote upgrade method unifies the file transfer protocol and uses the network protocol HTTP to implement the transmission and verification of upgrade files.

[0007] 4. The STM32 IAP remote upgrade method automatically detects the new version upgrade file and automatically completes the IAP upgrade operation.

[0008] 5. During the upgrade process of STM32 IAP remote upgrade method, the status code is automatically returned to the remote server to realize real-time monitoring of the upgrade status.

[0009] 6. The remote server and Bootloder program of the STM32 IAP remote upgrade method use a unified verification method to verify whether the upgrade is reasonable.

[0010] The STM32 IAP remote upgrade method can automatically obtain upgrade files, safely and efficiently transmit upgrade files remotely, verify the security of upgrade files, monitor the upgrade status in real time, automatically save historical data, facilitate query of upgrade historical data, and achieve intelligent remote upgrade according to a unified transmission upgrade solution.

[0011] The technical solution adopted by the present invention to achieve the above-mentioned purpose is: a STM32 IAP remote upgrade method based on HTTP request is: using the STM32 core controller containing the Bootloder program and the App main program to perform upgrade communication with the ESP826 network communication module containing the network request module, the data sampling and processing module, the real-time monitoring module, the serial port driver module, the data storage module, and the voice-controlled alarm module, and communicating with the remote server containing the server core code program, the Mysql database, the front-end page, and the service protection through the network communication module to realize remote upgrade, and the method steps are as follows: Step 1: Configure the network communication module Connect the ESP8266 network communication module to the STM32 core controller, connect the network communication module to the remote server, the STM32 core controller enters IAP mode, and the ESP8266 network communication module sends the upgrade file to the STM32 core controller through the UART interface.

[0012] Step 2: Configure the STM32 core controller The STM32 core controller program is divided into two parts: the Bootloder program and the user App main program. After the STM32 core controller is reset, the Bootloder program starts to execute and receives the upgrade program sent by the ESP8266 network communication module through the UART interface.

[0013] Step 3: Configure the remote server The remote server establishes a stable HTTP connection with the ESP8266 network communication module, and the ESP8266 network communication module enters the IAP remote upgrade process.

[0014] Step 4: Use HTTP protocol for IAP transmission upgrade The remote server and the network communication module establish a connection in real time and start transmitting the new version of the program file using the HTTP protocol.

[0015] Step 5: STM32 core controller firmware upgrade After the STM32 core controller is reset, it checks and updates, receives the upgrade file sent by the ESP8266 network communication module through the UART interface, and writes the upgrade file to the specified location of the FLASH memory of the STM32 core controller.

[0016] Step 6: Verify and restart The remote server verifies the integrity of the upgrade file, restarts the STM32 core controller after successful verification, starts executing the user APP main program according to the STM32 core controller startup sequence, and feeds back the upgrade status to the remote server.

[0017] The IAP remote upgrade process performs the following operations: A1. Connect the STM32 IAP upgrade system device of the basic network http request to the power supply and power on, enable the ESP8266 network communication module, and perform an AT command test after the system device is started. If the test passes successfully, the ESP8266 network communication module is set to the working mode, otherwise it returns to enable the ESP8266 network communication module again.

[0018] A2. Connect the external wireless network access point to the switch through the service set identifier. After the external HTTP network connection is successful, connect the ESP8266 network communication module to the remote server. If the connection to the remote server is successful, establish an HTTP network connection, and the ESP8266 network communication module enters the transparent transmission mode. Otherwise, return to step A1, set the ESP8266 network communication module to the working mode again, and establish an HTTP network connection.

[0019] A3. After the ESP8266 network communication module enters the transparent transmission mode, when the remote server sends an HTTP request to notify the ESP8266 network communication module to perform an upgrade operation, the ESP8266 network communication module connects to the remote server through the network to obtain the upgrade file.

[0020] A4. The STM32 core controller determines whether the upgrade file transfer is successful, establishes a connection with the core controller STM32 through the UART serial port, and completes the IAP upgrade of the core controller through serial port communication.

[0021] A5. During the upgrade process, the ESP8266 network communication module establishes a stable connection with the remote server, monitors and uploads the status of the IAP upgrade process in real time. If the upgrade is successful, the ESP8266 network communication module resumes the working mode and waits for the next upgrade request. Otherwise, it returns an error message and records the log.

[0022] The beneficial effects of the present invention are: 1. The STM32 IAP remote upgrade method has a real-time monitoring effect, without the need to intervene in other platforms or software, and can complete the transmission of the upgrade program safely and efficiently.

[0023] 2. The STM32 IAP remote upgrade method has the effect of automatically completing the IAP upgrade. When the user initiates an upgrade request and transmits the upgrade program file to the remote server, this method can automatically complete the subsequent operations, reducing the manual workload.

[0024] 3. The STM32 IAP remote upgrade method uses a unified network communication module and transmission protocol. IAP upgrade can be achieved based on a set of standard interfaces, reducing the work of writing different transmission protocols.

[0025] 4. The STM32 IAP remote upgrade method monitors the upgrade operation records in real time, allowing users to keep track of status changes during the upgrade process at any time.

[0026] 5. The STM32 IAP remote upgrade method automatically saves historical data, stores it in the database, and can form documents to facilitate users to query historical data. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] Figure 1 It is a flow chart of the steps of the STM32 IAP remote upgrade method of the present invention; Figure 2 It is a block diagram of the system composition of the present invention; Figure 3 for Figure 2 Block diagram of network communication module; Figure 4 This is the IAP remote upgrade flow chart for the network communication module. DETAILED DESCRIPTION

[0028] like Figure 2As shown, the present invention utilizes the STM32 core controller containing the Bootloder program and the App main program to communicate with the ESP826 network communication module containing the network request module, the data sampling and processing module, the real-time monitoring module, the serial port driver module, the data storage module, and the voice-controlled alarm module to perform upgrade communication, and communicates with the remote server containing the server core code program, the Mysql database, the front-end page, and the service protection through the network communication module to realize remote upgrade.

[0029] The STM32 IAP upgrade system for basic network http requests includes the core controller STM32 series microcontroller, network communication module, power auxiliary circuit, network communication protocol, microcontroller core program, remote server, etc. The network communication module uses the ESP8266 microcontroller, a low-cost Wi-Fi module that supports multiple communication protocols, including the Http protocol. The module is connected to the core STM32 controller through the serial port as an IAP upgrade method. The microcontroller core program mainly includes the Bootloder program and the App main program. The Bootloder program is located at the starting position of the Flash memory in the STM32. When the core controller is reset, it will first enter the Bootloder program, which is responsible for completing the acceptance of the upgrade file sent remotely and writing it to a specific location in the Flash memory in the STM32.

[0030] The remote server includes the server core code program, Mysql database, front-end page, service protection, etc.

[0031] like Figure 3 As shown, the network communication module is installed with intelligent detection and upgrade software, which has modules for sending network requests, serial port driver, data sampling and processing, data storage, real-time monitoring and voice control alarm.

[0032] like Figure 1 As shown, the steps of the STM32 IAP remote upgrade method for basic network http request are as follows: Step 1: Configure the network communication module Connect the ESP8266 network communication module to the STM32 core controller, connect the network communication module to the remote server, the STM32 core controller enters IAP mode, and the ESP8266 network communication module sends the upgrade file to the STM32 core controller through the UART interface.

[0033] The ESP8266 network communication module is connected to the STM32 core controller through auxiliary circuits and serial ports, and the power output is guaranteed to be stable. Configure the ESP8266 network communication module to connect to the network, and connect the ESP8266 network communication module to the remote server to receive the upgrade file sent by the remote server. Write code to communicate with the STM32 core controller through the UART interface to enable the client to receive new STM32 upgrade programs from a remote location or remote server. Connect the ESP8266 module to the UART interface (such as USART1) of the STM32 core controller. Make sure that the TX pin is cross-connected with the RX pin, that is, the TX interface of the STM32 core controller is connected to the RX interface of the ESP8266 network communication module, and the RX interface of the STM32 core controller is connected to the TX interface of the ESP8266 to ensure serial communication. In this process, wait for the notification of the STM32 core controller, and when the STM32 core controller enters the IAP mode, start sending the upgrade file to the STM32 core controller through the UART interface.

[0034] Step 2: Configure the STM32 core controller The STM32 core controller program is divided into two parts: the Bootloder program and the user App main program. After the STM32 core controller is reset, the Bootloder program starts to execute and receives the upgrade program sent by the ESP8266 network communication module through the UART interface.

[0035] The STM32 core controller program is divided into two parts: the Bootloder program and the App main program. The Bootloder is a boot program that is responsible for receiving the upgrade program sent by the ESP8266 network communication module through the UART interface after reset. The Bootloder program needs to implement the following functions: Initialize the UART interface.

[0036] Receive and parse the upgrade file header information sent by the ESP8266 network communication module, including file size, checksum, etc.

[0037] Write the upgrade file to the specified area of ​​the Flash memory of the STM32 core controller (non-Bootloder program area).

[0038] Verify the integrity of the upgrade file (for example, using CRC check).

[0039] Upgrade verification, if the upgrade is successful, jump to the entry address of the new user application to execute; otherwise, roll back to the old program or enter recovery mode.

[0040] The App program is an application program written by the user. It starts after the Bootloder program and executes the user's code.

[0041] Step 3: Configure the remote server The remote server establishes a stable HTTP connection with the ESP8266 network communication module, and the ESP8266 network communication module enters the IAP remote upgrade process.

[0042] The main functions of the remote server are to establish a stable HTTP connection with the ESP8266 network communication module, receive the new version of the core controller software uploaded by the user through HTTP requests, send the new version of the software to the ESP8266 network communication module through HTTP requests, verify the integrity of the upgrade program, and ensure the smooth progress of the upgrade.

[0043] Step 4: Use HTTP protocol for IAP transmission upgrade The remote server and the network communication module establish a connection in real time and start transmitting the new version of the program file using the HTTP protocol.

[0044] Use HTTP protocol for IAP transmission upgrade. When the user uploads the new version of the core controller software to the remote server via HTTP, the remote server receives this request and stores the new version of the software, and stores the file version and software details in the database. Parse and verify the integrity of the upgrade program. After successful verification, the remote server actively initiates a connection request, establishes a connection with the ESP8266 network communication module, and starts to transmit the new version of the program file using the HTTP protocol. During the transmission process, the remote server and the ESP8266 network communication module establish a real-time connection so that the remote server can detect whether there is a problem with the transmission upgrade.

[0045] Step 5: STM32 core controller firmware upgrade After the STM32 core controller is reset, it checks and updates, receives the upgrade file sent by the ESP8266 network communication module through the UART interface, and writes the upgrade file to the specified location of the FLASH memory of the STM32 core controller.

[0046] The specific upgrade process of the STM32 core controller firmware upgrade is as follows: First, perform the STM32 core controller reset operation. When the STM32 core controller is reset, the Bootloder program is executed first. Then, the check update operation is performed. The APP application written by the user checks whether an upgrade is required. It mainly verifies whether the current version of the program needs to be updated by receiving notifications from the ESP8266 network communication module or by remotely querying the remote server HTTP request. Then, data reception and writing operations are performed. The Bootloder program receives the upgrade file sent from the ESP8266 network communication module through the UART interface and writes it to the specified location of the FLASH memory of the STM32 core controller.

[0047] Step 6: Verify and restart The remote server verifies the integrity of the upgrade file, restarts the STM32 core controller after successful verification, starts executing the user APP main program according to the STM32 core controller startup sequence, and feeds back the upgrade status to the remote server.

[0048] Finally, verification and restart are required. The remote server and Bootloder program verify the integrity of the upgrade file, and restart the STM32 core controller to run the new user APP program after successful verification. When the Bootloder program upgrade is completed and the integrity is verified, it will jump to the starting address of the new program of the STM32 core controller and start executing the user APP program in the execution order. The network communication module will feedback the upgrade status to the remote server.

[0049] like Figure 4 As shown, the network communication module performs IAP remote upgrade. The IAP remote upgrade process performs the following operations: A1. Connect the STM32 IAP upgrade system device of the basic network http request to the power supply and power on, enable the ESP8266 network communication module, and perform an AT command test after the system device is started. If the test passes successfully, the ESP8266 network communication module is set to the working mode, otherwise it returns to enable the ESP8266 network communication module again.

[0050] A2. Connect the external wireless network access point to the switch through the service set identifier. After the external HTTP network connection is successful, connect the ESP8266 network communication module to the remote server. If the connection to the remote server is successful, establish an HTTP network connection, and the ESP8266 network communication module enters the transparent transmission mode. Otherwise, return to step A1, set the ESP8266 network communication module to the working mode again, and establish an HTTP network connection.

[0051] A3. After the ESP8266 network communication module enters the transparent transmission mode, when the remote server sends an HTTP request to notify the ESP8266 network communication module to perform an upgrade operation, the ESP8266 network communication module connects to the remote server through the network to obtain the upgrade file.

[0052] A4. The STM32 core controller determines whether the upgrade file transfer is successful, establishes a connection with the STM32 core controller through the UART serial port, and completes the IAP upgrade of the core controller through serial port communication.

Claims

1. A STM32 IAP remote upgrade method based on HTTP request, characterized in that: The STM32 core controller containing the Bootloder program and the App main program is used to communicate with the ESP826 network communication module containing the network request module, data sampling and processing module, real-time monitoring module, serial port driver module, data storage module, and voice-controlled alarm module. The network communication module communicates with the remote server containing the server core code program, Mysql database, front-end page, and service protection to achieve remote upgrade. The method steps are as follows: Step 1: Configure the network communication module Connect the ESP8266 network communication module to the STM32 core controller, connect the network communication module to the remote server, the STM32 core controller enters the IAP mode, and the ESP8266 network communication module sends the upgrade file to the STM32 core controller through the UART interface; Step 2: Configure the STM32 core controller The STM32 core controller program is divided into two parts: the Bootloder program and the user App main program. After the STM32 core controller is reset, the Bootloder program starts to execute and receives the upgrade program sent by the ESP8266 network communication module through the UART interface; Step 3: Configure the remote server The remote server establishes a stable HTTP connection with the ESP8266 network communication module, and the ESP8266 network communication module enters the IAP remote upgrade process; Step 4: Use HTTP protocol for IAP transmission upgrade The remote server and the network communication module establish a connection in real time and start transmitting the new version of the program file using the HTTP protocol; Step 5: STM32 core controller firmware upgrade After the STM32 core controller is reset, it checks and updates, receives the upgrade file sent by the ESP8266 network communication module through the UART interface, and writes the upgrade file to the specified location of the FLASH memory of the STM32 core controller; Step 6: Verify and restart The remote server verifies the integrity of the upgrade file, restarts the STM32 core controller after successful verification, starts executing the user APP main program according to the STM32 core controller startup sequence, and feeds back the upgrade status to the remote server.

2. The STM32 IAP remote upgrade method based on HTTP request according to claim 1, characterized in that: The IAP remote upgrade process performs the following operations: A1. Connect the STM32 IAP upgrade system device of the basic network http request to the power supply and power on, enable the ESP8266 network communication module, and perform an AT command test after the system device is started. If the test passes successfully, the ESP8266 network communication module is set to the working mode, otherwise it returns to enable the ESP8266 network communication module again; A2. Connect the external wireless network access point to the switch through the service set identifier. After the external HTTP network connection is successful, connect the ESP8266 network communication module to the remote server. If the connection to the remote server is successful, establish an HTTP network connection, and the ESP8266 network communication module enters the transparent transmission mode. Otherwise, return to step A1, set the ESP8266 network communication module to the working mode again, and establish an HTTP network connection. A3. After the ESP8266 network communication module enters the transparent transmission mode, when the remote server sends an HTTP request to notify the ESP8266 network communication module to perform an upgrade operation, the ESP8266 network communication module connects to the remote server through the network to obtain the upgrade file; A4. The STM32 core controller determines whether the upgrade file transfer is successful, establishes a connection with the core controller STM32 through the UART serial port, and completes the IAP upgrade of the core controller through serial port communication; A5. During the upgrade process, the ESP8266 network communication module establishes a stable connection with the remote server, monitors and uploads the status of the IAP upgrade process in real time. If the upgrade is successful, the ESP8266 network communication module resumes the working mode and waits for the next upgrade request. Otherwise, it returns an error message and records the log.

Citation Information

Patent Citations

  • STM32-based Internet of Things reconnaissance system and control method thereof

    CN114185284A