Can't upload ESP32CAM-RTSP to my ESP32Cam

Hello everyone,

Today I found a very interesting project for my ESP32Cam (GitHub - rzeldent/esp32cam-rtsp: Simple RTSP (streaming image) server for the ESP32CAM. Easy configuration and monitoring through the web interface.), in fact it looks like a better version of what I’m currently using.

That said this project isn’t compatible with Arduino IDE (which I’m very familiar / comfortable with), so I installed Visual Studio Code / Platform Io and followed the instructions from the repo (mentioned above).

I tried to upload many times but I couldn’t it always error… the error I’m getting is:

...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Traceback (most recent call last):
  File "/Users/xxx/.platformio/packages/tool-esptoolpy/esptool.py", line 5387, in <module>
    _main()
  File "/Users/xxx/.platformio/packages/tool-esptoolpy/esptool.py", line 5380, in _main
    main()
  File "/Users/xxx/.platformio/packages/tool-esptoolpy/esptool.py", line 4802, in main
    esp.flash_set_parameters(flash_size_bytes(args.flash_size))
  File "/Users/xxx/.platformio/packages/tool-esptoolpy/esptool.py", line 1056, in flash_set_parameters
    self.check_command("set SPI params", ESP32ROM.ESP_SPI_SET_PARAMS,
  File "/Users/xxx/.platformio/packages/tool-esptoolpy/esptool.py", line 495, in check_command
    val, data = self.command(op, data, chk, timeout=timeout)
  File "/Users/xxx/.platformio/packages/tool-esptoolpy/esptool.py", line 468, in command
    p = self.read()
  File "/Users/xxx/.platformio/packages/tool-esptoolpy/esptool.py", line 413, in read
    return next(self._slip_reader)
StopIteration
*** [upload] Error 1

Watching the terminal, I can tell the port is correct, but that is the only thing I could think of.

The wiring is fine, since I can normally upload from Arduino IDE.
The only real difference that I spotted is that on Arduino IDE my selected board is: ESP32 Wrover Module and on PlatformIO the project comes with board = esp32cam.

That said I tried to select Espressif ESP-WROVER-KIT and got the same error.

Not sure what can I possibly be doing wrong, so any help will be very much appreciated.

Thanks

Digging a little further based on threads I found, I went into monitor mode, and that’s what I saw:

08:33:47.735 > 
08:33:47.735 > rst:0x1 (POWERON_RESET),boot:0x3 (DOWNLOAD_BOOT(UART0/UART1/SDIO_REI_REO_V2))
08:33:47.743 > waiting for download

So I guess, that proves wiring is fine…
What could be causing this failure?

Does it also happen in the Arduino IDE? If yes, issue to Issues · espressif/esptool · GitHub please. Previous issues (Unable to verify flash chip connection (No serial data received.). (ESPTOOL-447) · Issue #735 · espressif/esptool · GitHub, Can't flash ESP32 over RFC2217 with slow IP connection (ESPTOOL-371) · Issue #704 · espressif/esptool · GitHub) haven’t yielded clear results.

Not really @maxgerhardt, it works absolutely fine on Arduino.

I believe it is something I’m probably missing on Visual Studio Code / Platform IO.

That was the first thing I did once the upload failed on PIO… went back to Arduino and tried to upload a sketch, worked absolutely fine.

What’s the ESP32 version installed in your Arduino IDE’s board manager? (Tools → Boards → Board Manager → esp32)

Thanks for the reply…

The version I got is 2.04, which is fairly recent (Jul 6).

That said, the sketch I’m uploading via Arduino isn’t the same that the one on PIO.
The one I got on PIO seems to be a improved version of this sketch…

Does this failure also happen with Blinky sketch on both Arduino IDE + PlatformIO?

On Arduino IDE, everything works fine, doesn’t really matter the sketch (given it compiles).

On PIO the only thing I tried to upload is the project mentioned at the beginning of the thread, I’ll try an empty project and post results here in 2h.

Thanks for follow along, I really appreciate the help.

@maxgerhardt, just to confirm:

Nope, even the blink example from PIO gives me the same error when uploading:

Chip is ESP32-D0WD-V3 (revision 3)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: e0:e2:e6:aa:5c:60
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Traceback (most recent call last):
  File "/Users/xxx/.platformio/packages/tool-esptoolpy/esptool.py", line 5387, in <module>
    _main()
  File "/Users/xxx/.platformio/packages/tool-esptoolpy/esptool.py", line 5380, in _main
    main()
  File "/Users/xxx/.platformio/packages/tool-esptoolpy/esptool.py", line 4802, in main
    esp.flash_set_parameters(flash_size_bytes(args.flash_size))
  File "/Users/xxx/.platformio/packages/tool-esptoolpy/esptool.py", line 1056, in flash_set_parameters
    self.check_command("set SPI params", ESP32ROM.ESP_SPI_SET_PARAMS,
  File "/Users/xxx/.platformio/packages/tool-esptoolpy/esptool.py", line 495, in check_command
    val, data = self.command(op, data, chk, timeout=timeout)
  File "/Users/xxx/.platformio/packages/tool-esptoolpy/esptool.py", line 468, in command
    p = self.read()
  File "/Users/xxx/.platformio/packages/tool-esptoolpy/esptool.py", line 413, in read
    return next(self._slip_reader)
StopIteration
*** [upload] Error 1

I’m almost convinced it’s some configuration, I’m just not sure what…

The other thing I’m thinking is:

On Arduino these are my settings:
Screen Shot 2022-09-06 at 9.15.39 am

On PIO these are the settings:
Screen Shot 2022-09-06 at 9.17.23 am

Could the board cause the problem?
Again, I tried the esp-wrover-kit (closest I found to what I use on arduino), but no deal.

Based on this, you should be using

[env:esp-wrover-kit]
platform = espressif32
board = esp-wrover-kit
framework = arduino
board_build.f_flash = 80000000L
board_build.flash_mode = qio
board_build.partitions = huge_app.csv
upload_speed = 115200

as a base. Does that work better?

Nailed @maxgerhardt
Thank you so much!

I don’t want take more of your time, but would you be able to explain these parameters?
Thanks

Sorry forgot to post the documentation link, all of this is in Espressif 32 — PlatformIO latest documentation. Flash has the attributes for used frequency on the SPI Bus (80MHz) and mode (Quad I/O), then the partition table is about how the flash is partitioned / used (influences maximum application sizes, ability to do OTA etc), and upload speed is the baud rate used for the UART upload.

1 Like