ESP8266 lua WiFi - failed to flash program with arduino IDE

Hi guys.
I'm trying troubleshoot an annoying issue for a few days.
I've seen it quite common on Google search and also here in this forum, yet I can't find solution to my case yet, so I thought to try to hit a topic.

I have a micro-controller "NuaMCU Module Lua WiFi, V3, ESP8266, ESP-12E, CP2102"
I was successfully programming and flashing my codes into this chip and running it for few weeks,
yet few days ago I had some bugs in the program and I tried to flash again,
but all of the sudden the Arduino IDE shows "connecting.....------......" while the chip has blinking blue led and after a while I get

FatalError('Failed to connect to %s: %s' % (self.CHIP_NAME, last_error))
esptool.FatalError: Failed to connect to ESP8266: Timed out waiting for packet header

I tried to follow so many suggestions I found on google, I tired to hit the "flash" button (although I never needed it before!) and I tried to hold, reset, reboot my laptop, reinstall the drivers, the boards.. nothing seems to work!
The chip seems to understand the Arduino IDE try to communicate with it, as while I have the "connecting...---..." the blue led flashes and stop flashing when the IDE doesn't try to connect anymore.

I assume I might hit the flash button before, or pull high the D4 (GPIO02) leg, as I have button connected there.. which result in the dead loop I have no which I can't flash my program anymore.
It also seems that the chip has no more my program in it, as if I'm connecting the LCD use to be connect it doesn't show any output as it used to be..

I am helpless in finding any more solutions, if someone can help I will much appreciate that!

Thanks,
Ran

so Lua is a programming language used with the NodeMcu firmware for which the NodeMcu board was developed. your question has nothing to do with the Lua language and the NodeMcu firmware.

what version of esp8266 arduino boards package do you use and what are your Tools menu selections?

Thanks for writing me here!

Ok, so the ESP8266 board version is 2.7.2 (I tried to downgrade it to 2.6.0 as a trial but didn’t help)
My tool selection is the following in attachments (I haven’t changed it as it used to work!)

ranbracha:
Thanks for writing me here!

Ok, so the ESP8266 board version is 2.7.2 (I tried to downgrade it to 2.6.0 as a trial but didn't help)
My tool selection is the following in attachments (I haven't changed it as it used to work!)

so try this:
hold the flash button pushed
do a reset with the reset button
release the flash button.
try to upload from IDE

if it doesn't work, try
hold the flash button pushed
do a reset with the reset button
try to upload from IDE
release the flash button.

I tried both options now (and also before)
same error, same issue that it doesn't seem to be success connecting...__...
the real thing is that while it shows "connecting...____...." some inner led is blinking,
like the computer tries to communicate with the port and it does reach the chip.

I tried also to downgrade to esp8266 board version 2.5.0 (I saw this suggestion in the forum)
and then when I tried to upload I got:

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

I assume is same error as shows in board version 2.7.2 just different way of writing it..

could it be that my chip is totally dead somehow?

I tried to read the Serial Monitor on the port the chip is connected to my computer.
I simply tried to see each baud rate what it gives right after pressing the reset button.
All seems to be junk and gibbrish, beside baud rate 74880 that gives:

 ets Jan  8 2013,rst cause:2, boot mode:(7,7)

waiting for host

Right after pressing the reset button.

I don't know if it can help the troubleshooting, but that's the only piece of information I get so far from the chip..

you have io 15 pulled-up. is something wired to D8? the esp8266 goes to host boot mode. for normal boot io 15 must be LOW

I don't have something connected there.
But I tried to connected there something when the whole problem start, I think..
I tried to switch with an INPUT button signal from D4 to D8, because it was more convenient for my soldering design.
Anyway, somehow, I'm not sure how.. after playing with the IDE upload baud rate + connecting higher voltage to the Vin + grounding D3, pressing reset, pressing flash.. somehow I played with all those and suddenly the connecting was connected and uploaded again my sketch.

But I do believe something is going still weird. I placed back the definition of D4 to be INPUT leg and I have it ground with 10k resistor + connected to a switch from the 3v3 power supply leg of the chip, like the famous simple push button design. the button works and do what it needs to do when the device is up, BUT from some reason on the very first boot when the device connected to power supply it assume D4 goes high and executing the code under the IF D4 is high, just 1 running on the boot then it doesn't do it again unless I press the button.
And I wonder why.. I mean.. I can't use D4 neither now?

I'm curios what is your opinon!
Thanks,
Ran

D4 (io 2) is a boot config pin too. it has a pull-up resistor on board. it must be HIGH at boot

What are the safe IO that I can use using my board?
It seems that all IO's has some importance to be left disconnected at boot :frowning:

Thanks