Tuesday, April 28, 2015

Esp8266 - Easy Programming - NOT! (or, at least not yet)

UPDATED: see below

I have been playing with my Esp8266 (see previous post). I received these a few weeks ago, but before use, I had to wait to receive a 3.3 Volt USB to Serial Programmer.

Esp8266 Wired and Ready
To work easily with a Protoboard, I removed the original angled header from the Programmer, and replaced it with a "straight down" header. Unsoldering the header was a pain, because it was assembled with Lead-Free Solder, which does NOT melt very easy - I hate that stuff ! - (A note to the Manufacture, the EPA, and OSHA, I was not planning on eating or licking the board, normal 63/37 solder would have be fine  :-)

WIFI Analyzer
Once Wired, the Fun Starts.

Out of the box (the bag actually) this little board seem easy and is interesting to set up. With the help of online resources I was able to send and receive messages from the serial interface.

The supplied "AT+" commands allow you to change the WIFI mode and connect to a local WIFI Access Point.

I use a Cellphone App; "Wifi Analyzer" to see the Esp8266's RF output, along with other local WIFI AP's. 

And, another App; "Net Scan", was used to check for the IP Address as seen from my network.

The ElectroDragon.com web page provides some good instructions and examples, but the way the pages is written as an Image, you can NOT Cut-n-Paste from it, now how dumb is that!

The following is an example of a normal initial dialogue with a Esp8266, recorded here for my future reference (Cut-n-Paste works here). Note: to make the listing shorter, some blank lines have be removed.


c_�� #��FjS�fJ;��
[Vendor:www.ai-thinker.com Version:]







But, NOT all is well in Paradise.

I have managed to "Brick" the first two of my Esp8266's (only 3 more left).

After the initial set up and tests, my desire was to install an application onto the Esp8266, I chose a simple example "Hello World - Web Server" from the specially configured Arduino IDE 1.6.1.

The download (actually Uploading) went as expected, with a status of "Done Uploading". But, that is when the troubles began. I can no longer see the RF output on the WIFI Analyzer, the IP Address does not show up on Net Scan, and the RESET status text sent to the Terminal Window is just Binary Trash, regardless of the Baud Rate or Terminal Settings that I choose.
Binary Trash

Update: With help from Jeff - KO7M, and his Digital Analyser we have determined the "Trash" is a "Reset Message" sent at 74115 Baud (or 74880 baud nominal), most of my usual programming tools do not have that baud rate as an option. But even when forced, no joy:

$ ./esptool.py --baud 74880 -p /dev/ttyUSB* write_flash 0x000000 foo.bin
Erasing flash...
Writing at 0x00000000... (0 %)
Traceback (most recent call last):
  File "./esptool.py", line 538, in <module>    
  esp.flash_block(block, seq)
  File "./esptool.py", line 197, in flash_block
    struct.pack('<IIII', len(data), seq, 0, 0)+data, ESPROM.checksum(data))[1] != "\0\0":
  File "./esptool.py", line 106, in command
    raise Exception('Invalid head of packet')
Exception: Invalid head of packet

We were able to extract binary from a known "good Esp8266", but was unable to flash a "bad Esp8266" with that binary (see above).

Currently I am, "still" Lost.

There is a lot of conflicting information regarding; "How to UnBrick a Esp8266", the suggested programs do not work well with Linux, and the Firmware files were very hard to find. The most helpful online resource seems to be from this blog.

But, so far, I have NOT been able to "UnBrick" my two Esp8266's, they are cheap and I could just toss them, but I want to figure this out.

Here is what I see on a Workstation terminal, note: I am in group "dialout" and have normal write access to /dev/ttyUSB0. I thought that maybe the Serial Data Rate was wrong (see above), but then I can repeat the Arduino re-program just fine, with the proper finished "Done Uploading" report.

$ ls -l /dev/ttyUSB*
crw-rw---- 1 root dialout 188, 0 Apr 28 17:03 /dev/ttyUSB0

$ ./esptool.py -p /dev/ttyUSB0 write_flash 0x000000 AI-v0.9.5.0_AT_Firmware.bin
Traceback (most recent call last):
  File "./esptool.py", line 473, in <module>
  File "./esptool.py", line 151, in connect
    raise Exception('Failed to connect')
Exception: Failed to connect

I am hopeful, . . . and when I do find the answer, I will update this post with additional information.

UPDATE: It works, see post.

-- Home Page: https://WA0UWH.blogspot.com

No comments:

Post a Comment