-->
Page 1 of 2

Problem when booting after flashing nearly same code

PostPosted: Fri Jul 15, 2016 9:44 am
by Jep
Hi guys,

I've been investigating for several weeks and I'm pulling my hears out!! :(
Hope you'll be able to help me ...

I have an ESP12E that I'm flashing using the Esptool from Arduino Ide:
Here is the command line I can find in the logs:
...\tools\esptool\0.4.8/esptool.exe -vv -cd nodemcu -cb 115200 -cp COM6 -ca 0x00000 -cf E:\__tmp\buildd89e9f5c82f49f82ee604e073232f83b.tmp/test.ino.bin

The problem I have is quite tricky to explain since it seems to be completely crazy!
Suppose I have a simple code that is working after boot, if I just add a new variable or remove a line somewhere it can just not boot correctly after flashing.

As I considered it could be a flashing issue, I tried to just build my BIN file using Arduino IDE and flash it using an external flasher (esptool.py) and it appears that it was better sometimes.
However I still have cases where I add a line in the code and it does not boot up after flashing.

To investigate a bit further, I replaced option -vv with option -vvv for esptool.exe (called from Aduino IDE) to get extra logs from flashing process and I discovered something interesting:

It seems that each time I don't encounter any problem, I have the following ending for flashing:
Code: Select all      espcomm_send_command: response 0x20120707
.      espcomm_send_command: sending command header
      espcomm_send_command: sending command payload
      espcomm_send_command: receiving 2 bytes of data
      espcomm_send_command: received 2 bytes:
      0x00
      0x00

      espcomm_send_command: response 0x20120707
.      espcomm_send_command: sending command header
      espcomm_send_command: sending command payload
      espcomm_send_command: receiving 2 bytes of data
      espcomm_send_command: received 2 bytes:
           0x00
      0x00
      espcomm_send_command: response 0x20120707
.
starting app without reboot
   espcomm_send_command: sending command header
   espcomm_send_command: sending command payload
   espcomm_send_command: receiving 2 bytes of data
      espcomm_send_command: received 2 bytes:
      0x01
      0x06
      espcomm_send_command: response 0x20120707
closing bootloader
   flush start
   setting serial port timeouts to 1 ms
      flushed 0 bytes
   setting serial port timeouts to 1000 ms
   flush complete


But when the ESP does not boot correctly, I find many "0x00 0X07" in the received 2 bytes from the "espcomm_send_command" as shown above:

Code: Select all      espcomm_send_command: response 0x20120707
.      espcomm_send_command: sending command header
      espcomm_send_command: sending command payload
      espcomm_send_command: receiving 2 bytes of data
      espcomm_send_command: received 2 bytes:
      0x00
      0x07
      espcomm_send_command: response 0x20120707
.      espcomm_send_command: sending command header
      espcomm_send_command: sending command payload
      espcomm_send_command: receiving 2 bytes of data
      espcomm_send_command: received 2 bytes:
      0x00
      0x07
      espcomm_send_command: response 0x20120707
.
starting app without reboot
   espcomm_send_command: sending command header
   espcomm_send_command: sending command payload
   espcomm_send_command: receiving 2 bytes of data
      espcomm_send_command: received 2 bytes:
      0x01
      0x06
      espcomm_send_command: response 0x20120707
closing bootloader
   flush start
   setting serial port timeouts to 1 ms
      flushed 0 bytes
   setting serial port timeouts to 1000 ms
   flush complete


What do those received bytes mean?
Can they be due to flashing errors?
The only thing that changes between flashings that work and those that don't is the binary file itself!
I tried to change baud rate but it does not change anything as it is binary linked.

Hope so much that someone could help! :idea:
thanks

Re: Problem when booting after flashing nearly same code

PostPosted: Fri Jul 15, 2016 12:10 pm
by Jep
I just found that thread on github
https://github.com/esp8266/Arduino/issues/95
Really seems to be the same behaviour as mine ...

Re: Problem when booting after flashing nearly same code

PostPosted: Sat Jul 16, 2016 12:03 pm
by Jep
Hello,

Me again with some news on my problem :)
- I tried to flash the binary that did not boot up with a very low baud rate (9600) => was still KO
- I tried with a very high baud rate (256000) and surprisingly it worked! :?
I thought it was definitely OK but I tried another binary and it failed again.
So, hard to conclude ... it seems it depends both on the binary (maybe some particular patterns of 1 and 0 in it) and on the flashing baud rate or tool.

Let's say it can be a FTDI cable issue ...
(I don't have the NodeMcu board and I use an external FTDI cable)

Am I the only one working directly with on a ESP12E chip (not embedded on the NodeMcu board) and facing this kind of bug??

Re: Problem when booting after flashing nearly same code

PostPosted: Tue Jul 19, 2016 2:35 pm
by Jep
Still nobody facing the same problem?
I'm afraid I'll have to buy a Nodemcu board to get rid of the potential FTDI cable issue ... :cry: