PlatformIO Community

Noob stuck on ESP32-CAM+MB with PIO/vscode

Hi,
I am a noob on PIO, esp32, vscode and linux, all of which i used to get myself into the problem below… so you’ve been warned.

Last nite i tried and managed to run a sample (espressif framework) on a brand new ESP32-WROOM-32D and i could see trace on the serial monitor. Ay caramba! That left me very impressed with PIO given my starting point.

The second shinny toy is a ESP32-CAM+MB, also purchased from the same shady online outlet. A few hickups but eventually i could build in vscode+pio the sample cam server (arduino framework) and upload it to the device. Ay, caramba!

BUT, i just cannot see any debug trace on the serial monitor (not to mention a new client on the DHCP list). I fiddled with the 2 buttons on the MB and the one button on the ESP32-CAM with no result on the serial monitor.

I did set the monitor_speed=115200 in platformio.ini and i also copied the 99.platformio-udev.rules to /etc/udev/rules.d and i verified my PID&VID (pio device list) are indeed listed in that rules file.

  1. The most likely thing is that i failed to do something obvious, but what?
  2. Or am i using the wrong tool and i should try to run the sample on the arduino IDE (which i don’t know either and would rather leave in peace) instead?
  3. If i stick to vscode+PIO (my preference), what can i try next?

Any pointer will be very much appreciated. Thanks in advance!

1 Like
  1. What’s the exact code you’re uploading
  2. What’s the exact platformio.ini you’re using
  3. You just get no output but the serial device (/dev/ttyUSB0 e.g.) is still found, right?

[See my next post below which may be more useful]

  1. I did a Arduino import on this:
    https://github.com/espressif/arduino-esp32/tree/master/libraries/ESP32/examples/Camera/CameraWebServer
    then i selected the #define CAMERA_MODEL_AI_THINKER and set the ssid/password string constants. I realize a lot of thing could go wrong in that code but i am stuck on getting a trace.
  2. I just added the monitor speed:
[env:esp32cam]
platform = espressif32
board = esp32cam
framework = arduino
monitor_speed = 115200
  1. I believe so. I see no error and the upload seems to work fine. I see this at upload:
Serial port /dev/ttyUSB0
Connecting....
Chip is ESP32-D0WDQ6 (revision 1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 9c:9c:1f:c8:27:e0
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 15872 bytes to 10319...
Writing at 0x00001000... (100 %)
Wrote 15872 bytes (10319 compressed) at 0x00001000 in 0.6 seconds (effective 205.2 kbit/s)...
[....]
Writing at 0x001a4000... (100 %)
Wrote 2102800 bytes (1663942 compressed) at 0x00010000 in 100.8 seconds (effective 166.9 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...

But on the serial monitor, no trace from the code (i added a string in the println line 30 at the start of setup()):

--- Available filters and text transformations: colorize, debug, default, direct, esp32_exception_decoder, hexlify, log2file, nocontrol, printable, send_on_enter, time
--- More details at http://bit.ly/pio-monitor-filters
--- Miniterm on /dev/ttyUSB0  115200,8,N,1 ---
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---

And if i do C-T C-I, I get:

--- Settings: /dev/ttyUSB0  115200,8,N,1
--- RTS: active    DTR: active    BREAK: inactive
--- CTS: inactive  DSR: inactive  RI: inactive  CD: inactive
--- software flow control: inactive
--- hardware flow control: inactive
--- serial input encoding: UTF-8
--- serial output encoding: UTF-8
--- EOL: CRLF
--- filters: default

And i just checked my user is in dialout and plugdev groups.

I switched to a simple arduino example which flashes a light as provided by PIO home tab and added some println(). The code works (cam flash light if flashing). But when i launch the serial monitor the flashing stops and no trace appears, then if i close (trash icon) the serial monitor the flashing resumes.

#include <Arduino.h>

// Set LED_BUILTIN if it is not defined by Arduino framework
#define LED_BUILTIN 4

void setup()
{
  Serial.begin(115200);
  Serial.setDebugOutput(true);
  Serial.println("Setup starting...");
  Serial.flush();

  pinMode(LED_BUILTIN, OUTPUT);
}

void loop()
{
  digitalWrite(LED_BUILTIN, HIGH);
  delay(5);
  digitalWrite(LED_BUILTIN, LOW);
  
  Serial.println("Waiting 5s...");
  Serial.flush();
  delay(5000);
}

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.

Can you try adding each of those blocks to the platformio.ini and retry opening the serial monitor (just “Monitor” task)? If one doesn’t make a difference, delete it again and try the next one.
1.)

monitor_rts = 0
monitor_dtr = 0

2.)

monitor_rts = 0
monitor_dtr = 1

3.)

monitor_rts = 1
monitor_dtr = 0

4.)

monitor_rts = 1
monitor_dtr = 1

(docs for that command)

4 Likes

Fantastic: the first one works like a charm! I get the trace and the code keeps on running.

Well I have some reading to do now.

Thanks a lot for taking the time because i was really stuck.

1 Like

Thanks! That really helped me. Couldn’t work out why I could program but got no comms. out!

1 Like