1
\$\begingroup\$

I recently bought a Wemos D1 mini V2 WiFi module (like this one). I want to upload my own code using the Arduino IDE.

For testing purposes, I'm now trying to upload some simple code. I've installed the "esp8266 by ESP8266 Community" package in the Arduino IDE Boards Manager. After the module had been discovered by the IDE, I chose the /dev/ttyUSB0 port.

When I try to upload code to the Wemos module, here is what I see in the output:

. Variables and constants in RAM (global, static), used 28104 / 80192 bytes (35%)
║   SEGMENT  BYTES    DESCRIPTION
╠══ DATA     1496     initialized variables
╠══ RODATA   920      constants       
╚══ BSS      25688    zeroed variables
. Instruction RAM (IRAM_ATTR, ICACHE_RAM_ATTR), used 59667 / 65536 bytes (91%)
║   SEGMENT  BYTES    DESCRIPTION
╠══ ICACHE   32768    reserved space for flash instruction cache
╚══ IRAM     26899    code in IRAM    
. Code in flash (default, ICACHE_FLASH_ATTR), used 232100 / 1048576 bytes (22%)
║   SEGMENT  BYTES    DESCRIPTION
╚══ IROM     232100   code in flash   
esptool.py v3.0
Serial port /dev/ttyUSB0
Failed uploading: uploading error: exit status 2

This error is very vague and I don't know what could cause this problem. What bothers me is that none of board configurations available exactly match my WiFi module. I've got a Wemos D1 mini but with "V2" at the end (which I presume means "version 2"). Does it mean I can use the configuration for the "D1 mini"?

I've also looked for specifications on this website, but none of pictures available there match what my board looks like.

I'm a little confused, could you please help me identify how I should set up this board correctly?

enter image description here

\$\endgroup\$

5 Answers 5

1
\$\begingroup\$

I have the same problem with the WEMOS LOLIN D1 mini (clone) board in Arduino IDE 2.0.3. I'm just a beginner. An error appears:

"Upload failed: upload error: exit status 2"

Recording of code works again only after restarting the PC, I found out that it occurs after turning on the Serial monitor function while working with the Arduino IDE.

By simply trying different settings, I found out how to solve the problem:

  1. first disconnect the ESP8266 from the USB port
  2. connect the ARDUINO NANO (or other type of Arduino) to the USB port
  3. mark (check) the USB port of the Arduino
  4. turn off the Serial Monitor while the Arduino is still connected
  5. disconnect ARDUINO and connect ESP8266
  6. mark (check) the ESP8266 port and it will work until you turn on the Serial monitor again...

Is it a bug in ARDUINO IDE 2.0.3 or is it a bug in the WEMOS LOLIN D1 mini board?

\$\endgroup\$
0
\$\begingroup\$

I have installed new version 2.0.4 and the same problem I had.

After changing the upload speed from 115200 to 256000 The problem disappeared.

For 2.0.4 Tools>Upload Speed > 115200 ->256000

\$\endgroup\$
1
  • \$\begingroup\$ My board is not WEMOS LOLIN but NodeMCU 1.0(ESP-12E) \$\endgroup\$
    – user334342
    Commented Mar 5, 2023 at 9:34
0
\$\begingroup\$

For me the reason was that I was lacking the permission on the /dev/ttyUSB0 device. This can be checked with:

ls -l /dev/ttyUSB0

If it looks like this:

crw-rw---- 1 root uucp 188, 0 11. Mar 12:51 /dev/ttyUSB0

you might be lacking the permission. You can either change the permission of the device, or (recommended) add yourself to the uucp group.

groups
sudo usermod USERNAME -aG uucp 
\$\endgroup\$
0
\$\begingroup\$

Turned OFF the Serial Monitor before upload and all is good.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ What do you mean by all is good? Did that fix the error? \$\endgroup\$
    – Voltage Spike
    Commented Mar 16, 2023 at 5:52
0
\$\begingroup\$

Had another sketch open for an arduino Nano at the same time as the one for a generic 8266, not D1, which was giving this error. I closed the Arduino Nano sketch, disconnected the 8266 reconnected and uploaded to the 8266 ok this time.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.