The STM32 Microcontroller Bootloader is a robust and versatile firmware solution designed to simplify the software update process for STM32 microcontrollers. It offers support for both USART and CAN communication protocols, providing flexibility to accommodate a wide range of hardware configurations and use cases.
In addition, this project includes a Qt C++ Graphical User Interface (GUI) application that enhances the bootloader's functionality. This GUI facilates the process of flashing images to the STM32 microcontroller, making the software update procedure even more user-friendly.
- Features
- Flashing process of CAN Bootloader
- Getting start with CAN Bootloader
- Flashing process of USART Bootloader
- Getting start with USART Bootloader
-
Dual Communication Modes: Choose between USART and CAN communication protocols based on your hardware configuration, providing adaptability for different project requirements
-
Effortless Hex File Transfer: The GUI application, developed using Qt C++, lets you to effortlessly parse and transmit hex files to the bootloader, streamlining software updates.
- GUI communicates with board that converts USART messages to CAN.
- On flash there are flag indicates whether application-image is valid or not.
- If image is valid it waits for x seconds for any CAN-message that indicates about update in flash, where x is a configured time in "BL_Config.h" file.
- If image isn't valid it waits infinite for any CAN-message that indicates about update in flash.
- GUI sends command to erase image from flash.
- GUI will send new application-image.
- GUI will raise valid image flag and jump to application.
- Clone the repository to your development environment
git clone github.com/AhmedAbd-ElFattah/STM32-Custom-Bootloader
- Configure Bootloader-type to CAN by editing "BL_Config.h" file and define " BOOTLOADER_TYPE " with " USART_BOOTLOADER " value.
- Assign appropriate configiration of CAN connection, baudrate and so on if needed.
- Flash STM32-Custom-Bootloader to your microcontroller. (STM32-Custom-Bootloader project has files for STM32CubeIDE project on STM32F407VG microsontroller, so you can import it into your working space).
- Build GUI and run it.
- Press on "Refresh" button on gui.
- Select yout board from combo-box
- Click on "Connect" button.
- Click on "Browse Hex File" and select your hex file for application.
- Change communicaiton to CAN.
- Enter device id number.
- Click on "Flash Image"
- On flash there are two flags first one indicates whether application-image is valid or not, second one indicates application-image needs to be updated or not.
- GUI sends to application image that there is an avialable update.
- Application-image raises update image flag, then it resets microcontroller.
- After reset bootloader reads update flag & valid image flag.
- When bootloader reads update flag it enters update mode and GUI will do the following
- GUI will connect to bootloader
- GUI sends command to erase application image from flash.
- GUI will send new application-image.
- GUI will raise valid image flag and jump to application.
- After any reset of microcontroller, it will find that image if valid and there isn't update flag raised so it will jump to application
- Clone the repository to your development environment
git clone github.com/AhmedAbd-ElFattah/STM32-Custom-Bootloader
- Configure Bootloader-type to USART by editing "BL_Config.h" file and define " BOOTLOADER_TYPE " with " USART_BOOTLOADER " value.
- Assign appropriate configiration of USART connection, baudrate and so on if needed and the same for DMA.
- Flash STM32-Custom-Bootloader to your microcontroller. (STM32-Custom-Bootloader project has files for STM32CubeIDE project on STM32F407VG microsontroller, so you can import it into your working space).
- Build GUI and run it.
- Press on "Refresh" button on gui.
- Select yout board from combo-box
- Click on "Connect" button
- Click on "Browse Hex File" and select your hex file for application.
- Click on "Flash Image"
Note that application image of application in USART must call "BL_Init_v()" function at initializaion, and linker script must be configured with the same starting address of flash which is configured in "BL_Config.h" file