From charlesreid1

 
(5 intermediate revisions by the same user not shown)
Line 119: Line 119:
This is straight up STUPID.  
This is straight up STUPID.  


Thanks to Espressif, the company that manufactures these boards, for providing absolutely ZERO documentation for these chips. But at least they provide a forum for their (incompetent) users.
Thanks to Espressif, the company that manufactures these boards, for providing absolutely ZERO documentation for these chips.


Is it really the case that no single person can adequately explain the circuitry required to make one of these things work? I have seen circuit diagrams showing resistors that have no component value. I have seen circuit diagrams that are literally impossible and make no sense. I have seen people referring to firmware files that simply do not exist or have disappeared. I have seen smug hand-waving statements like "use your favorite tool to flash the firmware of the ESP8266" - without the author mentioning a single such tool. Thanks, Einstein!
Existing documentation is garbage - missing links, inadequate explanations, no documentation of circuits, missing and broken links, old resources, and tutorials written in broken English that are vague at the most critical points.
 
There's also plenty of missing links - Hackaday [https://hackaday.com/2014/10/25/an-sdk-for-the-esp8266-wifi-chip/] refers to a long-awaited and very-useful SDK for this chip, and posted a link that is, of course, broken. Most tutorials are written in 2014 - which is apparently so long ago that most of the resources related to this piece of junk circuit board have migrated and/or disappeared.
 
Most of the tutorials that actually have useful information and working links are written by non-native English speakers, so they're vague, ambiguous, unhelpful, and confusing - most particularly in the critical portions, where they seem to leave out or mislabel the most important components on purpose.
 
These chips showed up in the mail with absolutely ZERO information. This is a chip with a lot of potential, but most of the documentation that is available is just absolute garbage.
 
==The Procedure==
 
Apparently the procedure is as follows:
* write your stupid program
* cross-compile your stupid program for the microprocessor on the ESP8266 chip
* compiling your stupid program will make an ELF file, so use the esptool to turn that ELF file into a binary file that can be flashed
* flash your stupid program binary onto the microprocessor onboard the ESP8266
 
==What A Stupid Chip==
 
https://hpclab.blogspot.com/2015/06/esp8266-arduino-ide-on-mac-os-x.html


==Flashing the Firmware==
==Flashing the Firmware==
Line 181: Line 163:
</pre>
</pre>


===ESP SDK===
==Reflash Dance==


Download the ESP SDK from here: http://bbs.espressif.com/viewtopic.php?f=46&t=850
Ariiiiiight! Finally a competent person who can articulate themselves in their documentation process! http://www.xess.com/blog/esp8266-reflash/


To implement AT firmware, download the non-OS SDK (whatever the hell that means).
He sets up the programming board, and says in the comments that he used 2.2K resistors. He also says, "I think any value between 1K and 10K will work."


=Flags=
=Flags=


{{ArduinoFlag}}
{{ESP8266Flag}}

Latest revision as of 21:52, 23 June 2016

Debugging the serial connection to the ESP8266

Experiments

Variables and Parameters

I had to try a couple of combinations of different parameters.

Variables:

  • Baudrate - 57600 or 115200 (depending on chip/board version)
  • RX/TX pinouts
  • High/floating CH_PD pin

First Set of Experiments

With this first set of experiments, I was connecting to the serial device at /dev/tty.usbserial.

Connecting to serial port at /dev/tty.usbserial with timeout of 5 seconds:

First Round

First round (slow rate, v 1):

Test 1A: 57600 baud rate, RX on ESP8266 connected to TX on PL2302 (mini usb to serial board), CH_PD pin floating

  • Nope.

Test 2A: 57600 baud rate, RX on ESP8266 connected to TX on PL2302 (mini usb to serial board), CH_PD pin high

  • Nope.

Test 3A: 57600 baud rate, RX on ESP8266 connected to RX on PL2302 (mini usb to serial board), CH_PD pin floating

  • Nope.

Test 4A: 57600 baud rate, RX on ESP8266 connected to RX on PL2302 (mini usb to serial board), CH_PD pin high

  • Nope.

Second Round

Second round (fast rate, v 2):

Test 1B: 115200 baud rate, RX on ESP8266 connected to TX on PL2302 (mini usb to serial board), CH_PD pin floating

  • Nope.

Test 2B: 115200 baud rate, RX on ESP8266 connected to TX on PL2302 (mini usb to serial board), CH_PD pin high

  • Nope.

Test 3B: 115200 baud rate, RX on ESP8266 connected to RX on PL2302 (mini usb to serial board), CH_PD pin floating

  • Nope.

Test 4B: 115200 baud rate, RX on ESP8266 connected to RX on PL2302 (mini usb to serial board), CH_PD pin high

  • Nope.

Second Set of Experiments

Keep on trying. I ran the serial library's port discovery tool, and it listed /dev/cu.usbserial, so maybe that's the device we should be using:

