Espressif 8266

platform = espressif8266

Espressif Systems is a privately held fabless semiconductor company. They provide wireless communications and Wi-Fi chips which are widely used in mobile devices and the Internet of Things applications.

For more detailed information please visit vendor site.

Configuration

Custom CPU Frequency

See board_f_cpu option from Project Configuration File platformio.ini

[env:myenv]
; set frequency to 160MHz
board_f_cpu = 160000000L

Custom FLASH Frequency

See board_f_flash option from Project Configuration File platformio.ini. Possible values:

  • 20000000L

  • 26000000L

  • 40000000L (default)

  • 80000000L

[env:myenv]
; set frequency to 80MHz
board_f_flash = 80000000L

Custom FLASH Mode

Flash chip interface mode. This parameter is stored in the binary image header, along with the flash size and flash frequency. The ROM bootloader in the ESP chip uses the value of these parameters in order to know how to talk to the flash chip.

See board_flash_mode option from Project Configuration File platformio.ini. Possible values:

  • qio

  • qout

  • dio

  • dout

[env:myenv]
board_flash_mode = qio

Custom Reset Method

You can set custom reset method using upload_resetmethod option from Project Configuration File platformio.ini.

The possible values are:

  • ck - RTS controls RESET or CH_PD, DTR controls GPIO0

  • wifio - TXD controls GPIO0 via PNP transistor and DTR controls RESET via a capacitor

  • nodemcu - GPIO0 and RESET controlled using two NPN transistors as in NodeMCU devkit.

See default reset methods per board.

[env:myenv]
upload_resetmethod = ck

Custom Flash Size

Warning

Please make sure to read ESP8266 Flash layout information first.

Available LD-scripts: https://github.com/esp8266/Arduino/tree/master/tools/sdk/ld

  • eagle.flash.512k0.ld 512K (no SPIFFS)

  • eagle.flash.512k64.ld 512K (64K SPIFFS)

  • eagle.flash.512k128.ld 512K (128K SPIFFS)

  • eagle.flash.1m0.ld 1M (no SPIFFS)

  • eagle.flash.1m64.ld 1M (64K SPIFFS)

  • eagle.flash.1m128.ld 1M (128K SPIFFS)

  • eagle.flash.1m144.ld 1M (144K SPIFFS)

  • eagle.flash.1m160.ld 1M (160K SPIFFS)

  • eagle.flash.1m192.ld 1M (192K SPIFFS)

  • eagle.flash.1m256.ld 1M (256K SPIFFS)

  • eagle.flash.1m512.ld 1M (512K SPIFFS)

  • eagle.flash.2m.ld 2M (1M SPIFFS)

  • eagle.flash.4m1m.ld 4M (1M SPIFFS)

  • eagle.flash.4m.ld 4M (3M SPIFFS)

  • eagle.flash.8m.ld 8M (7M SPIFFS)

  • eagle.flash.16m.ld 16M (15M SPIFFS)

To override default LD script please use build_flags from Project Configuration File platformio.ini.

[env:myenv]
build_flags = -Wl,-Teagle.flash.4m.ld

Custom Upload Speed

You can set custom upload speed using upload_speed option from Project Configuration File platformio.ini

[env:myenv]
upload_speed = 9600

Uploading files to file system SPIFFS

Warning

Please make sure to read ESP8266 Flash layout information first.

  1. Initialize project platformio init (if you have not initialized yet)

  2. Create data folder (it should be on the same level as src folder) and put files here. Also, you can specify own location for data_dir

  3. Run buildfs or uploadfs target using platformio run --target command.

To upload SPIFFS image using OTA update please specify upload_port / --upload-port as IP address or mDNS host name (ending with the *.local). For the details please follow to Over-the-Air (OTA) update.

By default, will be used default LD Script for the board where is specified SPIFFS offsets (start, end, page, block). You can override it using Custom Flash Size.

Active discussion is located in issue #382.

Over-the-Air (OTA) update

Firstly, please read What is OTA? How to use it?

There are 2 options:

platformio run --target upload --upload-port IP_ADDRESS_HERE or mDNS_NAME.local
[env:myenv]
upload_port = IP_ADDRESS_HERE or mDNS_NAME.local

For example,

  • platformio run -t upload --upload-port 192.168.0.255

  • platformio run -t upload --upload-port myesp8266.local

