Arduino icon indicating copy to clipboard operation
Arduino copied to clipboard

Unable to load the code from arduino ide to esp8266

Open jyotirajsharma opened this issue 9 years ago • 58 comments

Hi,

I am unable to load the code from arduino ide to esp8266 Sketch uses 232,505 bytes (53%) of program storage space. Maximum is 434,160 bytes. Global variables use 32,504 bytes (39%) of dynamic memory, leaving 49,416 bytes for local variables. Maximum is 81,920 bytes. error: failed reading byte warning: espcomm_send_command: cant receive slip payload data error: failed reading byte warning: espcomm_send_command: cant receive slip payload data error: failed reading byte warning: espcomm_send_command: cant receive slip payload data error: failed reading byte warning: espcomm_send_command: cant receive slip payload data error: failed reading byte warning: espcomm_send_command: cant receive slip payload data error: failed reading byte warning: espcomm_send_command: cant receive slip payload data error: failed reading byte warning: espcomm_send_command: cant receive slip payload data error: failed reading byte warning: espcomm_send_command: cant receive slip payload data error: failed reading byte warning: espcomm_send_command: cant receive slip payload data warning: espcomm_sync failed error: espcomm_open failed error: espcomm_upload_mem failed error: espcomm_upload_mem failed

Please help me to resolve this issue.

jyotirajsharma avatar Dec 27 '16 18:12 jyotirajsharma

I've just recently installed the Arduino version 1.8.0 IDE and loaded the third party ESP8266 extensions. I've seen these same messages as well. However, it does seem that the code is being downloaded and is running on the board.

There is likely a bug related to these messages, and, perhaps they are an indicator that you should retry the download.

But, if you just want to continue to make progress, you should look to see if your board is actually running the software. (Perhaps you can ignore the messages and get on with it!)

matthew

P.S. If you want more attention given to this bug report, you should include specific details about what versions of the IDE, what board you are using, etc...

mcolinj avatar Jan 01 '17 00:01 mcolinj

@mcolinj , You mean esp8266 what we got does not have software flashed into it and we need to flash it externally using esptool ? How to see if my board is actually running software or not. I am using arduino-1.6.12 IDE and esp8266 board.\

Have you got it working now ?

jyotirajsharma avatar Jan 01 '17 00:01 jyotirajsharma

Connection Diagram 1: Arduino Uno Esp8266 TX---------------------RX RX---------------------TX 3.3V-------------------VCC 3.3V--------------------CH_EN GND--------------------GND If I use as per above configuration, I am getting following error while trying to upload the arduino IDE code- error: failed reading byte warning: espcomm_send_command: cant receive slip payload data

I have various forums and they suggested that

  1. GPIO_0 of esp8266 should also be connected to GND. I think putting GPIO_0 to GND will make it in flash mode. While trying to upload the code, I am getting below error-

warning: espcomm_sync failed error: espcomm_open failed error: espcomm_upload_mem failed error: espcomm_upload_mem failed

Also seen some diagram that they connected RESET pin of Arduino is connected to GND.

Please suggest what should be the exact connection diagram.

jyotirajsharma avatar Jan 01 '17 00:01 jyotirajsharma

What I was saying is that you were seeing that error message when you were trying to flash the software onto your esp8266 board, correct?

Several days ago, I saw the same messages as well, but I was able to try it again (even seeing similar messages) and my software was flashed onto the esp8266 board. Just to be sure, I loaded the blinky LED software (which blinks once every 2 seconds). I modified it to blink rapidly, and, even though the I received those error messages. This is how I determined that the resulting new code has been flashed and was running on the board.

