-->
Page 1 of 2

Cannot write code to NodeMCU - espcomm_upload_mem failed

PostPosted: Wed Dec 26, 2018 6:41 pm
by quadrplax
Hello, I recently got a NodeMCU with the ultimate goal of using it a a Milight controller, and so far my attempts to program it have been unsuccessful. I have tried using both PlatformIO in VSCode and the Arduino IDE (version 1.8.0), and in both cases I get the following error messages when uploading code:

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


I am fairly certain I have a NodeMCU 1.0, aka nodemcuv2. It has a CP2102. I have installed the Silicon Labs CP210x USB to UART Bridge and the device shows up on COM3. Just to be sure, however, I tried uploading with NodeMCU 0.9 as well, and it had the same result. I have upload speed set to 115200, CPU frequency 80 MHz, and flash size 4M, trying both 1M and 3M SPIFFS.

I know that I have the COM port correct because when I do attempt to flash the device the LED on the ESP8266 will flash about 3 times during the process. I have ensured my MicroUSB cable works for data and not just power. I have tried pressing down on the ESP8266 while flashing in case the issue is bad soldering, and this had no effect. I have also tried many combinations of pressing and holding the flash and reset buttons.

Another thing I have tried is flashing the firmware. First I tried to do this using NodeMCU Flasher, but it always got stuck in an infinite loop making no progress but causing the LED on the ESP8266 to blink until I stop it. I have also tried to flash the device using esptool.py. It causes the LED on the ESP8266 to blink in the same manner as NodeMCU Flasher, but it results in an error instead of getting stuck in an infinite loop. I get the same error message for simpler commands as well such as chip_id

.\esptool.py --port COM3 --baud 115200 write_flash -fm=dio -fs=4MB 0x00000 ..\nodemcu-master-7-modules-2018-12-26-17-51-00-float.bin
esptool.py v2.6-beta1
Serial port COM3
Connecting........_____....._____....._____....._____....._____....._____....._____

A fatal error occurred: Failed to connect to Espressif device: Timed out waiting for packet header


I'm running out of ideas. This is a brand new NodeMCU from Amazon, so it should be functional. Does anyone have any other ideas on how to fix this problem? Thanks in advance.

Re: Cannot write code to NodeMCU - espcomm_upload_mem failed

PostPosted: Fri Dec 28, 2018 2:30 am
by schufti
In general your proceedings look ok. You shouldn't need to press any buttons.
Did you try another USB cable? Another USB socket? If possible use a 2.0 port (not the blue 3.0).
Try to flash the bare module w/o anything connected.

Re: Cannot write code to NodeMCU - espcomm_upload_mem failed

PostPosted: Fri Dec 28, 2018 4:51 am
by PeterLm
Hi
I had the same problem.
It turned out to be another application taking ower the serial port. It was Cura, for my 3D printer.
Closing this app made it work.
The ESP modules can be a little sensitive when it comes to the USB cables.

Peter

Re: Cannot write code to NodeMCU - espcomm_upload_mem failed

PostPosted: Fri Dec 28, 2018 11:38 am
by quadrplax
schufti wrote:Did you try another USB cable? Another USB socket? If possible use a 2.0 port (not the blue 3.0).
Try to flash the bare module w/o anything connected.



I have tried another cable as well as a port directly on my motherboard instead of through the front panel, with no visible changes in behavior. Most of my testing has been through a USB 2.0 port. I haven't connected anything besides the USB cable to the NodeMCU yet.