This project enables remote firmware updates (FOTA) using ESP8266, STM32F103, and Google Firebase. The ESP8266 connects to WiFi, downloads the bootloader and firmware code, and communicates with the STM32.
This project facilitates firmware updates over-the-air (FOTA) for an STM32F103 microcontroller using an ESP8266 and Google Firebase. Key components include WiFi connectivity, Firebase authentication, and MQTT communication.
This section provides an overview of the primary functions and interfaces used in this project.
- Function:
callback(char* topic, byte* payload, unsigned int length)
- Purpose: Handles incoming MQTT messages.
- Hint: Parses MQTT topic and payload to trigger actions based on received messages.
- Function:
fcsDownloadCallback(FCS_DownloadStatusInfo info)
- Purpose: Callback function for Firebase Storage downloads.
- Hint: Provides status updates during file downloads from Firebase Storage.
- Function:
Bootloader_Jump_To_Application()
- Purpose: Jumps to the main application in the STM32.
- Hint: Resets and initiates the main application.
This section highlights key components and functionalities in the code.
- Code:
Firebase.begin(&config, &auth);
- Explanation: Initializes Firebase with authentication credentials and configuration.
- Code:
client.subscribe("/FOTA/");
- Explanation: Subscribes to the MQTT topic for receiving commands.
- Code:
if (!Firebase.Storage.download(&fbdo, STORAGE_BUCKET_ID, "TestBootloader.bin", "/updat.bin", mem_storage_type_flash, fcsDownloadCallback))
- Explanation: Initiates the firmware download process from Firebase Storage.
- Code:
Bootloader_Erase_Flash(BL_HostBuff);
- Explanation: Initiates erasing of flash memory in response to a command from the host.
- Code:
Bootloader_Memory_Write(BL_HostBuff);
- Explanation: Writes data to flash memory, including address verification and CRC checks.
Here's how to flash the code and clear it:
- GUI.