ESP32-Cam OTA upload problem

Hi

I am quite new on PlatformIO and I try to upload through OTA to ESP32-CAM AI Thinker but it failed.
The invitation was sended but the uploading stops after 3%. For information, it worked fine on IDE Arduino.

18:06:02 [DEBUG]: Options: {‘esp_ip’: ‘192.168.1.43’, ‘host_ip’: ‘0.0.0.0’, ‘esp_port’: 3232, ‘host_port’: 32433, ‘auth’: ‘’, ‘image’: ‘.pio/build/esp32cam/firmware.bin’, ‘spiffs’: False, ‘debug’: True, ‘progress’: True, ‘timeout’: 10}
18:06:02 [INFO]: Starting on 0.0.0.0:32433
18:06:02 [INFO]: Upload size: 1046352
Sending invitation to 192.168.1.43
18:06:02 [INFO]: Waiting for device…

Uploading: [ ] 0%
Uploading: [ ] 0%
Uploading: [ ] 0%
Uploading: [ ] 0%
Uploading: [ ] 0%
Uploading: [ ] 0%
Uploading: [ ] 0%
Uploading: [ ] 0%
Uploading: [ ] 0%
Uploading: [= ] 0%
Uploading: [= ] 0%
Uploading: [= ] 1%
Uploading: [= ] 1%
Uploading: [= ] 1%
Uploading: [= ] 1%
Uploading: [= ] 1%
Uploading: [= ] 1%
Uploading: [= ] 1%
Uploading: [= ] 1%
Uploading: [= ] 1%
Uploading: [= ] 1%
Uploading: [= ] 2%
Uploading: [= ] 2%
Uploading: [= ] 2%
Uploading: [= ] 2%
Uploading: [= ] 2%
Uploading: [== ] 2%
Uploading: [== ] 2%
Uploading: [== ] 2%
Uploading: [== ] 2%
Uploading: [== ] 2%
Uploading: [== ] 3%
Uploading: [== ] 3%
Uploading: [== ] 3%
Uploading: [== ] 3%
Uploading: [== ] 3%
Uploading: [== ] 3%
Uploading: [== ] 3%
Uploading: [== ] 3%
18:06:07 [ERROR]: Error Uploading
*** [upload] Error 1

and my platformio.ini

[env:esp32cam]
platform = espressif32
board = esp32cam
framework = arduino
lib_deps = GitHub - tzapu/WiFiManager: ESP8266 WiFi Connection manager with web captive portal
upload_port = 192.168.1.43
upload_protocol = espota
monitor_speed = 115200

Have you an idea to solve the problem?

Thanks

Please set the debug to level to verbose (docs), reflash the firmware normally and re-execute the OTA upgrade while looking at the serial output of the device. What does the device output?

Thanks for your response, I will try this in the few days and keep you informed

Hi
Here the serial output:

Start updating sketch
Error[3]: Receive Failed

and upload error:

11:45:21 [INFO]: Waiting for device…

Uploading: [ ] 0%
Uploading: [ ] 0%
Uploading: [ ] 0%
Uploading: [ ] 0%
Uploading: [ ] 0%
Uploading: [ ] 0%
Uploading: [ ] 0%
Uploading: [ ] 0%
Uploading: [ ] 0%
Uploading: [= ] 0%
Uploading: [= ] 0%
Uploading: [= ] 1%
Uploading: [= ] 1%
Uploading: [= ] 1%
Uploading: [= ] 1%
Uploading: [= ] 1%
Uploading: [= ] 1%
Uploading: [= ] 1%
Uploading: [= ] 1%
Uploading: [= ] 1%
Uploading: [= ] 1%
Uploading: [= ] 2%
Uploading: [= ] 2%
Uploading: [= ] 2%
Uploading: [= ] 2%
Uploading: [= ] 2%
Uploading: [== ] 2%
Uploading: [== ] 2%
Uploading: [== ] 2%
Uploading: [== ] 2%
Uploading: [== ] 2%
Uploading: [== ] 3%
Uploading: [== ] 3%
Uploading: [== ] 3%
Uploading: [== ] 3%
Uploading: [== ] 3%
Uploading: [== ] 3%
Uploading: [== ] 3%
Uploading: [== ] 3%
11:45:24 [ERROR]: Error Uploading
*** [upload] Error 1

Please update the BasicOTA sketch (while adapting the WiFi credentials of course) to the device and retry the OTA. Is the log different now?

No nothing received:

rst:0xc (SW_CPU_RESET),boot:0x12 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:8896
load:0x40080400,len:5828
entry 0x400806ac
[D][esp32-hal-psram.c:47] psramInit(): PSRAM enabled
Booting
[D][WiFiGeneric.cpp:337] _eventCallback(): Event: 0 - WIFI_READY
[D][WiFiGeneric.cpp:337] _eventCallback(): Event: 2 - STA_START
[D][WiFiGeneric.cpp:337] _eventCallback(): Event: 4 - STA_CONNECTED
[D][WiFiGeneric.cpp:337] _eventCallback(): Event: 7 - STA_GOT_IP
[D][WiFiGeneric.cpp:381] _eventCallback(): STA IP: 192.168.1.42, MASK: 255.255.255.0, GW: 192.168.1.1
[I][ArduinoOTA.cpp:130] begin(): OTA server at: esp32-246f28a9c020.local:3232
Ready
IP address: 192.168.1.42

