Error in Arduino with Espressif ESP32-CAM [duplicate] - arduino

I've just recieved my very first esp32cam (AI THINKER) today and I was excited to test it, but I'm unable to upload any code to it. I'm always getting the following error:
Failed to connect to ESP32: Timed out waiting for packet header
So, the FTDI I'm using is the FT232r with the following wiring scheme
FTDI Wiring
How I reproduce this error:
Plug everything
Order IDE to upload the sketch
Wait for the "connecting" text
Press the RST button
Also:
Plug everything
Press the RST button
Order IDE to upload the sketch
I've already tried:
Switching to 3.3v (plugged on 3.3v pin)
Using external 5v power supply (plugged on 5v pin)
Using another computer
Swapping RX TX
Trying in different upload speeds
Holding RST button
Switching board between ESP32 Wrover Module and AI Thinker ESP32
I'm I doing something wrong or there's just something faulty?

I have delved for a solution in this regard for weeks and it seems I have a solution.
Findings-
FTDI module is probably faulty or not supported for each instance.
Aithinker Board is not compatible with esspressif (use ESP32Wrover, more details below )
I have an esp32cam from Esspressif, not Aithinker.
I was trying with FT232rl , No matter what Voltage/jumpers/USB cable I used, it didn't work. Always stuck with fatal timed out error.
After many futile attempts with FTDI breakout, I gave my Arduino UNO a try (please note my UNO has mega16u2 chip as USB serial chip (top right corner just beside the oscillator) and fortunately it worked.
I have read that CP2102 is also working.
**Here are the steps to follow-**
Arduino ESP32Cam connections
3.3 Arduino --------- 3v Esp32CAM
GND Arduino ------------ GND Esp32CAM
RESET Arduino to Ardunio GND
RX Arduino -------------- VOR Esp32CAM (this is not a mistake RX to rx & TX to tx)
TX Arduino -------------- VOT Esp32CAM
GPIO 0(zero)(written as IO0) Esp32CAM to GND Esp32CAM
I didn't have any need to press the reset button in any part of the operation before & during uploading.
I am assuming You have pre-installed the esp32 board manager.
Now select the correct COM port where your Uno (in this case) is
plugged in.
Select the correct board as mentioned
Tools>Board>ESP32 Arduino > select ESP32 Wrover Module
Some uploading setups are to be Done (Under Tools, these will only appear when the Wrover module is selected )
Upload speed -- 115200
Flash Frequency -- 40Mhz
Flash Mode -- QIO
Partition Scheme --- Huge App
Port ---- select the right com port for your breakout or UNO
JUST press upload and relax
After a while, you will be able to see this message
Leaving...
Hard resetting via RTS pin...
Disconnect the Esp32Cam GPIO 0 and GND
Power the ESP32Cam with 5/3v with external power supply (Arduino or other breakouts may not be able unless you are connected with a Powered USB Hub)
keep TX, RX, & GND of the 2 boards connected, don't disconnect Arduino Reset and GND.
Press Reset on ESPCAM and open Serial monitor and you will be able to see the IP address of the cam if it was configured with your wifi correctly.OR get any network scanner App on android or windows.
I hope it helped.

Pre-requisites for flashing:
ArduinoIDE 1.8.12
Core ESP32 1.04 (at time of writing)
Select board AI Thinker Cam
uplooad speed 921600
freq 240Mhz
flashfreq 80Mhz
mode QIO if not working try DIO
partition scheme default
Serial monitor is closed
NO hardware connected to the pins of the ESPcam
Make sure the USB cable is a data cable and NO loading cable only
check Windows device manager if programmer is shown and has max speed / 8n1 hardware
Connections
FTDI - ESP32
GND GND
5V 5V
TXD UOR
RXD UOT
If you use an AIThinker Cam clone you have to ground GIPO 0:
connect GPIO 0 with a dupont wire connected to GND
press reset
compile and upload (use AI THINKER CAM)
optional:
press reset
upload filesystem data (SPIFFS)
disconnect GPIO 0 and GND
press reset
code should execute
And yes you have to do it every upload, on my dev board I soldered a little switch with proper isolationSome more solutions from experience:
If there is still a problem use a 10K (or so) pull-down resistor between RX0 and GND (test on breadboard before soldering)
Pressing and holding (!) the boot-button while uploading on some "bad" boards
Happened with a "normal" ESP32 board to me - just to be sure - I got an ESP8266 in an ESP32 packaging. Configuring for the ESP8266 solved the issue of uploading.

In my case I forgot to remove the SD card. Other users recommended removing unnecessary connections to the pins-- and the SD card technically uses some of those :)

