Saturday, January 3, 2015

Olimex MOD-WIFI-ESP8266-DEV - Software Setup

Getting to the point where I had a workable software setup for the ESP8266 took me a bit.

ESP8266 Software Setup – Linux

I made use of CNLohr’s excellent instructions and youtube video and the Toolchain wiki page on the ESP8266 Community Forum GitHub repository.

The setup that I ended up with is running on Lubuntu 14.04 with the ESP8266 software under /opt/Espressif based on the ESP8266 Community Forum wiki instructions.

ESP8266 Sample Programs

I have successfully gotten the AT v20 Demo to compile and load and the blinky source code example from the ESP8266 Community Forum following the instructions on the wiki.

For the blinky example you need to connect an LED to GPIO2 which is pin 20 on the MOD-WIFI-ESP8266-DEV.  This was the first program I got running correctly.  I got the basic_example to compile and download but wasn’t ever able to get any output from it.

I had some problems getting the AT v20 Demo to compile.  When I was finished with the wiki instructions I had an include directory in /opt/Espressif and also one in /opt/Espressif/ESP8266_SDK.  The ESP8266 Community Forum template includes /opt/Espressif/include as EXTRA_INCDIR.  However to get the AT V20 Demo to compile I had to combine /opt/Espressif/include into /opt/Espressif/ESP8266_SDK/include.

I also had some problems realizing it was compiling and flashing correctly as I didn’t realize that it was looking for the command line to end with CR LF until I read a post in the ESP8266 Community Forums about needing to press CTRL-J.

ESP8266 Software Setup – Windows (Updated Jan 4, 2015)

For windows I found the very well put together ESP8266 DevKit by CHERTS on the ESP8266 Community Forum.  It comes with an installer and for me with two minor changes “worked right out of the box.”  I was already running CYGWIN64 and am not a bit Eclipse user so I just downloaded the x64 DevKit for windows.

I have to update the COM port used for make flash from COM2 to COM3 and the path to the esptool.py script needed the slashed flipped to work in CYVGWIN.  From the examples directory I ran the following:

$ find . -name '*Makefile' -exec sed -i -e 's/COM2/COM3/g' {} \; 
$ find . -name '*Makefile' -exec sed -i -e 's/c:\\Espressif\\utils\\esptool.exe/c:\/Espressif\/utils\/esptool.exe/g' {} \;

One other thing that I did was to put a shell script in /usr/local/bin for screen.  CYGWIN has the screen command but there doesn’t appear to be a way to change RTS and DTR which creates problems for the ESP8266.  The shell script runs Realterm with DTR and RTS set to 0 which sets the control lines to 3.3v which allows normal operation of the ESP8266.

/usr/local/bin/screen

#!/bin/sh
"c:/Program Files (x86)/BEL/Realterm/realterm.exe" BAUD=9600 RTS=0 DTR=0 PORT=3

My thanks to CHERTS for making this so easy.

No comments: