So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By Nicolas BONNIOT
#76758 Hello,
I'm a newbie and it seems that I bricked my NodeMCU Amica (ESP8266) board... But perhaps not in the "usual" way. I'm on Ubuntu, flashing with esptools and my IDE is ESPlorer (so using Lua).
Here is the steps I did
    Flash the MCU successfully with firmware generated using the cloud service
    Make LED blink successfully using ESPlorer (115200 bauds, /dev/ttyUSB0)
    Make the infinite loop error in init.lua...
    Manage to get it through by erasing flash (firmware + user program space)
    Reflash it successfully
    Start more elaborate booting sequence : instead of using timer, I wanted to test GPIO 0 state : if low, go to "program mode" by returning, if high, continue normal startup sequence

I successfully sent my primitive test with GPIO 0, and it worked as expected (writing "program mode" when GPIO 0 low on startup, and "run mode" when it's high.

But now, I can't manage to connect my board with esptools. It fails with :
Code: Select allesptool.py v2.4.1
Found 1 serial ports
Serial port /dev/ttyUSB0
Connecting........_____....._____....._____....._____....._____....._____....._____
/dev/ttyUSB0 failed to connect: Failed to connect to Espressif device: Timed out waiting for packet header


If I try to edit my init.lua from ESPlorer, I get always
Code: Select all> Waiting answer from ESP - Timeout reached. Command aborted.


My code :
init.lua
Code: Select alldofile('crazy-guard.lua')


crazy-guard.lua

Code: Select allgpio.mode(0,gpio.INPUT)
programPinValue = gpio.read(0)

if(programPinValue == 0) then
    print("Program mode")
    return
else then
   dofile('program.lua')
end


program.lua
Code: Select alldofile("credentials.lua") -- get Wifi credentials
gpio.mode(pin,gpio.OUTPUT)
while true do
 
end


I thought that with the return if GPIO 0 is low, I could easily reprogram my nodeMCU... But I can't even manage to flash again.

Furthermore, when I establish connection from ESPlorer, I get this header (meaning for me that hardware connection problem isn't at stake) :

PORT OPEN 115200

Communication with MCU..Got answer! Communication with MCU established.
AutoDetect firmware...

Can't autodetect firmware, because proper answer not received (may be unknown firmware).
Please, reset module or continue.
ld����#�n � l� #|���2�{���b��no�lNn��� cp��$rdrlp�n� � d  bN�|��䎟� c��oN�d��$`�no�s$or���N rld p�n� r����� b N��o�l�p��on��l �oN �ln{���o �l p�N� r����� b N�|l섎p��on��l �no �{lNs���� �{${��o �{$����n�{��n|�lll$`b� �|{�l�n��n�l`��r�l�$� $`��{�l�$� l`��{�l ��� dl`rl��o��bc ��cp| "p���p����lB��N�Nn�ld��l�� d�$��� �$��d �n����b l$��2b ���"l�crlr

NodeMCU custom build by frightanic.com
branch: master
commit: 5073c199c01d4d7bbbcd0ae1f761ecc4687f7217
SSL: false
modules: file,gpio,http,i2c,mqtt,net,node,ow,tmr,uart,wifi
build built on: 2018-03-22 17:00
powered by Lua 5.1.4 on SDK 2.1.0(116b762)


I will be very grateful to anyone that could help me a bit on this one...

Thanks for your leads/opinions.

Nicolas
User avatar
By cubbieco
#76889 I'm just a newbie to this chip as well but you didn't say it so I'll ask are you using the flash button on the board? When I start up my ESP8266 with the flash button held down it won't run the program but just wait for the flash. Sorry if this is obvious but you didn't mention it one way or another so I just thought I'd ask.
User avatar
By Nicolas BONNIOT
#76935 Erratum : it seems that I make a lot of newbie mistakes...
    I realize looking closer to schematics that my test program above is using D0 from devkit (so GPIO16) and not GPIO0 as I stated.
    My loop on program.lua is completly useless and counterproductive regarding the reactive programming that should be at stake here.

Nonetheless, I still don't get the reason why I can't flash/erase (actually connect) my devkit anymore. I still try to test with boot mode choosing
User avatar
By QuickFix
#76961 In the last couple of years I played with ESP's I've never been able to actually brick a single one by software (I'm not saying that it can't be done, just that I never have).
In the beginning it sometimes looked as if I'd done it, but in the end I was Always able to revive them.

As long as you get a response over serial and have never overpowered it (eg. giving it 5V for dinner), you should (in theory) be able to save an ESP.

I've never used or even tried LUA, but have you tried to reflash it with the default Espressif AT-command firmware yet?
Or install the Arduino IDE (of course with the ESP8266-core) which is pretty much plug-and-play and foolproof. :idea: