There is no problem running the httpUpdata sample using ESP32 -S, and OTA can succeed.
When I changed the chip to ESP32S2, I did the corresponding configuration, compile and burn no problem, when in ESP32S2
Esp32s2 Run httpUpdata Example Serial port error:
E (11914) esp_image: image at 0x10000 has invalid magic byte (nothing flashed here?)
E (11805) esp_image: image at 0x10000 has invalid magic byte (nothing flashed here?)
[ 25154][E][HTTPUpdate.cpp:422] runUpdate(): Update.end failed! (Flash Read Failed)
[ 25155][E][HTTPUpdate.cpp:348] handleUpdate(): Update failed
HTTP_UPDATE_FAILED Error (3): Update error: Flash Read Failed
E (28722) esp_image: image at 0x10000 has invalid magic byte (nothing flashed here?)
[ 42638][E][HTTPUpdate.cpp:422] runUpdate(): Update.end failed! (Flash Read Failed)
[ 42639][E][HTTPUpdate.cpp:348] handleUpdate(): Update failed
Without the exact project files you’re working with, this is hard to reproduce.
#include <Arduino.h>
#include <WiFi.h>
#include <WiFiMulti.h>
#include <HTTPClient.h>
#include <HTTPUpdate.h>
WiFiMulti WiFiMulti;
static void OTA(void * pointer){
Serial.println("OTA...");
while(1){
// wait for WiFi connection
if ((WiFi.status() == WL_CONNECTED)) {
WiFiClient client;
// The line below is optional. It can be used to blink the LED on the board during flashing
// The LED will be on during download of one buffer of data from the network. The LED will
// be off during writing that buffer to flash
// On a good connection the LED should flash regularly. On a bad connection the LED will be
// on much longer than it will be off. Other pins than LED_BUILTIN may be used. The second
// value is used to put the LED on. If the LED is on with HIGH, that value should be passed
httpUpdate.setLedPin(15, LOW);
// t_httpUpdate_return ret = httpUpdate.update(client, "http://server/file.bin");
// Or:
t_httpUpdate_return ret = httpUpdate.update(client, "192.168.31.253", 8070, "/firmware.bin");
switch (ret) {
case HTTP_UPDATE_FAILED:
Serial.printf("HTTP_UPDATE_FAILED Error (%d): %s\n", httpUpdate.getLastError(), httpUpdate.getLastErrorString().c_str());
break;
case HTTP_UPDATE_NO_UPDATES:
Serial.println("HTTP_UPDATE_NO_UPDATES");
break;
case HTTP_UPDATE_OK:
Serial.println("HTTP_UPDATE_OK");
break;
}
}
}
}
static void blink(void * pointer){
Serial.println("blink...");
while (1){
digitalWrite(16,HIGH);
delay(25);
digitalWrite(16,LOW);
delay(25);
}
}
void setup() {
Serial.begin(115200);
// Serial.setDebugOutput(true);
pinMode(16,OUTPUT);
Serial.println();
Serial.println();
Serial.println();
for (uint8_t t = 4; t > 0; t--) {
Serial.printf("[SETUP] WAIT %d...\n", t);
Serial.flush();
delay(1000);
}
WiFi.mode(WIFI_STA);
WiFi.begin("Xiaomi_RBT", "159753tree");
xTaskCreateUniversal(OTA, "OTA", 8192, NULL, 1, NULL, CONFIG_ARDUINO_RUNNING_CORE);
xTaskCreateUniversal(blink, "blink", 8192, NULL, 1, NULL, CONFIG_ARDUINO_RUNNING_CORE);
}
void loop() {
}
This is my OTA test code.
[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
board_build.mcu = esp32s2
platform_packages =
framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#2.0.0-alpha1
This is my configuration information.
Thank you for your reply.
I don’t think you should be using Arduino-ESP32 v2.0.0 yet when Support for the latest Arduino v2.0 · Issue #619 · platformio/platform-espressif32 · GitHub is still open.
Or did this work before in PlatformIO?