This was solved by using other jumpers. It seems one of the jumpers used in the wiring was faulty.
If you're having the same issue and tried everything in this post, try checking your cables!

Another solution here. Just to add, I tried everything on this QA, as well as many other things suggested online. e.g. tested by powering from 3.3V then 5V, various permutations of holding the reset button down and disconnecting IO00 from GND at the point of flashing. Changing various settings in Arduino IDE/
I was unable to flash a single one of the 5 ESP32-CAM boards I bought. Spent a good two hours on it. I even continuity tested every pin on the board to its ESP32 chip pad, and all the hookup wires were tested too. The board seemed fine.
Then I soldered a 100uF capacitor between 5V and GND, and used my USB-UART 5V power... tested and worked straight away. No need to pull out the IO00->GND connection and no need to press RST button on the board during flashing. (Of course, pull out IO00->GND after flashing complete.
So - it was a power problem.
I can only guess that the cheapo regulator they used on the copy of board that I got was not quite efficient enough, but basically that capacitor resolved the issue.
p.s. the ESP on board was marked "ESP32-S". I selected "AI Thinker ESP32-CAM" in Arduino IDE as suggested by most people online, and this worked.

There are 3 pins marked GND on the ESP32-CAM board. Buuuuut (!) the one marked GND/R just by the U0T is NOT connected to other grounds or anywhere else I could had find. Check with a multimeter and use a REAL GND. It just worked for me after days of puzzling.

If you try it with arduino it works but its needed to press reset button on esp32 before you upload your code

Basically I was facing the exact same problem fro quite some time. What worked for me was that as the chip was flashing, shifting the power wire from 5V to 3V3 pin. I do not know why but it workes. When esptool starts flashing at 2%, switching the cable just then, despite having 5V from supply into the 3V3 point made the flashing successful. I do realize this is probably a bad answer to your problem since it involves oversupplying voltage to the chip on the wrong point as it is flashing and could damage the chip. However, if anyone is tired of debugging and are at the point where you are considering throwing the chip away, might as well try my method. For other's who value their chip, don't try this method and if you still do, kniw it is at your own risk. But it worked for me after 3 days of just messing around with connections.

Related

Esp32cam Failed to connect to ESP32: Timed out waiting for packet header

I've just recieved my very first esp32cam (AI THINKER) today and I was excited to test it, but I'm unable to upload any code to it. I'm always getting the following error:
Failed to connect to ESP32: Timed out waiting for packet header
So, the FTDI I'm using is the FT232r with the following wiring scheme
FTDI Wiring
How I reproduce this error:
Plug everything
Order IDE to upload the sketch
Wait for the "connecting" text
Press the RST button
Also:
Plug everything
Press the RST button
Order IDE to upload the sketch
I've already tried:
Switching to 3.3v (plugged on 3.3v pin)
Using external 5v power supply (plugged on 5v pin)
Using another computer
Swapping RX TX
Trying in different upload speeds
Holding RST button
Switching board between ESP32 Wrover Module and AI Thinker ESP32
I'm I doing something wrong or there's just something faulty?
I have delved for a solution in this regard for weeks and it seems I have a solution.
Findings-
FTDI module is probably faulty or not supported for each instance.
Aithinker Board is not compatible with esspressif (use ESP32Wrover, more details below )
I have an esp32cam from Esspressif, not Aithinker.
I was trying with FT232rl , No matter what Voltage/jumpers/USB cable I used, it didn't work. Always stuck with fatal timed out error.
After many futile attempts with FTDI breakout, I gave my Arduino UNO a try (please note my UNO has mega16u2 chip as USB serial chip (top right corner just beside the oscillator) and fortunately it worked.
I have read that CP2102 is also working.
**Here are the steps to follow-**
Arduino ESP32Cam connections
3.3 Arduino --------- 3v Esp32CAM
GND Arduino ------------ GND Esp32CAM
RESET Arduino to Ardunio GND
RX Arduino -------------- VOR Esp32CAM (this is not a mistake RX to rx & TX to tx)
TX Arduino -------------- VOT Esp32CAM
GPIO 0(zero)(written as IO0) Esp32CAM to GND Esp32CAM
I didn't have any need to press the reset button in any part of the operation before & during uploading.
I am assuming You have pre-installed the esp32 board manager.
Now select the correct COM port where your Uno (in this case) is
plugged in.
Select the correct board as mentioned
Tools>Board>ESP32 Arduino > select ESP32 Wrover Module
Some uploading setups are to be Done (Under Tools, these will only appear when the Wrover module is selected )
Upload speed -- 115200
Flash Frequency -- 40Mhz
Flash Mode -- QIO
Partition Scheme --- Huge App
Port ---- select the right com port for your breakout or UNO
JUST press upload and relax
After a while, you will be able to see this message
Leaving...
Hard resetting via RTS pin...
Disconnect the Esp32Cam GPIO 0 and GND
Power the ESP32Cam with 5/3v with external power supply (Arduino or other breakouts may not be able unless you are connected with a Powered USB Hub)
keep TX, RX, & GND of the 2 boards connected, don't disconnect Arduino Reset and GND.
Press Reset on ESPCAM and open Serial monitor and you will be able to see the IP address of the cam if it was configured with your wifi correctly.OR get any network scanner App on android or windows.
I hope it helped.
Pre-requisites for flashing:
ArduinoIDE 1.8.12
Core ESP32 1.04 (at time of writing)
Select board AI Thinker Cam
uplooad speed 921600
freq 240Mhz
flashfreq 80Mhz
mode QIO if not working try DIO
partition scheme default
Serial monitor is closed
NO hardware connected to the pins of the ESPcam
Make sure the USB cable is a data cable and NO loading cable only
check Windows device manager if programmer is shown and has max speed / 8n1 hardware
Connections
FTDI - ESP32
GND GND
5V 5V
TXD UOR
RXD UOT
If you use an AIThinker Cam clone you have to ground GIPO 0:
connect GPIO 0 with a dupont wire connected to GND
press reset
compile and upload (use AI THINKER CAM)
optional:
press reset
upload filesystem data (SPIFFS)
disconnect GPIO 0 and GND
press reset
code should execute
And yes you have to do it every upload, on my dev board I soldered a little switch with proper isolationSome more solutions from experience:
If there is still a problem use a 10K (or so) pull-down resistor between RX0 and GND (test on breadboard before soldering)
Pressing and holding (!) the boot-button while uploading on some "bad" boards
Happened with a "normal" ESP32 board to me - just to be sure - I got an ESP8266 in an ESP32 packaging. Configuring for the ESP8266 solved the issue of uploading.
In my case I forgot to remove the SD card. Other users recommended removing unnecessary connections to the pins-- and the SD card technically uses some of those :)
This was solved by using other jumpers. It seems one of the jumpers used in the wiring was faulty.
If you're having the same issue and tried everything in this post, try checking your cables!
Another solution here. Just to add, I tried everything on this QA, as well as many other things suggested online. e.g. tested by powering from 3.3V then 5V, various permutations of holding the reset button down and disconnecting IO00 from GND at the point of flashing. Changing various settings in Arduino IDE/
I was unable to flash a single one of the 5 ESP32-CAM boards I bought. Spent a good two hours on it. I even continuity tested every pin on the board to its ESP32 chip pad, and all the hookup wires were tested too. The board seemed fine.
Then I soldered a 100uF capacitor between 5V and GND, and used my USB-UART 5V power... tested and worked straight away. No need to pull out the IO00->GND connection and no need to press RST button on the board during flashing. (Of course, pull out IO00->GND after flashing complete.
So - it was a power problem.
I can only guess that the cheapo regulator they used on the copy of board that I got was not quite efficient enough, but basically that capacitor resolved the issue.
p.s. the ESP on board was marked "ESP32-S". I selected "AI Thinker ESP32-CAM" in Arduino IDE as suggested by most people online, and this worked.
There are 3 pins marked GND on the ESP32-CAM board. Buuuuut (!) the one marked GND/R just by the U0T is NOT connected to other grounds or anywhere else I could had find. Check with a multimeter and use a REAL GND. It just worked for me after days of puzzling.
If you try it with arduino it works but its needed to press reset button on esp32 before you upload your code
Basically I was facing the exact same problem fro quite some time. What worked for me was that as the chip was flashing, shifting the power wire from 5V to 3V3 pin. I do not know why but it workes. When esptool starts flashing at 2%, switching the cable just then, despite having 5V from supply into the 3V3 point made the flashing successful. I do realize this is probably a bad answer to your problem since it involves oversupplying voltage to the chip on the wrong point as it is flashing and could damage the chip. However, if anyone is tired of debugging and are at the point where you are considering throwing the chip away, might as well try my method. For other's who value their chip, don't try this method and if you still do, kniw it is at your own risk. But it worked for me after 3 days of just messing around with connections.

Any solution available for for ESP32-cam 'Brownout detector was triggered' error?

I had an ESP32cam working for a few days then started getting that message at boot up. Reloaded the program and still no camera.disappointed
Error:
ets Jun 8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:1216
ho 0 tail 12 room 4
load:0x40078000,len:9720
ho 0 tail 12 room 4
load:0x40080400,len:6364
entry 0x400806b8
Brownout detector was triggered
Serial monitor
Camera label:
HW-297
OV2640
In program:
#define CAMERA_MODEL_AI_THINKER
Board selection:
ESP32 Wrover Module
Board selections
Brownout detection is a hardware feature that shuts down the processor if the system voltage is below a threshold, also known as the "brownout voltage". This is to preserve memory contents and avoid corruption.
You are getting this message because your board is not correctly powered. The underlying reason could be one of many things:
The USB cable is of poor quality, or too long.
Your computer's USB port cannot supply enough power to the board.
The ESP32Cam is defective
Other components in your circuit are not correctly wired up, affecting the power supply.
I would try to power the ESP32Cam with another USB cable, a different computer, or an external 5V power supply. If all of that doesn't help, it could be that your board is broken.
Another option is to disable the brownout detector.
#include "soc/soc.h"
#include "soc/rtc_cntl_reg.h"
// in setup()
WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0);
I had this issue as well. I solved it by taking the following steps:
I originally had the ESP32-CAM powered off the 3.3V supply from my FTDI, but I then found it works better when supplied by 5V.
I had to jumper together the two pins marked in magenta to program the ESP32-CAM and then remove the jumper when I wanted the board to actually run:
I had to select the "AI Thinker ESP32-CAM" in the Board Manager:
i had terrible brownout issues. struggled for days - tried everything on the forums.
Solution - just connect the desktop power to the esp32-cam and all my troubles disapeared.
seems the esp32-cam runs so close to the 5v power limit, that 5v from a desktop power supply is required when connected to the computer's usb port. not quite enough power and that makes all the difference.
TLDR; Atfer programming, power the camera module from a good quality external 5v power supply, plugged into the 5v pin on the module. You should try to remember to disconnect the pwr from the programmer once programming is complete - the serial monitor will still work.
I had a similar experience to Clive, lots of problems when booting but in my case, the BROWN OUT message didn't always appear and often just the camera init failed.
In the end I powered the 5v pin on the module from a 5v supply and tried to remember disconnect the pwr pin from my 'FTDI' programmer. I forgot often and no damage appears to have occurred.
Every online guide I saw has pwr from the programmer going to the 5V pin on the module even though when jumpered for 3v3, the programmer VCC is at 3v3. I connected it to 3v3 on the module instead though this didn't fix the brownout issues.

esp8266 on wifi serial board and Arduino Uno board

I bought esp8266 with serial wifi wifi card
I connect RX to TX; TX to RX; VCC to VCC; GRD to GRD;
I cant communicate with the board not if program mode and not in UART mode; the reset do nothing.
the red led on the board is on.
I connected the wifi serial to Arduino uno board.
try to upload sketch i got the following error:
warning: espcomm_sync failed
error: espcomm_open failed
error: espcomm_upload_mem failed
Any help or guides will help me to solve the issue.
Since I have had numorous of problems with my ESP8266 modules, this is what I generally watch for:
Output is 3.3v
Swap over tx and rx. Some boards have them swapped for some reason (searched for days for this!!)
When uploading the code, first the code compiles, then the code uploads. During the compile process, keep the reset button (or pin) pressed. As soon as you see the "uploading" status message, you can release it.
Make sure the GPIO0 is connected to the ground and (depending on which version you have) the GPIO15 as well.
When grounding the GPIO0 and GPIO15, use a resistor for each (between 2K and 10K will do).
I've spent two nights trying to upload firmware so I'll just repeat what helped me since there's not so many solutions:
First in Serial Monitor make sure that your chip responses to AT commands. There's no point in going further without achieving it. If you fail here then it's time to check your commutation, power source, etc.
While uploading: 1. Ground GPIO-0 pin. 2. In Arduino IDE press Upload button. 3. Code starts compiling. 4. As soon as you see that code starts uploading ground RST pin for just a blink. Before I reseted the chip too early so I had sync failed problem as you did. It took me a while to "catch" this moment for resetting the chip. Still I upload new firmware in 4-5 takes.
Before flashing firmware, please hold FLASH button, and press RST button once. When our firmware download tool released, it will flash firmware automatically and needn't press any button
I have this really weird issue where grounding GPIO 0 didn't work for me, but after a lot of trial and error I managed to upload the sketch connecting directly both gpios to ground in the arduino board and it worked. Really strange.
I had the same issue. In my case, I was uploading while in another terminal program I was checking for serial data. After I closed the serial monitor (and let Arduino IDE use the serial port) the problem was resolved partially.
The other half of the problem involves carefully pressing the button GPIO0 and then RESET.
This helped me achieving that.
I had the same issue, but after I set the Programmer to "AVR ISP" in the Arduino IDE/Tools, after that the upload was successful and it worked fine.
Hope it helps.
First you have to make sure that the Arduino IDE has the ESP8266 libraries installed. To do that, go to file>preferences and under Additional Boards Manager URLS, paste this link:
http://arduino.esp8266.com/stable/package_esp8266com_index.json
Then, go to tools>board>boards manager. Scroll until you find the link for ESP, than download it.
Once you select all the info for the board change the programmer to "AVR ISP"
Finally, to download the code, hold down the GPIO0 button and press the reset button once. Finally, hit download!
To use serial monitor, you may need to use the 115200 speed as it is not the default.
Hope this helps!
Please downlode and install these driver as per OS i spent 6 hours today and finally this was the solution.
https://www.silabs.com/products/mcu/Pages/USBtoUARTBridgeVCPDrivers.aspx
Look follow the leads and you will get the proper output as 'OK' in reply to AT command, just search for Arduino15 file in C directory of your computer, it will be in somewhere at C/users/app data and delete it, then set the Arduino to arduino uno board or whatever board you are using and connect the Esp8266 as, UNO --- ESP8266
RX ----- RX
TX ----- TX
GND --- GND
3.3V --- VCC and CH_PD
Once Connected open the Serial Monitor and set "Both NL & CR" and Baud to 9600.
Send "AT" to test. If nothing comes up try different baud rates such as 115200 or 57600 and retest.
If you get "OK" reply then all is working.
I just bought the Wemos D1 and had the same problem: I could not upload my sketches. There were several reasons for this:
1) I did not have the CH340G drivers loaded on my Mac. Both Win and Mac platforms need these drivers. Linux does not. I found my drivers at http://sparks.gogo.co.nz/ch340.html
2) You need to add the board to your Arduino IDE. You can find the steps to do that at http://www.beerandchips.net/2016/01/24/wemos-d1-hands-on-with-the-new-arduino-compatible-esp8266-dev-board/
Once I completed those 2 steps (be sure to select the serial port) everything worked great and I can upload my sketches with no difficulty.
I had (too many/wrong) COM port(s). Find the right one and I't fine.
This worked for me this time in the following way to successfully upload sketch from IDE to esp8266 via arduino:
1) IDE Tools menu: upload speed 115200
2) opt this one in tools menu: Programmer- AVR ISP
3) Keep serial monitor closed. If com port not visible under Tools, disconnect and reconnect USB from laptop
4)Reset Arduino
5)Connect GPIO0 of 8266 to VCC(3.3V) for a blink and remove
6) Connect reset of 8266 to gnd for a blink and remove
7)GPIO0 grounded..keep this one gnded for the upload period
Hope this one works..

