ESP32-CAM & ESP32-CAM-MB serial issues

Hello everyone

I wanted to share what I’ve found while working with an ESP32-CAM with an ESP32-CAM-MB board. I posted(Edge-impulse-deamon timeout (ESP32-CAM, Raspberrypi)) two weeks about about timeout issues I experienced with edge-impulse-daemon and my ESP32. Since then I’ve gone deep into a rabbit hole and this is what I’ve found.

The TLDR version is that the ESP32-CAM-MB board uses DTR and RTS to reboot the ESP and control which mode it boots into. If DTR is on and RTS is toggled on then off, it boots into ‘code upload’ mode. If DTR is off and RTS is toggled on then off, the ESP boots into normal mode. If RTS is on, no output from the serial port is seen.

You can see this by using GTKTerm on a Raspberry Pi - it allows direct control of DTR/RTS. I was also able to replicate these results by using a short Python program:

#!/usr/bin/env python3
import serial
if __name__ == '__main__':
    ser = serial.Serial('/dev/ttyUSB0', 115200, timeout=1, rtscts=False)
    ser.reset_input_buffer()
    ser.setDTR(True)
    ser.setRTS(True)
    ser.setRTS(False)
    while True:
        if ser.in_waiting > 0:
            line = ser.readline().decode('utf-8').rstrip()
            print(line)

DTR = True - upload mode
DTR = True - normal boot mode

Could edge-impulse-daemon and edge-impulse-uploader be updated to include a flag that would result in DTR/RTS being manipulated in this fashion? That would be a huge assist for those working with the ESP32 and these boards.
thx

1 Like

I am using the ESP32-EYE and the edge-impulse-daemon works perfectly with it. I do not have to manually toggle the boot/reset buttons to work.

Also, you can modify the edge-impulse firmware code to make any additional changes or add sensors, etc. GitHub - edgeimpulse/firmware-espressif-esp32: Edge Impulse firmware for the Espressif ESP-EYE(ESP32) Development board

1 Like

Hi apineda
I’m using the AI-Thinker ESP32-CAM. The edge-impulse-daemon did not find the board - it doesn’t return anything on the serial port as long as RTS is held high.

Sorry, I didn’t pay attention to your ESP32 model very closely.
I tried to manually toggle the buttons on a plain ESP32 while the daemon was trying to connect. I did not have any luck in getting it to work.

Any update ? Were you able to connect later ?

Hi all,

Thank you for the recommendation. We likely will not be able to add this ability, as we only officially support the ESP-EYE for now. There are a few options that I recommend:

  1. You can manually trigger the bootloader by tying IO0 to GND. Please see this tutorial: How to Program / Upload Code to ESP32-CAM AI-Thinker (Arduino IDE) | Random Nerd Tutorials. On my AI Thinker ESP32 board, I added a button between IO0 and GND and a power switch. That way, I can hold the button and toggle power to enable bootloader mode before programming. This has worked well for me (programming via Arduino and from ESP-IDF).
  2. Our CLI tools are open source: GitHub - edgeimpulse/edge-impulse-cli: Command line interface tools for Edge Impulse. Feel free to fork them to add your own support. We would gladly accept and review pull requests!

Yes, once I caught onto the DTR/RTS thing, I figured out how to do it.

2 Likes

@paket what did you do to make it work?

It’s a long time ago, but I think I manually did the connection with a piece of wire.