and:

Uploading: [ ] 0%
Uploading: [ ] 0%
Uploading: [ ] 0%
Uploading: [ ] 0%
Uploading: [ ] 0%
Uploading: [ ] 0%
12:15:03 [ERROR]: Error Uploading
*** [upload] Error 1

platformio.ini:

[env:esp32cam]

platform = espressif32

board = esp32cam

framework = arduino

upload_port = 192.168.1.42

upload_protocol = espota

;monitor_speed = 115200

; Verbose

build_flags = -DCORE_DEBUG_LEVEL=5

I think I will retry with arduinoIDE to check it is always OK

Is your firewall or antivirus program blocking outgoing connections from the python program? Can you temporarily disable it? Does it work in the Arduino IDE?

In fact I have the same problem on IDEarduino :frowning: (but it worked before I shloud have reinstalled my ubuntu few weeks ago). So the problem is not PlatformIO. Moreover the complete log on serial port is this after:

[D][Updater.cpp:136] begin(): OTA Partition: app0
Start updating sketch
abort() was called at PC 0x4012f831 on core 1

Backtrace: 0x4008e8b0:0x3ffb1e30 0x4008eae1:0x3ffb1e50 0x4012f831:0x3ffb1e70 0x40089593:0x3ffb1e90 0x400d339d:0x3ffb1eb0 0x40135c9c:0x3ffb1ed0 0x40135ea3:0x3ffb1ef0 0x400d3159:0x3ffb1f10 0x400d336e:0x3ffb1f70 0x400d14ae:0x3ffb1f90 0x400d4d39:0x3ffb1fb0 0x4008aff9:0x3ffb1fd0

Rebooting…
ets Jun 8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x12 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:8896
load:0x40080400,len:5828
entry 0x400806ac
[D][esp32-hal-psram.c:47] psramInit(): PSRAM enabled
Booting
[D][WiFiGeneric.cpp:337] _eventCallback(): Event: 0 - WIFI_READY
[D][WiFiGeneric.cpp:337] _eventCallback(): Event: 2 - STA_START
[D][WiFiGeneric.cpp:337] _eventCallback(): Event: 4 - STA_CONNECTED
[D][WiFiGeneric.cpp:337] _eventCallback(): Event: 7 - STA_GOT_IP
[D][WiFiGeneric.cpp:381] _eventCallback(): STA IP: 192.168.1.42, MASK: 255.255.255.0, GW: 192.168.1.1
[I][ArduinoOTA.cpp:130] begin(): OTA server at: esp32-246f28a9c020.local:3232
Ready
IP address: 192.168.1.42

On IDEArduino:

Sketch uses 781646 bytes (24%) of program storage space. Maximum is 3145728 bytes.
Global variables use 43280 bytes (13%) of dynamic memory, leaving 284400 bytes for local variables. Maximum is 327680 bytes.
Sending invitation to 192.168.1.42
Uploading…
14:16:56 [ERROR]: Error Uploading
14:16:56 [ERROR]: Error Uploading

I will check Firewall or antivirus

I found the problem :slight_smile:
The board should be set to:

  • Board: "ESP32 Dev Module ,
  • Partition Scheme: "Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)
  • and PSRAM: "Enabled

And not AI Thinker ESP32-CAM! It is necesseray to have two partition set. The problem is that I know how to set this set in ArduinoIDE but not in PlatformIO…

Setting up partition tables in PlatformIO is documented.

As you can see from the Arduino-ESP32’s board.txt, using that partition scheme maps to using the following partition CSV file:

Thus you should try adding the line

board_build.partitions = min_spiffs.csv

in your platformio.ini

I tried to set

board_build.partitions = min_spiffs.csv

the uploading of my own sketch is OK but when the ESP is restarting it boots on an old sketch!!! The BasicOTA sketch…

Does the Arduino IDE behave in the same way?

No it is booting on the correct sketch on ArduinoIDE! I don’t understand. The config of ESP32 and especially partition’s configuration is not easy on platformIO… I keep it only because I like VisualStudio code’s editor… :unamused:

So what is your board set up as now in PlatformIO? Something like the following, I hope…

[env:ESP32-CAM]
platform =  espressif32
framework = arduino
board = esp32dev
board_build.partitions = min_spiffs.csv
upload_protocol = espota
build_flags =
    -DBOARD_HAS_PSRAM
    -mfix-esp32-psram-cache-issue

On second thoughts, after looking at the configuration for both the esp32dev and the esp32cam… I don’t see why the esp32cam profile wouldn’t work, as long as you set the right partition scheme… i.e. the ESP32-CAM is set to huge_app.csv by default, and sets the PSRAM build_flags, so the following should work also.

[env:ESP32-CAM]
platform =  espressif32
framework = arduino
board = esp32cam
board_build.partitions = min_spiffs.csv
upload_protocol = espota

Ok, I think I made mistake yesterday when I tested quickly and use an old platformio.ini file from an another project… :roll_eyes: So now it works with this platformio.ini file:

[env:esp32cam]
platform = espressif32
board = esp32cam
framework = arduino
lib_deps = GitHub - tzapu/WiFiManager: ESP8266 WiFi Connection manager with web captive portal
upload_port = 192.168.1.43
upload_protocol = espota
monitor_speed = 115200
board_build.partitions = min_spiffs.csv

@maxgerhardt @pfeerick Thanks for your help

1 Like