Simon Schmidt 96506c8681 initial commit | 3 years ago | |
---|---|---|
.vscode | 3 years ago | |
include | 3 years ago | |
lib | 3 years ago | |
src | 3 years ago | |
test | 3 years ago | |
.gitignore | 3 years ago | |
README.md | 3 years ago | |
debug_ser.py | 3 years ago | |
ota_flash.png | 3 years ago | |
platformio.ini | 3 years ago |
start with ArduinoOTA basic example
void setup() {
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
while (WiFi.waitForConnectResult() != WL_CONNECTED) {
delay(5000);
ESP.restart(); /* reload application */
}
/* register callbacks for OTA events */
ArduinoOTA.onStart([]() { /* ... */ });
ArduinoOTA.onEnd ([]() { /* ... */ });
ArduinoOTA.onError([](ota_error_t error) { /* ... */ });
/* setup OTA for listening on default UDP-port 8266 */
ArduinoOTA.begin();
}
void loop() {
/* check for incoming OTA update */
ArduinoOTA.handle();
}
modify platformio.ini
; example platformio.ini
[env:esp01_1m]
platform = espressif8266
board = esp01_1m
framework = arduino
upload_port = COM6
monitor_speed = 74880
open serial port to esp8266 and reset
# example output after reset
ets Jan 8 2013,rst cause:2, boot mode:(3,7)
# load binary
load 0x4010f000, len 3460, room 16
tail 4
chksum 0xcc
load 0x3fff20b8, len 40, room 4
tail 4
chksum 0xc9
csum 0xc9
v00040b70
~ld
Boot Messages and Modes, see also detailed documentation
at startup the ESP prints out the current boot mode example:
rst cause:2, boot mode:(3,6)
rst cause | Description |
---|---|
0 | unknown |
1 | normal boot |
2 | reset pin |
3 | software reset |
4 | watchdog reset |
boot mode:(x,y)
x | GPIO15 | GPIO0 | GPIO2 | Mode |
---|---|---|---|---|
1 | 0V | 0V | 3.3V | Uart |
3 | 0V | 3.3V | 3.3V | Flash |
note: y represents the position of the boot file
Upload compiled binary via uart
note: close serial port
$ pio run -t upload
# or use upload button in vscode
open serial port to esp8266 and check Wi-Fi connection
monitor output:
Ready
IP address: 192.168.10.108
modify platformio.ini accordingly
; new platformio.ini for OTA
[env:esp01_1m]
platform = espressif8266
board = esp01_1m
framework = arduino
upload_protocol = espota
upload_port = 192.168.10.108
monitor_speed = 74880
Process of updating
code for updating