Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By ramil13
#67777 Hi guys, i have a question regarding storing programs in the ESP8266 Nodemcu chip.

Am i able to store a user program permanently in the chip? How could i go about doing that? Currently I am using Lualoader or Esplorer to upload the code into the chip. But when i remove the USB it forgets everything once it looses power.

The reason why I am asking this is because I plan on putting a power supply onto the chip and there will always be sometimes electricity loss and i don't want it to just lose power and forget everything. I want it to just go back to wat it was doing before it lost power but that wont be possible if it forgets everything once power is lost.
User avatar
By bmscott
#68646 Hiya - just getting started trying to reprogram some Sonoff switches to work with MQTT using the Arduino IDE and the project.

I can't seem to connect to the ESP8266 at all - I just get espcomm_sync failed followed by a series of (presumably) related messages. I'm using an FT232RL (probably a clone) from

I'm pretty sure I have the connecting wiring correct, and I've tested that the voltage at VCC and also TX/RX to GND is 3.4ish volts. The FT232RL board passes a loopback test.

I've set the Arduino IDE to 115200 baud, 1M flash size (Tried every SPIFF variation) and ESP8266 generic for board type. I'm on Linux Mint, on an Optiplex 990, FWIW.

I've tried powering the Sonoff board separately. I'm pretty sure I've rebooted it into programming mode by holding down the button while powering it up, although there's no visual indication or - as far as I'm aware - any other way to confirm this. The Sonoff, when connected to a 220V source, appears to work, insofar as the LED comes on and I can hear the relay click when I push the button.

I've already ordered a few other USB-TTL boards, not to mention a few other ESP8266-related boards, but they'll take a while to arrive. What else can I do in the meantime to troubleshoot?

    The USB-TTL board could be a dud
    The headers on the Sonoff could be poorly soldered, or I may even have damaged the board
    I'm overlooking some library or setting or dunno what else
    Maybe that gypsy I killed a few years ago meant what she said about a curse

Can I set up a way to flash the Sonoff board from one of my Arduinos directly? Is there some other way to test the USB-TTL board? Should I try my poor soldering skills on my (currently) only other Sonoff board?
User avatar
By timg11
#68721 Hi @bmscott, I'm struggling with the same thing. I have a new Sonoff swith module that won't communicate.
I first tried programming with the Arduino IDE, but get "espcomm_open failed" and other errors.
I saw a recommendation to use esptool to erase the flash. I tried but get
Code: Select allA fatal error occurred: Failed to connect to Espressif device: Invalid head of packet ('\x00')

I found a post on this blog, that says
"if you have newer sonoff module, yeah the button is NOT D0. the clear difference on those is, the switch button that connect to D0 has no hole for LED on plastic cover. The other module that switch button not connected to DO has hole for LED on plasti cover. If you get newer model, you need to mod a bit. search ot Scargill newer post."

I do have the no-hole for the LED cover, so I'm assuming it has the "D0 is not the button" problem.
That would mean the Sonoff is not going into the programming mode with the button.
Unfortunately, I have searched through the blog at, but cannot find any more information on this modification, or how to fix it.

Presumably I'll have to connect another button to the real D0.
User avatar
By QuickFix
timg11 wrote:Presumably I'll have to connect another button to the real D0.

Not presumably: you really have to connect GPIO0 to ground, otherwise the ESP will never go into programming mode.

I don't own a Sonoff (of any kind, old or new), so I can't help you directly, but it should be fairly easy to figure it out yourself.
Get a magnifying glass, locate the ESP8266EX-chip on the board and see if (and where) the pin, indicated below, goes to:
Connect that pin to ground while resetting the Sonoff and you should be in programming mode. :idea: