1.Introduction to ESP8266 Native Development
The ESP8266 is a very versatile device, packed with highly integrated analog, digital and RF circuitry. The ESP8266 is popularly used with the AT firmware and driven by another host MCU such as Atmel AVR or a Microchip PIC.
However, the ESP8266 contains a power Tensilica L106 32-bit core that can be faster than most 32-bit ARM7 processors. With 160kB of RAM and 4MB of flash (code) storage, the ESP8266 is a very powerful standalone processor. This ESP8266 programming tutorial and documentation section aims to familiarize a newbie with how ESP8266 is different and can be programmed just like any other commonly used MCU.
2.Programming the ESP8266 – Getting Started
Once you are familiar with the ESP8266 microcontroller and how it is deeply integrated with analog peripherals, the next step is to understand how to configure and operate the development tools and environment to write native programs for the ESP8266.
While there are many different ways of setting up a toolchain, this documentation only covers development using a Linux based environment. The user need not set up the toolchain and configure the environment. Espressif provides a virtual disk image that can be run on any host system such as Windows or Linux using VirtualBox.
Note that the programming is carries out in a Linux environment. However, the documentation assumes you have no experience with Linux and therefore, it is easier to understand for absolute beginners.
3.ESP8266 Official Flash Download Tool
Once the development environment is all set to compile programs for the ESP8266, then next thing required is a tool to download firmware into the ESP8266. The ESP8266 can be programmed via its UART0 interface and a USB-to-UART bridge IC is enough to establish communication between the ESP8266 module and the user PC.
This section of the documentation covers the official flash download tool provided by Espressif Systems on their website. It is capable of writing multiple ESP8266 modules at a time as well and is highly recommended for programming the ESP8266 chipset.
The features and settings are covered in detail.
4.Writing Programs for the ESP8266
Programs that are developed for the ESP8266 could be of one of the two types:
- Based on the non-OS SDK (baremetal programming, no RTOS)
- Based on the RTOS SDK (powered by Espressif SDK + FreeRTOS)
Both the configurations have their own challenges and pros and cons. While the RTOS SDK takes up more resources, it is easy to manage. The non-OS SDK can enable the user to run very fast and efficient programs, using a smaller portion of the system resources, but complicates the programming of event driven systems. This section of the documentation explores some concerns and approaches to program the ESP8266.
5.ESP8266 Peripherals and Interfacing
The Espressif ESP8266 integrates some very high speed, versatile peripherals such as hardware SPI (whopping 80MHz clock rate!) and hardware I2S interface as well for interfacing to high speed devices such as audio DACs. Apart from these, the ESP8266 also features all commonly found peripherals such as regular digital GPIO (internal pull-up/down), ADC, timers, counters and UART interface.
The ESP8266 also features a hardware SDIO slave which can be used to transfer data at very high speed to/from the ESP8266. Note that because this is a slave SDIO device, there is no provision for built-in SD card support.
6.Designing Custom ESP8266 Circuits
Now that you are familiar with the basics of getting a program compiled and running on the ESP8266, this section will focus on the development of custom circuit boards for the ESP8266 or ESP-xx modules available worldwide.
With RF circuits and high speed digital MCU involved, circuit design can be tricky and not every layout will work. Therefore, to simplify troubleshooting and enabling every hobbyist to design his own circuit based on the ESP8266, this section provides some valuable hints and resources to get a custom design up and running in no time.