Upload to ESP32-CAM using UNO fails: "No serial data received"

Hi. I am having the same problem with my esp32-cam(ov2640). I tried to program it using an arduino uno. I used the webcamera example for this but the error "A fatal error occurred: Failed to connect to ESP32: No serial data received." pops up. I am using the cam for the first time. So please help me(I am not that experienced).

Hi @spacexplorer444. Please tell us the connections you have made between the pins on the Uno and the ESP32-CAM.

ESP cam Arduino
5V - 5V
GND- GND
GPIO 0- GND
UOT - RX
UOR - TX
GND(arduino) to RESET(arduino)

Also is it possible to program the esp32 cam with an arduino? If not ill buy a ftdi.

The esp32cam can draw a lot of current so if you are powering it from the Arduino this may be an issue.
The gpio pins of an esp32 are 3.3v not 5v so this may be the next issue you have.

Your best option may be to get one of the "esp32cam motherboards" to program it as they just slot in (search Aliexpress for "esp32-cam-mb").
The esp32cam they supply with it is slightly modified so it can reset automatically, if yours is not this type you may need to press the reset whilst holding the program button on the esp32cam to program it.

BTW - see How to Program / Upload Code to ESP32-CAM AI-Thinker (Arduino IDE) | Random Nerd Tutorials

1 Like

Unintuitively, this is wrong.

The reason is that the purpose of this circuit is to connect the USB to serial bridge chip on the UNO (e.g., ATmega16U2) to the ESP32. The labels on the pins on the UNO are in relation to the pins on its primary ATmega328P microcontroller chip, not the USB to serial bridge chip. The bridge chip has an RX-TX, TX-RX connection to the ATmega328P, so the pin labeled "RX" on the UNO is actually connected to the TX pin on the bridge chip, and the pin labeled "TX" on the UNO is connected to the RX pin on the bridge chip.

So in order to make a RX-TX, TX-RX connection between the bridge chip and the ESP32, you must make connections between the pins that are labeled as described in this table:

ESP32-CAM UNO
U0T TX
U0R RX

Other than that, the other connections are correct.


However, I should warn you that connecting the RX pin of the UNO directly to the U0R pin on the ESP32-CAM is not a great idea. The ESP32 runs at 3.3 V (there is a voltage regulator on the board that reduces the 5 V input from the 5 V pin to 3.3 V before feeding it to the ESP32) so you should really only subject the GPIO pins to 3.3 V maximum. The UNO runs at 5 V and so the signals transmitted from the USB to serial bridge chip use 5 V logic levels. So you are subjecting the U0R pin of the ESP32 to 5 V, which is above its maximum rating:

https://docs.espressif.com/projects/esp-faq/en/latest/hardware-related/hardware-design.html#what-is-the-voltage-tolerance-of-gpios-of-esp-chips

What is the voltage tolerance of GPIOs of ESP chips?

The voltage tolerance of GPIO is 3.6 V. If the voltage exceeds 3.6 V, please add a voltage divider to protect GPIO pins from damage.

Maybe you can get away with 5 V, but it is also possible you could do permanent physical damage to the ESP32.

Hi. I bought a ftdi 232 and connected it to the esp32 cam but the same error A fatal error occurred: Failed to connect to ESP32: No serial data received. comes. My mac recognizes the ftdi but does not recognize the esp32 when i use the 'Get board info' tool. Can I troubleshoot this?

Please provide a list of the pin connections between the FTDI FT232 and the ESP32-CAM.

This is normal and expected when the port is from a general purpose USB to serial bridge chip like your FTDI FT232.

Arduino IDE has a feature where it attempts to identify the specific Arduino board model of each of the ports it discovers on your computer. It is able to make this identification when the port has properties that are unique to a specific board model.

The most commonly used properties are the USB VID/PID identifiers. Arduino, as well as some of the 3rd party board manufacturers have purchased a dedicated "vendor ID" (VID) from the USB-IF organization. This allows them to design boards that use a custom firmware that produces a serial port with a unique VID/PID pair dedicated for exclusive use with boards of that model. The ports of these boards can be identified by Arduino IDE.

However, the FTDI FT232 comes with a VID/PID pair provided by the chip manufacturer. That means the VID/PID pair doesn't serve as a unique identifying property associated with a specific Arduino board model because the chips with that VID/PID pair are used on many different board models (and even other devices that are not Arduino boards). In this case where the port does not provide unique properties, Arduino IDE doesn't have any way to identify the board model associated with the port and so the identification features will not be available for that port:

  • Port will be initially labeled as "Unknown" in the board selector menu on the IDE toolbar.
  • Port will not be labeled with board name in Tools > Port menu.
  • "BN" field of the "Board Info" dialog will say "Unknown board".

