I would like to use OTA on an ESP32-S2-Saola I have read some guides but I have not found a guide for my board I would like someone to tell me exactly how to do it, for example:
- Where can I find the firmware with the right partitions?
- How do I load it on ESP32-S2-Saola
- And then how does it work? Does ESP32 always listen? If so, how?
I can’t figure out how to do it.
ESP32S2 support isn’t even yet mainstream in PlatformIO yet, only user-written platform modifications are available that allow this. See Support for the latest Arduino v2.0 · Issue #619 · platformio/platform-espressif32 · GitHub.
As already discussed in Fatal error: Adafruit_NeoPixel.h: No such file - #2 by maxgerhardt for ESP32-C3 chips, you can use for a ESP32-S2 chip…
; global settings
platform = https://github.com/Jason2866/platform-espressif32.git
board = esp32-s2-saola-1
framework = arduino
platform_packages = framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git
; environment with no modifications for USB-based upload
; environment for OTA upload
upload_protocol = espota
; use IP here or <mDNS_NAME>.local
upload_port = 192.168.0.255
This will give you two environments, one for USB-serial upload and one for OTA upload.
src/main.cpp from arduino-esp32/BasicOTA.ino at master · espressif/arduino-esp32 · GitHub.
You need to select a partition table that has an app0 and app1 partition at least. This is already explained in Espressif 32 — PlatformIO latest documentation. However, since the default table is
default.csv which has the needed partitions, no modification is needed. Unless you want to actively choose a different partition with bigger possible application sizes of course, like
This is already explained in Espressif 32 — PlatformIO latest documentation. Initially of course via the USB cable, then after an appropriate sketch is upload that allows OTA uplaod (like the one shown above), via OTA.
This is inferrable by looking at the library code arduino-esp32/libraries/ArduinoOTA at master · espressif/arduino-esp32 · GitHub.
As you can read in
it opens a UDP port which is always listened for as long as the device has internet connectivity. It also advertisies its hostname using MDNS.
Okay, tomorrow I’ll try to get to work.
My device will have a GSM connection, how do I know the remote IP address?
ArduinoOTA is intended for WiFiUDP, not an external GSM modem that e.g. may be connected via UART. You will have to modify the library to use a socket created by your GSM modem.
Mh ok, I have to figure out how to do it. Actually I have an engineer who works Part-Time for me and to speed up the time I document myself so he can concentrate on writing code. So my problem is that I have developed a Hardware which has Wi-Fi, Eth POE and GSM. I should create an “object” to select the connection type according to the customer’s needs, but I don’t know how.
Can you confirm that standard WiFi OTA works per instructions above? Then the topic can be closed.
I haven’t tried it yet. I keep you updated.
I confirm that it works!