June 22, 2020

The ESP8266 - working with an ESP-01S module

I became aware of these in April of 2020 and ordered several from AliExpress. On 6-20-2020, my package arrived. It had 3 of the modules and a programming gadget.

The charm of these is two fold. One is that they work from 3.3 volts. The other is that they have 8 pins on 0.1 inch centers. This makes them easy to use with standard perf-board, in contrast to the ubiquitous ESP-12 modules that have 2mm spacing. The downside is that only 6 IO pins are available.

Another charm is the availability of a simple programming gadget. This gadet has a USB plug, a 3.3 volt power supply, a usb to serial chip (mine has a "SIL 2104", and a reset button.

The question becomes what signals are available on these 8 pins. More accurately 6 pins, given that two are 3.3 volts and ground. We have (as my unit is labeled on the silkscreen):

One of my units (naturally the first I selected to work with) arrived with a solder bridge from Tx to EN. I thought at first this was intentional, but neither of the other two units have this. All the more reason to order several units when they are this inexpensive. This is easily fixed with a soldering iron.

If you have any ideas about using the ADC input to the ESP8266, forget it. This is pin 6 on the esp8266 chip and is not routed -- so you would have to do some very fine soldering or use a different module.

First power up

I pop my unit on the programmer and plug it into my linux desktop. I see the usual USB chatter in the log file, including:
Jun 22 16:51:46 trona kernel: usb 2-1.8: new full-speed USB device number 3 using ehci-pci
Jun 22 16:51:46 trona kernel: usb 2-1.8: New USB device found, idVendor=10c4, idProduct=ea60, bcdDevice= 1.00
Jun 22 16:51:46 trona kernel: usb 2-1.8: Product: CP2104 USB to UART Bridge Controller
Jun 22 16:51:46 trona kernel: usb 2-1.8: Manufacturer: Silicon Labs
Jun 22 16:51:46 trona kernel: usb 2-1.8: cp210x converter now attached to ttyUSB0
This is as one would hope. Running "make info" from one of my project Makefiles gives:
make info
esptool -p /dev/ttyUSB0 read_mac
MAC: 18:fe:34:7x:fx:xy
esptool -p /dev/ttyUSB0 flash_id
Manufacturer: 5e
Device: 6014
The flash chip itself is labeled T25S80. This would appear to be an 8 mbit NOR flash made by "Bright Moon semiconductor". So, this is 1M of flash memory, which is nice since some earlier units only had 512K of flash.

I can run picocom at 115200 baud and it nicely echos characters. It was probably shipped with the usual AT command set firmware. I get brave and type "make flash" to reprogram it with my flash demo:

make flash
esptool elf2image blink2
esptool --port /dev/ttyUSB0 write_flash  0x00000 blink2-0x00000.bin 0x40000 blink2-0x40000.bin
Erasing flash...
Wrote 28672 bytes at 0x00000000 in 2.8 seconds (82.8 kbit/s)...
Erasing flash...
Wrote 186368 bytes at 0x00040000 in 18.1 seconds (82.5 kbit/s)...
This works fine and the LED on the unit is now happily blinking at 1 Hz.

Further reading