From eca71696969ccac9791afdea6620525f98c62c25 Mon Sep 17 00:00:00 2001 From: Schorcht Date: Wed, 5 Sep 2018 02:39:50 +0200 Subject: [PATCH] boards: add esp8266-esp-12x --- boards/esp8266-esp-12x/Makefile | 5 + boards/esp8266-esp-12x/Makefile.dep | 1 + boards/esp8266-esp-12x/Makefile.features | 3 + boards/esp8266-esp-12x/Makefile.include | 3 + boards/esp8266-esp-12x/doc.txt | 114 ++++++++++++++++++ .../esp8266-esp-12x/include/arduino_board.h | 76 ++++++++++++ boards/esp8266-esp-12x/include/board.h | 47 ++++++++ boards/esp8266-esp-12x/include/gpio_params.h | 45 +++++++ boards/esp8266-esp-12x/include/periph_conf.h | 52 ++++++++ 9 files changed, 346 insertions(+) create mode 100644 boards/esp8266-esp-12x/Makefile create mode 100644 boards/esp8266-esp-12x/Makefile.dep create mode 100644 boards/esp8266-esp-12x/Makefile.features create mode 100644 boards/esp8266-esp-12x/Makefile.include create mode 100644 boards/esp8266-esp-12x/doc.txt create mode 100644 boards/esp8266-esp-12x/include/arduino_board.h create mode 100644 boards/esp8266-esp-12x/include/board.h create mode 100644 boards/esp8266-esp-12x/include/gpio_params.h create mode 100644 boards/esp8266-esp-12x/include/periph_conf.h diff --git a/boards/esp8266-esp-12x/Makefile b/boards/esp8266-esp-12x/Makefile new file mode 100644 index 0000000000..249af58430 --- /dev/null +++ b/boards/esp8266-esp-12x/Makefile @@ -0,0 +1,5 @@ +MODULE = board + +DIRS = $(RIOTBOARD)/common/esp8266 + +include $(RIOTBASE)/Makefile.base diff --git a/boards/esp8266-esp-12x/Makefile.dep b/boards/esp8266-esp-12x/Makefile.dep new file mode 100644 index 0000000000..c60e4b8da1 --- /dev/null +++ b/boards/esp8266-esp-12x/Makefile.dep @@ -0,0 +1 @@ +include $(RIOTBOARD)/common/esp8266/Makefile.dep diff --git a/boards/esp8266-esp-12x/Makefile.features b/boards/esp8266-esp-12x/Makefile.features new file mode 100644 index 0000000000..a2f432f882 --- /dev/null +++ b/boards/esp8266-esp-12x/Makefile.features @@ -0,0 +1,3 @@ +# Board provides all common peripheral features defined for all ESP8266 boards + +include $(RIOTBOARD)/common/esp8266/Makefile.features diff --git a/boards/esp8266-esp-12x/Makefile.include b/boards/esp8266-esp-12x/Makefile.include new file mode 100644 index 0000000000..fec74c6f68 --- /dev/null +++ b/boards/esp8266-esp-12x/Makefile.include @@ -0,0 +1,3 @@ +USEMODULE += boards_common_esp8266 + +include $(RIOTBOARD)/common/esp8266/Makefile.include diff --git a/boards/esp8266-esp-12x/doc.txt b/boards/esp8266-esp-12x/doc.txt new file mode 100644 index 0000000000..79d5c563ab --- /dev/null +++ b/boards/esp8266-esp-12x/doc.txt @@ -0,0 +1,114 @@ +/** + +@defgroup boards_esp8266_esp-12x ESP-12x based boards +@ingroup boards_esp8266 +@brief Support for boards that use ESP-12x modules. + +## Overview + +This board definition covers not just a single board, but rather a large set of generic boards that either use one of the AI-Tinker ESP-12x AI-Thinker ESP8266 modules or are compatible with them. ESP-12x stands for different versions of the ESP-12 module: ESP-12, ESP-12E, ESP-12E and ESP-12S. + +\htmlonly\endhtmlonly +@image html "https://gitlab.com/gschorcht/RIOT.wiki-Images/raw/master/esp8266/ESP-12F_Module.png" "ESP8266 ESP-12F module"
+ +Common examples for this type of boards are the [WEMOS LOLIN D1 mini V2](#wemos_lolin_d1_mini), the [NodeMCU DEVKIT](#nodemcu_devkit_esp8266) and the [Adafruit Feather HUZZAH ESP8266](#adafruit_feather_huzzah_esp8266). All these boards are characterized by using any of the ESP-12x module and breaking out all GPIO pins. + +@note This board definition is the most generic one and might also be used for other ESP8266 and ESP8285 boards. + +## MCU + +Most features of the boards are provided by the ESP8266EX SoC. + +
+MCU | ESP8266EX +------------|---------------------------- +Family | Tensilica Xtensa LX106 +Vendor | Espressif +RAM | 80 kByte +Flash | 1 ... 16 MByte +Frequency | 80 / 160 MHz +FPU | no +Timers | 1 x 32 bit +ADCs | 1 x 10 bit (1 channel) +LEDs | 1 x GPIO2 +I2Cs | 2 (software implementation) +SPIs | 1 +UARTs | 1 (console) +WiFi | built in +Vcc | 2.5 - 3.6 V +Datasheet | [Datasheet](https://www.espressif.com/sites/default/files/documentation/0a-esp8266ex_datasheet_en.pdf) +Technical Reference | [Technical Reference](https://www.espressif.com/sites/default/files/documentation/esp8266-technical_reference_en.pdf) +
+
+ +## Flashing the Device + +Flashing RIOT is quite straight forward, just connect the board using the programming port to your host computer and type: +``` +make flash BOARD=esp8266-esp-12x ... +``` +For detailed information about ESP8266 as well as configuring and compiling RIOT for ESP8266 boards, see \ref esp8266_riot. + +## WEMOS LOLIN D1 mini + + +[WEMOS LOLIN D1 mini](https://wiki.wemos.cc/products:retired:d1_mini_v2.2.0) is a very interesting board series as it offers a stackable ESP8266 platform. This board can be easily extended with a large number of compatible peripheral shields, e.g. a micro SD card shield, an IR controller shield, a battery shield, and various sensor and actuator shields, see [D1 mini shields](https://wiki.wemos.cc/start#d1_mini_shields) for more information. This makes it possible to create different hardware configurations without the need for a soldering iron or a breadboard. + +\htmlonly + +\endhtmlonly +@image html "https://gitlab.com/gschorcht/RIOT.wiki-Images/raw/master/esp8266/Wemos_D1_mini_Stack.png?inline=false" "WEMOS LOLIN D1 mini stack example"
+ +There is also a MRF24J40 shield that can be used to extend the board with an IEEE 802.15.4 radio module, the standard networking technology in RIOT. + +\htmlonly + +\endhtmlonly +@image html "https://gitlab.com/gschorcht/RIOT.wiki-Images/raw/master/esp8266/Wemos_MRF24J40_Shield.png?inline=false" "MRF24J40 shield for WEMOS LOLIN D1 mini"
+ +There are several versions of WEMOS LOLIN D1 mini, which only differ in the size of the flash memory and the MCU version used. All versions have a microUSB port with flash / boot / reset logic that makes flashing much easier. Their peripherals are equal and work with the default ESP8266 ESP-12x board definition. + +For more information, see [D1 Boards] (https://wiki.wemos.cc/start#d1_boards). + +
+Board | MCU | Flash | Antenna | Remark +-------------|-----------|----------|---------|-------- +D1 mini V2 | ESP8266EX | 4 MByte | PCB | retired +D1 mini V3 | ESP8266EX | 4 MByte | PCB | | +D1 mini Lite | ESP8285 | 1 MByte | PCB | | +D1 mini Pro | ESP8266EX | 16 MByte | ceramic | | +
+
+ +Following image shows the pinout of all WEMOS LOLIN D1 mini boards. It is compatible with the WEMOS LOLIN D32 Pro ESP32 board. + +@image html "https://gitlab.com/gschorcht/RIOT.wiki-Images/raw/master/esp8266/Wemos_D1_mini_pinout.png?inline=false" "WEMOS LOLIN D1 min pinout"
+ +## NodeMCU DEVKIT + +NodeMCU DEVKIT is an open-source hardware project hosted on [GitHub](ttps://github.com/nodemcu/nodemcu-devkit-v1.0). Therefore, there are a lot of clones available. The board was originally designed for NodeMCU firmware development. + +As the other boards described here, NodeMCU ESP12 is generic board that uses ESP-12E module and breaks out all available GPIO pins. It has a Micro-USB port including a flash/boot/reset logic which makes flashing much easier. + +\htmlonly + +\endhtmlonly +@image html "https://raw.githubusercontent.com/nodemcu/nodemcu-devkit-v1.0/master/Documents/NodeMCU_DEVKIT_1.0.jpg" "NodeMCE DEVKIT V1.0"
+ +Following image shows the pinout of NodeMCU DEVKIT boards. + +@image html "https://gitlab.com/gschorcht/RIOT.wiki-Images/raw/master/esp8266/NodeMCU_pinout.png?inline=false" "NodeMCE DEVKIT V1.0 pinout". + +## Adafruit Feather HUZZAH ESP8266 + +Feather is the new series of development boards from Adafruit. [Adafruit Feather HUZZAH ESP8266](https://www.adafruit.com/product/2821) is a ESP8266 based development board with built in WiFi, USB and battery charging. As the other boards described here, Adafruit Feather HUZZAH ESP8266 is a generic board that uses an ESP-12x module and breaks out most of the available GPIO pins. It has one additional LED connected to GPIO0 and a Micro-USB port including a flash/boot/reset logic which makes flashing much easier. + +\htmlonly + +\endhtmlonly +@image html "https://cdn-shop.adafruit.com/1200x900/2821-05.jpg" "Adafruit Feather HUZZAH ESP8266"
+ +Following image shows the pinout of Adafruit Feather HUZZAH ESP8266. + +@image html "https://gitlab.com/gschorcht/RIOT.wiki-Images/raw/master/esp8266/Adafruit_Huzzah_ESP8266_pinout.png?inline=false" "Adafruit Feather HUZZAH ESP8266 pinout" +*/ diff --git a/boards/esp8266-esp-12x/include/arduino_board.h b/boards/esp8266-esp-12x/include/arduino_board.h new file mode 100644 index 0000000000..a3260f9576 --- /dev/null +++ b/boards/esp8266-esp-12x/include/arduino_board.h @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2018 Gunar Schorcht + * + * This file is subject to the terms and conditions of the GNU Lesser + * General Public License v2.1. See the file LICENSE in the top level + * directory for more details. + */ + +/** + * @ingroup boards_esp8266_esp-12x + * @{ + * + * @file + * @brief Board specific configuration for the Arduino API + * + * @author Gunar Schorcht + */ + +#ifndef ARDUINO_BOARD_H +#define ARDUINO_BOARD_H + +#include "periph/gpio.h" +#include "periph/adc.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief The on-board LED is connected to pin 2 on this board + */ +#define ARDUINO_LED (GPIO2) + +/** + * @brief Look-up table for the Arduino's digital pins + */ +static const gpio_t arduino_pinmap[] = { + GPIO1, /* ARDUINO_PIN_0 (RxD) */ + GPIO3, /* ARDUINO_PIN_1 (TxD) */ + GPIO0, /* ARDUINO_PIN_2 */ + GPIO2, /* ARDUINO_PIN_3 */ + #if defined(FLASH_MODE_QIO) || defined(FLASH_MODE_QOUT) + GPIO9, /* ARDUINO_PIN_4 */ + GPIO10, /* ARDUINO_PIN_5 */ + #else + GPIO_UNDEF, /* ARDUINO_PIN_4 */ + GPIO_UNDEF, /* ARDUINO_PIN_5 */ + #endif + GPIO_UNDEF, /* ARDUINO_PIN_6 */ + GPIO_UNDEF, /* ARDUINO_PIN_7 */ + GPIO_UNDEF, /* ARDUINO_PIN_8 */ + GPIO_UNDEF, /* ARDUINO_PIN_9 */ + GPIO15, /* ARDUINO_PIN_10 (CS0) */ + GPIO13, /* ARDUINO_PIN_11 (MOSI) */ + GPIO12, /* ARDUINO_PIN_12 (MISO) */ + GPIO14, /* ARDUINO_PIN_13 (SCK) */ + GPIO_UNDEF, /* ARDUINO_PIN_A0 */ + GPIO_UNDEF, /* ARDUINO_PIN_A1 */ + GPIO_UNDEF, /* ARDUINO_PIN_A2 */ + GPIO_UNDEF, /* ARDUINO_PIN_A3 */ + GPIO4, /* ARDUINO_PIN_A4 (SDA) */ + GPIO5, /* ARDUINO_PIN_A5 (SCL) */ +}; + +/** + * @brief Look-up table for the Arduino's analog pins + */ +static const adc_t arduino_analog_map[] = { +}; + +#ifdef __cplusplus +} +#endif + +#endif /* ARDUINO_BOARD_H */ +/** @} */ diff --git a/boards/esp8266-esp-12x/include/board.h b/boards/esp8266-esp-12x/include/board.h new file mode 100644 index 0000000000..eafc405183 --- /dev/null +++ b/boards/esp8266-esp-12x/include/board.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2018 Gunar Schorcht + * + * This file is subject to the terms and conditions of the GNU Lesser + * General Public License v2.1. See the file LICENSE in the top level + * directory for more details. + */ + +/** + * @defgroup boards_esp8266_esp-12x ESP-12x based boards + * @ingroup boards_esp8266 + */ + +/** + * @ingroup boards_esp8266_esp-12x + * @brief Board specific definitions for ESP-12x based boards. + * @file + * @author Gunar Schorcht + * @{ + */ + +#ifndef BOARD_H +#define BOARD_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @name On-board LED configuration and control definitions + * @{ + */ +#define LED0_PIN GPIO2 /**< GPIO2 is used as LED Pin */ +#define LED0_ACTIVE (0) /**< LED is low active */ +/** @} */ + +#ifdef __cplusplus +} /* end extern "C" */ +#endif + +/* include common board definitions as last step */ +#include "board_common.h" + +#endif /* BOARD_H */ +/** @} */ diff --git a/boards/esp8266-esp-12x/include/gpio_params.h b/boards/esp8266-esp-12x/include/gpio_params.h new file mode 100644 index 0000000000..1eede93590 --- /dev/null +++ b/boards/esp8266-esp-12x/include/gpio_params.h @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2018 Gunar Schorcht + * + * This file is subject to the terms and conditions of the GNU Lesser + * General Public License v2.1. See the file LICENSE in the top level + * directory for more details. + */ + +#ifndef GPIO_PARAMS_H +#define GPIO_PARAMS_H + +/** + * @ingroup boards_esp8266_esp-12x + * @brief Board specific configuration of direct mapped GPIOs + * @file + * @author Gunar Schorcht + * @{ + */ + +#include "board.h" +#include "saul/periph.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief LED configuration + */ +static const saul_gpio_params_t saul_gpio_params[] = +{ + { + .name = "LED", + .pin = LED0_PIN, + .mode = GPIO_OUT, + .flags = (SAUL_GPIO_INVERTED | SAUL_GPIO_INIT_CLEAR) + } +}; + +#ifdef __cplusplus +} +#endif + +#endif /* GPIO_PARAMS_H */ +/** @} */ diff --git a/boards/esp8266-esp-12x/include/periph_conf.h b/boards/esp8266-esp-12x/include/periph_conf.h new file mode 100644 index 0000000000..da08d17e5c --- /dev/null +++ b/boards/esp8266-esp-12x/include/periph_conf.h @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2018 Gunar Schorcht + * + * This file is subject to the terms and conditions of the GNU Lesser + * General Public License v2.1. See the file LICENSE in the top level + * directory for more details. + */ + +/** + * @ingroup boards_esp8266_esp-12x + * @brief Board specific configuration of MCU periphery for ESP-12x based boards. + * @file + * @author Gunar Schorcht + * @{ + */ + +#ifndef PERIPH_CONF_H +#define PERIPH_CONF_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @name I2C configuration + * @{ + */ +#ifndef I2C_NUMOF +#define I2C_NUMOF (1) /**< Number of I2C interfaces */ +#endif +#ifndef I2C0_SPEED +#define I2C0_SPEED I2C_SPEED_FAST /**< I2C bus speed of I2C_DEV(0) */ +#endif +#ifndef I2C0_SDA +#define I2C0_SDA GPIO4 /**< SDA signal of I2C_DEV(0) */ +#endif +#ifndef I2C0_SCL +#define I2C0_SCL GPIO5 /**< SCL signal of I2C_DEV(0) */ +#endif +/** @} */ + +#ifdef __cplusplus +} /* end extern "C" */ +#endif + +/* include common peripheral definitions as last step */ +#include "periph_conf_common.h" + +#endif /* PERIPH_CONF_H */ +/** @} */