Authentication and upload options

You can pass additional options/flags to OTA uploader using upload_flags option in Project Configuration File platformio.ini

[env:myenv]
upload_flags = --port=8266

Available flags

  • --port=ESP_PORT ESP8266 OTA Port. Default 8266

  • --auth=AUTH Set authentication password

  • --spiffs Use this option to transmit a SPIFFS image and do not flash the module

For the full list with available options please run

~/.platformio/packages/tool-espotapy/espota.py -h

Usage: espota.py [options]

Transmit image over the air to the esp8266 module with OTA support.

Options:
  -h, --help            show this help message and exit

  Destination:
    -i ESP_IP, --ip=ESP_IP
                        ESP8266 IP Address.
    -p ESP_PORT, --port=ESP_PORT
                        ESP8266 ota Port. Default 8266

  Authentication:
    -a AUTH, --auth=AUTH
                        Set authentication password.

  Image:
    -f FILE, --file=FILE
                        Image file.
    -s, --spiffs        Use this option to transmit a SPIFFS image and do not
                        flash the module.

  Output:
    -d, --debug         Show debug output. And override loglevel with debug.
    -r, --progress      Show progress output. Does not work for ArduinoIDE

Demo

../../_images/platformio-demo-ota-esp8266.jpg

Using Arduino Framework with Staging version