However, this is not a real problem because port identification is only a convenience feature. When using the boards that produce an unidentifiable port, you only need to make sure the correct board is selected in the Tools > Board menu and the correct port selected in the Tools > Port menu and everything will work perfectly well.

Thanks. The connections are

Ftdi 232 esp32 cam
vcc 5v
gnd gnd
tx uor
rx uot
io0 - gnd

This is correct if you have the jumper on the FTDI FT232 module in the "5V" position. However, you should be aware that, when you have the jumper in the "5V" position, it will use 5 V logic levels, which will expose the UOR pin on the ESP32-CAM to 5 V. The ESP32 microcontroller uses 3.3 V logic levels, so it is possible this could do permanent damage to the ESP32-CAM.

The alternative would be to put the jumper on the FTDI FT232R module in the "3.3V" position. This would cause the FTDI FT232 module to use 3.3 V logic levels. With the FT232R module in that configuration, you would need to change this connection to:

Ftdi 232 esp32 cam
VCC VCC

The only problem with putting the jumper on the FTDI FT232 module in the "3.3V" position is this will cause the ESP32-CAM to be powered from the 3.3 v output provided by the FT232R chip. That output is only rated for 50 mA maximum and the ESP32-CAM is sure to draw far more than that, especially when the Wi-Fi radio, camera, and high power LED are active.


So, with the warning about the 5 V logic levels out of the way, I don't see any problems with your connections. A special procedure is required to upload to the ESP32-CAM when you are using an FTDI FT232R module as the interface between the ESP32-CAM and your computer. I'll provide instructions for uploading:

  1. Connect the IO0 pin on the ESP32-CAM to GND.
  2. Press and release the "RST" button.
  3. Select Sketch > Upload from the Arduino IDE menus.
  4. Wait for the upload to finish successfully.
  5. Disconnect the IO0 pin from GND.
  6. Press and release the "RST" button.

The "Failed to connect to ESP32: No serial data received." error you encountered might occur if you don't perform step (2) in those instructions, as this is required to put the board into the "programming" mode that allows a sketch to be uploaded.

So try following those instructions for uploading. Hopefully this time it will be successful. If not, let us know and we'll try to help get it working.

OK. I tried both 3v and 5v. When I use 3v the same error is given but when 5v is given, the error A fatal error occurred: Failed to connect to ESP32: Invalid head of packet (0x64): Possible serial noise or corruption. pops up. What should I do?

This error might be caused by the circuit between the FTDIFT232R module and the microcontroller on the ESP32-CAM not being able to support the rather high default upload speed. If so, the problem should be fixed by reducing the upload speed, which is configurable via a convenient menu.

Select Tools > Upload Speed > 115200 from the Arduino IDE menus and then try uploading the sketch again, just as you did before. Hopefully this time the upload will be successful. If not, add a reply here on the forum thread to let us know and we'll investigate further.

Optimizing Upload Speed

If the sketch upload no longer failed after reducing the upload speed, you will have determined that the board is not capable of managing uploads at the default 921600 baud, but is capable of them at 115200 baud.

Especially with more complex sketches, the upload will take a significant amount of time at 115200 baud. It is likely that the board is capable of managing uploads at some speed higher than 115200 baud, so it is worth doing some experimentation to determine the maximum speed at which you can reliably upload to the board. You can do this by repeating the "Configure Upload Speed" procedure above, but selecting different speeds each time. Then attempting an upload to see if the new speed is appropriate.

I did what you said. The same error appears(the first one). Are there any other solutions?

Did you make the connection from the "GND" pin on the FTDI FT232R module to the "GND" pin next to the "5V" pin on the ESP32-CAM?

There is another pin next to the "UOT" pin, which should be marked "GND/R", but is incorrectly marked "GND" on some ESP32-CAM boards. Despite the confusing labeling, that is not a ground pin, so you must make sure to connect to the "GND" pin next to the "5V" pin:

📷

ESP32-CAM by Nowforever - CC BY-SA 4.0 (annotated, scaled, cropped)

If you had the connected to the pin next to the "UOT" pin, move the connection to the correct pin and then try uploading again, making sure to follow the upload procedure I provided in my previous reply.

I did that mistake and corrected it a few days ago. But the errors still repeat.

There are two types of ESP32CAM board, the one shown in the picture is the earlier version, and the pin labeled GND next to the UOT pin, is indeed connected to GND, at least it is on all the copies of that version of the ESP32CAMs I have. So its labeled correctly.

A later version of the ESP32CAM has the pin next to the UOT labeled GND\R and on all the examples of that type of ESP32CAM I have seen, that pin is connected to Enable\Reset. This connection to Enable\Reset is required to use those plug in USB programming boards.

If you look at the photo posted, there is a bunch of 4 sets of resistor pads by the UOT pin. On the later ESP32CAMs there are 5 sets of resistor pads and one of them appears to link the GND\R pin to Enable\Reset.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.