Unable to communicate with ESP8266 via Arduino Uno

I recently bought an ESP8266 (ESP-01, 1M) yet I have been unsuccessful in making it respond at all.
I have attempted to communicate with it using an Arduino Uno running the built-in BareMinimum script (and also the script described here) to work like an FTDI.
However, when any AT commands are sent to it via the Serial Monitor there is no response whatsoever using either approach.
The red power LED is on, yet the blue LED is always off.
My wiring:
GND - GND
RX - RX
TX - TX
VCC - 3v3
CH_PD - 3v3
I would love some clues as to how to solve this error,
Okay, seems like the same problem I spent hours.
Your Arduino TX has a high level of 5V. If you send a message to your ESP with this voltage you will (surely) destroy it. And I think thats happend to you.
So you have to buy a new ESP.
For the next try:
If you use a baudrate of 9600 you can just use two 10kOhm resistors to half your TX voltage. (I did this already and it worked without problems)
For sending a message to your Arduino 3.3V from your ESP are enought.
For higher baudrates you can use a logic level converter: https://learn.sparkfun.com/tutorials/using-the-logic-level-converter

Arduino bootloader sequence

I have put together a Bareduino which is an ATmega328 on a breadboard. I have a transceiver chip (MAX233) connected to it and to my serial port adapter on my laptop. I haven't been able to upload any sketches yet. What is the bootloader sequence? Does the Arduiono send out a character first or does the IDE? What is it looking for?
I have a manual reset button. The ATmega328 comes with a bootloader and a program already in it to blink an LED on D13 (chip pin 19). The LED is blinking on and off at one second intervals so it appears to be running. I have ordered an FTDI board, but I scrounged up a MAX233 and thought I would give it a try. Sorry, not a coding question, but I am interested in learning about the bootloader sequence.
On bootlup, the Arduino waits for a signal from the IDE, if it doesn't get one, it runs the local program. Are you getting timeouts? Are you selecting the right com port and board type? depending on the boot loader installed on your chip, try duemilanove or uno. do you have the capacitor for auto reset installed?
see http://www.instructables.com/id/The-Embedded-Arduino-building-an-Arduino-into-a-p/

Resources