$ python -m serial.tools.list_ports
/dev/cu.Bluetooth-Incoming-Port
/dev/cu.usbserial
2 ports found

First Set of Experiments

Connecting to serial port at /dev/cu.usbserial with timeout of 5 seconds:

Test 1A: 57600 baud rate, RX on ESP8266 connected to TX on PL2302 (mini usb to serial board), CH_PD pin floating

  • Nope.

Test 2A: 57600 baud rate, RX on ESP8266 connected to TX on PL2302 (mini usb to serial board), CH_PD pin high

  • Nope.

Test 3A: 57600 baud rate, RX on ESP8266 connected to RX on PL2302 (mini usb to serial board), CH_PD pin floating

Test 4A: 57600 baud rate, RX on ESP8266 connected to RX on PL2302 (mini usb to serial board), CH_PD pin high

Second Set of Experiments

Second round (fast rate, v 2):

Test 1B: 115200 baud rate, RX on ESP8266 connected to TX on PL2302 (mini usb to serial board), CH_PD pin floating

Test 2B: 115200 baud rate, RX on ESP8266 connected to TX on PL2302 (mini usb to serial board), CH_PD pin high

Test 3B: 115200 baud rate, RX on ESP8266 connected to RX on PL2302 (mini usb to serial board), CH_PD pin floating

Test 4B: 115200 baud rate, RX on ESP8266 connected to RX on PL2302 (mini usb to serial board), CH_PD pin high

Attempt Number 2

Okay, let's start over.

Installing the esp8266/arduino library from Github makes it possible to program the ESP8266 microcontroller directly from the Arduino IDE, and provides some nice API functions as well. It takes a couple of steps to install, but the steps are dead simple.

Preparing Arduino to Work with ESP8266

Start by installing the necessary packages to program the ESP8266 directly from the Arduino IDE. This will require Arduino version 1.6.8 or later.

Download the ESP8266 Arduino repository here: https://github.com/esp8266/Arduino

Next, install using the Arduino Boards Manager. Open the Arduino IDE, and click Arduino > Preferences. In the "Additional Board Manager URLs" field, enter the following URL: http://arduino.esp8266.com/stable/package_esp8266com_index.json

Go to Tools > Board > Boards Manager and do a search for the term "ESP." This should pull up the ESP board, and you should see a button that says "Install."

Manual Programming

To set the ESP8266 up for manual programming (whatever that means...), we can arrange the circuit as follows:

http://reflowster.com/blog/2015/05/11/esp8266.html

Attempt Number 3

This is straight up STUPID.

Thanks to Espressif, the company that manufactures these boards, for providing absolutely ZERO documentation for these chips.

Existing documentation is garbage - missing links, inadequate explanations, no documentation of circuits, missing and broken links, old resources, and tutorials written in broken English that are vague at the most critical points.

Flashing the Firmware

To flash the firmware, you need esptool. You can install it with pip, or from the Github repository [1].

Once you have installed it, you can call it like a binary named "esptool.py":

 esptool.py -h
usage: esptool [-h] [--port PORT] [--baud BAUD]
               {load_ram,dump_mem,read_mem,write_mem,write_flash,run,image_info,make_image,elf2image,read_mac,chip_id,flash_id,read_flash,verify_flash,erase_flash,version}
               ...

esptool.py v1.1 - ESP8266 ROM Bootloader Utility

positional arguments:
  {load_ram,dump_mem,read_mem,write_mem,write_flash,run,image_info,make_image,elf2image,read_mac,chip_id,flash_id,read_flash,verify_flash,erase_flash,version}
                        Run esptool {command} -h for additional help
    load_ram            Download an image to RAM and execute
    dump_mem            Dump arbitrary memory to disk
    read_mem            Read arbitrary memory location
    write_mem           Read-modify-write to arbitrary memory location
    write_flash         Write a binary blob to flash
    run                 Run application code in flash
    image_info          Dump headers from an application image
    make_image          Create an application image from binary files
    elf2image           Create an application image from ELF file
    read_mac            Read MAC address from OTP ROM
    chip_id             Read Chip ID from OTP ROM
    flash_id            Read SPI flash manufacturer and device ID
    read_flash          Read SPI flash content
    verify_flash        Verify a binary blob against flash
    erase_flash         Perform Chip Erase on SPI flash
    version             Print esptool version

optional arguments:
  -h, --help            show this help message and exit
  --port PORT, -p PORT  Serial port device
  --baud BAUD, -b BAUD  Serial port baud rate used when flashing/reading

Reflash Dance

Ariiiiiight! Finally a competent person who can articulate themselves in their documentation process! http://www.xess.com/blog/esp8266-reflash/

He sets up the programming board, and says in the comments that he used 2.2K resistors. He also says, "I think any value between 1K and 10K will work."

Flags