PlatformIO will install the latest Arduino Core for ESP8266 from https://github.com/esp8266/Arduino. The Git should be installed in a system. To update Arduino Core to the latest revision, please open PlatformIO IDE and navigate to PIO Home > Platforms > Updates.

  1. Please install PlatformIO IDE

  2. Initialize a new project, open Project Configuration File platformio.ini and set platform to https://github.com/platformio/platform-espressif8266.git#feature/stage. For example,

    [env:nodemcuv2]
    platform = https://github.com/platformio/platform-espressif8266.git#feature/stage
    board = nodemcuv2
    framework = arduino
    
  3. Try to build project

  4. If you see build errors, then try to build this project using the same stage with Arduino IDE

  5. If it works with Arduino IDE but doesn’t work with PlatformIO, then please file new issue with attached information:

    • test project/files

    • detailed log of build process from Arduino IDE (please copy it from console to https://hastebin.com)

    • detailed log of build process from PlatformIO Build System (please copy it from console to https://hastebin.com)

Examples

Examples are listed from Espressif 8266 development platform repository:

Stable and upstream versions

You can switch between stable releases of Espressif 8266 development platform and the latest upstream version using platform option as described below:

; Custom stable version
[env:stable]
platform =espressif8266@x.y.z
board = ...
...

; The latest upstream/development version
[env:upstream]
platform = https://github.com/platformio/platform-espressif8266.git
board = ...
...

Packages

Name

Description

framework-arduinoespressif8266

Arduino Wiring-based Framework (ESP8266 Core)

framework-esp8266-nonos-sdk

ESP8266 Non-OS SDK

framework-esp8266-rtos-sdk

ESP8266 SDK based on FreeRTOS

framework-simba

Simba Framework

sdk-esp8266

ESP8266 SDK

tool-espotapy

ESP8266 OTA utility

tool-esptool

esptool-ck

tool-mkspiffs

Tool to build and unpack SPIFFS images

toolchain-xtensa

xtensa-gcc

Warning

Linux Users:

Windows Users:

Please check that you have a correctly installed USB driver from board manufacturer

Frameworks

Name

Description

Arduino

Arduino Wiring-based Framework allows writing cross-platform software to control devices attached to a wide range of Arduino boards to create all kinds of creative coding, interactive objects, spaces or physical experiences.

ESP8266 Non-OS SDK

The non-OS SDK provides a set of application programming interfaces (APIs) for core ESP8266 functionalities such as data reception/transmission over Wi-Fi, TCP/IP stack functions, hardware interface functions and basic system management functions.

ESP8266 RTOS SDK

ESP8266 SDK based on FreeRTOS, a truly free professional grade RTOS for microcontrollers

Simba

Simba is an RTOS and build framework. It aims to make embedded programming easy and portable.

Boards

Note

4D Systems

ID

Name

Debug

MCU

Frequency

Flash

RAM

gen4iod

4D Systems gen4 IoD Range

No

ESP8266

80MHz

512KB

80KB

Adafruit

ID

Name

Debug

MCU

Frequency

Flash

RAM

huzzah

Adafruit HUZZAH ESP8266

No

ESP8266

80MHz

4MB

80KB

DigiStump

ID

Name

Debug

MCU

Frequency

Flash

RAM

oak

DigiStump Oak

No

ESP8266

80MHz

4MB

80KB

Doit

ID

Name

Debug

MCU

Frequency

Flash

RAM

espduino

ESPDuino (ESP-13 Module)

No

ESP8266

80MHz

4MB

80KB

DycodeX

ID

Name

Debug

MCU

Frequency

Flash

RAM

espectro

ESPectro Core

No

ESP8266

80MHz

4MB

80KB

ESPert

ID

Name

Debug

MCU

Frequency

Flash

RAM

espresso_lite_v1

ESPresso Lite 1.0

No

ESP8266

80MHz

4MB

80KB

espresso_lite_v2

ESPresso Lite 2.0

No

ESP8266

80MHz

4MB

80KB

ESPino

ID

Name

Debug

MCU

Frequency

Flash

RAM

espino

ESPino

No

ESP8266

80MHz

4MB

80KB

Espressif

ID

Name

Debug

MCU

Frequency

Flash

RAM

esp01

Espressif Generic ESP8266 ESP-01 512k

No

ESP8266

80MHz

512KB

80KB

esp01_1m

Espressif Generic ESP8266 ESP-01 1M

No

ESP8266

80MHz

1MB

80KB

esp07

Espressif Generic ESP8266 ESP-07

No

ESP8266

80MHz

4MB

80KB

esp12e

Espressif ESP8266 ESP-12E

No

ESP8266

80MHz

4MB

80KB

esp8285

Generic ESP8285 Module

No

ESP8266

80MHz

423.98KB

80KB

esp_wroom_02

ESP-WROOM-02

No

ESP8266

80MHz

4MB

80KB

phoenix_v1

Phoenix 1.0

No

ESP8266

80MHz

4MB

80KB

phoenix_v2

Phoenix 2.0

No

ESP8266

80MHz

4MB

80KB

wifinfo

WifInfo

No

ESP8266

80MHz

1MB

80KB

Heltec

ID

Name

Debug

MCU

Frequency

Flash

RAM

heltec_wifi_kit_8

Heltec Wifi kit 8

No

ESP8266

80MHz

4MB

80KB

NodeMCU

ID

Name

Debug

MCU

Frequency

Flash

RAM

nodemcu

NodeMCU 0.9 (ESP-12 Module)

No

ESP8266

80MHz

4MB

80KB

nodemcuv2

NodeMCU 1.0 (ESP-12E Module)

No

ESP8266

80MHz

4MB

80KB

Olimex

ID

Name

Debug

MCU

Frequency

Flash

RAM

modwifi

Olimex MOD-WIFI-ESP8266(-DEV)

No

ESP8266

80MHz

2MB

80KB

SeeedStudio

ID

Name

Debug

MCU

Frequency

Flash

RAM

wio_node

Wio Node

No

ESP8266

80MHz

4MB

80KB

SparkFun

ID

Name

Debug

MCU

Frequency

Flash

RAM

sparkfunBlynk

SparkFun Blynk Board

No

ESP8266

80MHz

4MB

80KB

thing

SparkFun ESP8266 Thing

No

ESP8266

80MHz

512KB

80KB

thingdev

SparkFun ESP8266 Thing Dev

No

ESP8266

80MHz

512KB

80KB

SweetPea

ID

Name

Debug

MCU

Frequency

Flash

RAM

esp210

SweetPea ESP-210

No

ESP8266

80MHz

4MB

80KB

ThaiEasyElec

ID

Name

Debug

MCU

Frequency

Flash

RAM

espinotee

ThaiEasyElec ESPino

No

ESP8266

80MHz

4MB

80KB

WEMOS

ID

Name

Debug

MCU

Frequency

Flash

RAM

d1

WEMOS D1 R1 (Retired)

No

ESP8266

80MHz

4MB

80KB

d1_mini

WeMos D1 R2 & mini

No

ESP8266

80MHz

4MB

80KB

d1_mini_lite

WeMos D1 mini Lite

No

ESP8266

80MHz

1MB

80KB

d1_mini_pro

WeMos D1 mini Pro

No

ESP8266

80MHz

16MB

80KB