Exit status 2 error occurs when uploading code to ESP32

This is the compilation that shows up when uploading
Device is ESP32

Compililation:

/usr/local/bin/arduino-cli compile --fqbn esp32:esp32:esp32doit-devkit1:DebugLevel=none,EraseFlash=none,FlashFreq=80,UploadSpeed=921600 --libraries /home/builder/opt/libraries/latest --build-cache-path /tmp --output-dir /tmp/590748714/build --build-path /tmp/arduino-build-B04EE2083656C0332FBA4519FD05D098 /tmp/590748714/Science_Fair_Project_feb20a

Sketch uses 1109389 bytes (84%) of program storage space. Maximum is 1310720 bytes.

Global variables use 51408 bytes (15%) of dynamic memory, leaving 276272 bytes for local variables. Maximum is 327680 bytes.

Upload started

Programming with: Serial

Flashing with command:C:/Users/pc/.arduino-create/esp32/esptool_py/4.2.1/esptool.exe --chip esp32 --port COM5 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x1000 C:/Users/pc/AppData/Local/Temp/extrafiles635412812/Science_Fair_Project_feb20a.bootloader.bin 0x8000 C:/Users/pc/AppData/Local/Temp/extrafiles635412812/Science_Fair_Project_feb20a.partitions.bin 0xe000 C:/Users/pc/AppData/Local/Temp/extrafiles635412812/tools/partitions/boot_app0.bin 0x10000 C:/Users/pc/AppData/Local/Temp/arduino-create-agent543123809/Science_Fair_Project_feb20a.bin

esptool.py v4.2.1

Serial port COM5

Connecting......................................

A fatal error occurred: Failed to connect to ESP32: Wrong boot mode detected (0x1b)! The chip needs to be in download mode.

For troubleshooting steps visit: Troubleshooting - ESP32 - — esptool.py latest documentation


It shows wrong boot mode detected but i dont know how to put chip in download mode.

Which ESP32 board do you have. Some will require you to hold certain pins low during reboot to put into download mode.

Can you post a pic?

Esp32 dev module Wifi and bluetooth enabled

I cant sorry
but its this one

Try disconnecting and reconnecting the USB cable.

Failing that, before you upload, hold down both the BOOT and EN buttons. Release the EN button and you should see a message similar to this...

23:05:02.231 -> rst:0x1 (POWERON_RESET),boot:0x3 (DOWNLOAD_BOOT(UART0/UART1/SDIO_REI_REO_V2))
23:05:02.231 -> waiting for download

Release the BOOT button, and now try to upload.

3 Likes

Im using the arduino online web editor and i cant see any such message...

in the serial monitor?

Nope its not showing

I have the official esp32 dev kit and it works perfectly.
What you have is a clone. Could be fake.

Has the OP tried using the desktop version of the Arduino IDE? I've not switched to the newer IDE version because I note the many issues involving ESP32's. The OP may be encountering another IDE/ESP32 version incompatibility.

It worked perfectly earlier on sir. ill try with another dev kit.
and yes it is the official one

I, the OP, Use the Web editior

Sorry guys it was a mistake on my side​:sweat_smile::sweat_smile:
I was working on a complex opject and i put a connection in the wrong place without noticing...

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