This project is implemented to program BlueBill Board (STM32 Micro-controller)
over the air using a website with PHP
and NodeMCU board to get the code
from the internet and sending it to STM to write it into the Flash Memory
using the Bootloader flashed on the first 9 kB of Flash Memory.
project video (click here)
- STM32F103 BlueBill Board
- NodeMCU V1.0 Board
nodemcu / Esp8266 | STM32F103 |
---|---|
TX | PA10 |
RX | PA9 |
GND | GND |
1. Website
The website is responsible for letting the user upload a .hex file to Server to be ready to be received by NodeMCU.
The website only allows .hex
to be uploaded.
- TODO: before compiler the project remember to change the flash size to:
FLASH (rx) : ORIGIN = 0x08002400, LENGTH = 55K
.
Once a new .hex
file is uploaded to Server, and reset STM , NodeMCU reads file content line by line to try sending it STM through UART.
On reset, STM Bootloader waits for 5 seconds if there is any code received from NodeMCU. If any, it will first erase the application area and then flash the code received. Once it finished, it will run the application code after 5 seconds. If no code received from NodeMCU for 5 seconds, it will jump to latest flashed application code.
- NOTE:
- you need to edit SSID & PASSWORD (and if needed IPserver & Website) in
main.h
file. - I used local PHP Server because the free online server take much time to flash the code.
- size of Bootloader changed in
FPEC_config.h
file.
- you need to edit SSID & PASSWORD (and if needed IPserver & Website) in
AT
>>> TEST AT.ATE0
>>> STOP ECHO.AT RST
>>> SOFTWARE RESET.AT CWMODE=1
>>> SET STATION MODE.AT CWJAP="SSID","PASSWORD"
>>> CONNECT TO WIFI (set SSID & PASSWORD).AT CIPSTART="TCP","serverIP",80
>>> (replace serverIP with the website ip ) to start connect on server ex:162.253.155.226
).AT CIPSEND=numOfBits 1
>>> send data length (replace numOfBits with number of http link bits withGET
word ).GET http://iot-arm.freevar.com/start_flash.php?config=ok
>>> put link of website.- Rebeat again from line number
7
of"AT CIPSTART"
because connection will closed after receive data.
- NOTE: you receive data as form:
IPD,LengthOfData:content....CLOSED
.