Yesterday, I chose a menu item under the Tools menu to set the “Upload Speed” to 115200, and it seems that the upload/flash process is more reliable. I don’t see those messages at all any ore. I don’t know if you have that option (I think it is board specific, but I have my board set to WeMos D1 (Retired), as that is the device configuration recommended for developing with the NodeLink ESP8266 D1 board.

good luck,

matthew

On Dec 31, 2016, at 7:22 PM, jyotirajsharma [email protected] wrote:

@mcolinj https://github.com/mcolinj , You mean esp8266 what we got does not have software flashed into it and we need to flash it externally using esptool ? How to see if my board is actually running software or not. I am using arduino-1.6.12 IDE and esp8266 board.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/esp8266/Arduino/issues/2801#issuecomment-269887144, or mute the thread https://github.com/notifications/unsubscribe-auth/AQbN8XpVEHZPpjavOdMIUTfSi0wlSyrqks5rNvGpgaJpZM4LWb3w.

mcolinj avatar Jan 01 '17 16:01 mcolinj

Yes, while trying to flash the esp8266 (connect GPIO_0 of esp8266 to GND). Upload speed is 115200 bps only. I put more verbose logs and got following errors. trying to connect flush start setting serial port timeouts to 1 ms setting serial port timeouts to 1000 ms flush complete espcomm_send_command: sending command header espcomm_send_command: sending command payload serialport_receive_C0: F8 instead of C0 resetting board trying to connect

warning: espcomm_sync failed error: espcomm_open failed error: espcomm_upload_mem failed

jyotirajsharma avatar Jan 01 '17 18:01 jyotirajsharma

I tried to compile and upload a code to esp-12f (ch340g) and got the same message when I didn´t put in flash mode and upload speed was 256000. Setting both mistakes right, the software was uploaded.

Arduino: 1.8.0 (Windows 7), Placa:"Generic ESP8266 Module, 80 MHz, 40MHz, DIO, 256000, 512K (64K SPIFFS), ck, Disabled, None" ... trying to connect flush start setting serial port timeouts to 1 ms setting serial port timeouts to 1000 ms flush complete espcomm_send_command: sending command header espcomm_send_command: sending command payload serialport_receive_C0: F8 instead of C0 warning: espcomm_sync failed error: espcomm_open failed error: espcomm_upload_mem failed error: espcomm_upload_mem failed

When I forgot only the flash mode, only the message below changed: serialport_receive_C0: 2E instead of C0

cyyamazaki avatar Jan 01 '17 22:01 cyyamazaki

I did not understand- "Setting both mistakes right, the software was uploaded." Can you plz let me know how it was uploaded?

jyotirajsharma avatar Jan 01 '17 23:01 jyotirajsharma

Do i need to supply 3.3v from external source to esp8266 ? For now, I provided it from Arduino 3.3v to esp8266?

jyotirajsharma avatar Jan 03 '17 11:01 jyotirajsharma

Please suggest if possible.

jyotirajsharma avatar Jan 03 '17 15:01 jyotirajsharma

Sorry for my english. I speak portuguese and English is a second language for me.

Yes, it´s better supply a good 3.3 v to the board, like the forums say. As I used a integrated programmer (like thishttps://www.aliexpress.com/item/ESP8266-serial-WIFI-Witty-cloud-Development-Board-ESP-12F-module/32557886226.html?spm=2114.01010208.3.292.dxkXg8&ws_ab_test=searchweb0_0,searchweb201602_5_10065_10068_10000009_10084_10083_10080_10082_10081_10060_10062_10056_10055_503_10054_10059_10099_10078_501_10079_426_10103_10073_10102_10096_10052_10053_10050_10107_10051_10106-501_503,searchweb201603_4,afswitch_5&btsid=2c86b91c-85ea-40f8-9189-054123f75ac2), it supplies my board just by an USB cable. I just used a LM1117 for this too and a cell phone adapter with a CP2102 and it works, too.

In the thread, I said I set the speed to 115.200 and keep the flash button pressed during the upload (i think the GPIO00 is used to this) and the upload was fine.

To repeat identically your error message, i set the speed to 256000 and did´nt press the flash buttton. But may be another errors to cause the same message.

I hope it could be usefull for you.

cyyamazaki avatar Jan 03 '17 23:01 cyyamazaki

Try to connect The GPIO0 with a 10k resistor to ground and the CH_PD to VCC and it works :)

rousnay avatar Jan 16 '17 12:01 rousnay

I ran into same Problems with flashing esp-01 modules. While i need a bunch of them (>50 pcs) i ordered some CH340G-USB-Programmer from aliExpress. they work well for flashing the esp-01 modules, but i still have to connect GPIO-0 -> GND and CH_PD -> VCC.

But then it works like a charm. I used both Arduino IDE (1.8.0) and esptool. I'm running arch Linux .

When you use a simple UART-USB adapter to flash the ESP-01, take care of the power supply while most UART Programmers didn't supply the needed ~200mA for flashing the ESP-01.

darthm0e avatar Jan 25 '17 16:01 darthm0e

Seems like this thread is basically the same problem.

Did this work? Just signed up yesterday, but there should be a link to a similar problem above. However, I'll also copypaste my post from there into here, because I had the same problem and got it working now (even if there is still the problem of the esp seemingly hanging up after a couple minutes):

Copypaste begins here:

TL,DR: I solved my problems (warning: espcomm_sync failed etc.) by replacing the 10k resistor between GPIO00 and GND I used first with a 3.9k resistor.

Long Version: I was also starting to feel a little irritated after sitting in front of this problem last night and today. But just about an hour ago I managed to solve my problem. Initially my Setup is the ESP-12S on the typical white adapter board. VCC to 3.3V, GND to GND, CH_PD (or EN on other chips) and GPIO02 pulled high with 10k (although CH_PD should be high anyways with the layout of the adapter board, turning the two parallel 10k resistors effectively into a 5k), GPIO15 and GPIO00 pulled low with 10k (although GPIO15 should also be pulled low by the 10k on the board thus making the duo 5k as well). 0.1uf and 47uf are placed across VCC/GND. Power is supplied by the PSU from the Elegoo "The Most Complete Starter Kit". USB-to-Serial is done with one of these http://www.ebay.de/itm/272461294802?_trksid=p2060353.m1438.l2649&ssPageName=STRK%3AMEBIDX%3AIT , connecting the TX/RX/GND pins. For programming I use the Arduino IDE 1.6.12 with the esp-library.

The problem: I get the " warning: espcomm_sync failed error: espcomm_open failed error: espcomm_upload_mem failed error: espcomm_upload_mem failed " messages. Turning up the verbosity during upload reveals these lines as well: " trying to connect flush start setting serial port timeouts to 1 ms setting serial port timeouts to 1000 ms flush complete espcomm_send_command: sending command header espcomm_send_command: sending command payload espcomm_send_command: receiving 2013 bytes of data read 0, requested 1 error: failed reading byte warning: espcomm_send_command: cant receive slip payload data "

It is the Serial Monitor that will give me an idea what might be the problem: On 115200 Baud it shows me something like this: " garbage_data (This is actually the bootloader reporting stuff on 74880 Baud) AI-Thinker something something

ready " On 74880 Baud it reports a bunch of stuff, but most interesting is the very first line: ets Jan 8 2013,rst cause:2, boot mode:(3,6).

Testing reveals: When connecting GPIO00 to high for normal boot - the Serial Monitor shows exactly the same.

Oh.

Ahhhh!

No wonder I can't program the chip if it isn't even in the right mode! The 10k resistor seems to be too much for GND to properly register at GPIO00, thus not starting the UART Mode (programming mode) but Flash Mode (normal boot) instead.

I replaced the 10k (probably, I mean, I didn't measure it, but the other ones from the same batch from China seem to be 10k) resistor between GPIO0 and GND with a 3.9k. Voila, " writing flash ................................................................................ [ 34% ] ................................................................................ [ 69% ] ..................................................................... [ 100% ] starting app without reboot " (and some more lines before and after).

Also, the proper behavior of the Serial Monitor when starting the esp in UART Mode seems to be to show only one line of garbage data on 115200 Baud which is revealed as " ets Jan 8 2013,rst cause:2, boot mode:(1,7) " on 74880 Baud. Dates might differ, of course.

Sephok avatar Apr 10 '17 00:04 Sephok

So I got exactly these error messages on a ESP8266 mounted on a dev board. To resolve the problem I had to keep the flash button pressed while flashing (output below). Here's a screenshot of my board with the flash button highlighted

esp 8266 dev board

Archiving built core (caching) in: /var/folders/90/ppjzg_ws355456nzj843tvgh0000gn/T/arduino_cache_494362/core/core_esp8266_esp8266_generic_CpuFrequency_80,FlashFreq_40,FlashMode_dio,UploadSpeed_115200,FlashSize_512K64,ResetMethod_ck,Debug_Disabled,DebugLevel_None_____77a656e245c3f7119ecc0a74f86b36b1.a
Sketch uses 238685 bytes (54%) of program storage space. Maximum is 434160 bytes.
Global variables use 33444 bytes (40%) of dynamic memory, leaving 48476 bytes for local variables. Maximum is 81920 bytes.
Uploading 242832 bytes from /var/folders/90/ppjzg_ws355456nzj843tvgh0000gn/T/arduino_build_265999/firmata.ino.bin to flash at 0x00000000
................................................................................ [ 33% ]
................................................................................ [ 67% ]
..............................................................................   [ 100% ]

j0hnsmith avatar Apr 30 '17 21:04 j0hnsmith

For me, under Microsoft Windows, I've just changed the driver in Ports (COM and LPT) from RAMPS to USB-SERIAL CH340 (with update driver) and all works fine now ...

WolfCreations avatar May 20 '17 21:05 WolfCreations

node Just change Reset method to nodemcu.

nafizb avatar May 28 '17 16:05 nafizb

@nafizb thanks, your settings solved to my ch340 esp8266 based image

maxalone avatar Jun 13 '17 08:06 maxalone

What fixed it for me was uploading the bare minimum sketch to the arduino

zivanov avatar Jun 23 '17 18:06 zivanov

I had the same problem and fixed with the following 3 steps:

  • I connected D3 to GND and D8 to GND with simple jumper cables.
  • I took out every single USB device connected to my machine. (Keyboard, Mouse, Monitor extension)
  • Upload the Bare Minimum Sketch

vikibaarathi avatar Jun 26 '17 09:06 vikibaarathi

I had the same issue using NodeMCU Amica. I got it fixed just starting the upload process keeping FLASH button pressed. After upload starts the button can be released. No external supply. No external resistors.

On Arduino IDE (assuming package esp8266 is installed), select Board NodeMCU 1.0, baud rate 115200.

devfilipe avatar Jul 23 '17 01:07 devfilipe