I have tried almost everything to get even a simple program to run on an ESP32-CAM (AI Thinker). Anything that I compile and run with Arduino IDE will work fine, including a streaming web server as found in the ESP32-CAM tutorial. When troubleshooting this problem I created a simple sketch that prints out successive numbers continuously. It runs fine when compiled under Arduino IDE, but not in PlatformIO. The code compiles and uploads using platformio, but just doesn’t run! Note that this sketch only uses the <Arduino.h> include, so there is nothing special going on here, i.e., no library inconsistencies to worry about.
The platformio.ini file is:
[env:esp32cam]
platform = espressif32
board = esp32cam
framework = arduino
monitor_speed = 115200
There is no problem with any code that I have used, because it all works when compiled and uploaded by Arduino IDE.
Also, the number-printing code works on platformIO when uploaded to a DoIT ESP32 DEVKIT V1 board. It’s just the ESP32-CAM board on PlatformIO that doesn’t run (although it compiles and uploads fine).
So there’s no problem with the boards, or code, or serial monitor settings. I used two different ESP32-CAM boards with the same results, both work with any code compiled in Arduino, but not on platformIO.
I did a complete uninstall / re-install of platformio to no avail. All the above suggests that there is a problem with the esp32cam board profile in platformio. As I want to do many projects with the CAM board using platformio I’m hoping there is a solution.
Is there something I can try to solve this???
Partial Success. I found a fix from the PlatformIO forum, which was to turn-off RTS and DTR control lines on the serial port (I’m using the ESP32-CAM MB for uploading). The following lines are added to the platformio.ini file:
monitor_rts = 0
monitor_dtr = 0
According to the PIO forum,
Well a few ESP32 boards have a mechanism that connects RTS/DTR to the EN/GPIO0 lines – if these are driven the wrong way when the serial monitor opens, it might shut down the ESP32.
This fix allowed my program that prints sequential numbers to the serial monitor to work, but the camera web server program does not work yet completely. It prints the sensor readings from the BME280 sensor, but the camera’s web page will not load.
It could be due to a library incompatibility because I used a different version of ESPAsyncWebServer in PlatformIO. The PlatformIO registry did not have the same version as the one in Arduino IDE. I’ll have to connect those libraries manually.
I will work on this issue and report back to this post.
FYI: I found the fix in the following link. There is more info and links in this web page that may be helpful.
https://community.platformio.org/t/noob-stuck-on-esp32-cam-mb-with-pio-vscode/19117/8