1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

boards: add esp8266-sparkfun-thing

This commit is contained in:
Schorcht 2018-09-05 02:39:50 +02:00
parent 081a8e8921
commit fa213ddd86
9 changed files with 346 additions and 0 deletions

View File

@ -0,0 +1,5 @@
MODULE = board
DIRS = $(RIOTBOARD)/common/esp8266
include $(RIOTBASE)/Makefile.base

View File

@ -0,0 +1 @@
include $(RIOTBOARD)/common/esp8266/Makefile.dep

View File

@ -0,0 +1,3 @@
# Board provides all common peripheral features defined for all ESP8266 boards
include $(RIOTBOARD)/common/esp8266/Makefile.features

View File

@ -0,0 +1,3 @@
USEMODULE += boards_common_esp8266
include $(RIOTBOARD)/common/esp8266/Makefile.include

View File

@ -0,0 +1,90 @@
/**
@defgroup boards_esp8266_sparkfun-thing SparkFun ESP8266 Thing
@ingroup boards_esp8266
@brief Support for the SparkFun ESP8266 Thing modules.
## Overview
The [SparkFun ESP8266 Thing](https://www.sparkfun.com/products/13231) and [SparkFun ESP8266 Thing DEV](https://www.sparkfun.com/products/13711) are low-cost and easy to use breakout and development boards for the ESP8266. Both SparkFun ESP8266 Thing boards are relatively simple boards. The pins are simply broken out to two parallel, breadboard-compatible rows.
@image html "https://gitlab.com/gschorcht/RIOT.wiki-Images/raw/master/esp8266/Sparkfun_Thing_x.png?inline=false" "SparkFun ESP8266 Thing (left) / SparkFun ESP8266 Thing DEV (right)"
## Hardware
### MCU
Most features of the board are provided by the ESP8266EX SoC.
<center>
MCU | ESP8266EX
------------|----------------------------
Family | Tensilica Xtensa LX106
Vendor | Espressif
RAM | 80 kByte
Flash | 512 kByte
Frequency | 80 / 160 MHz
FPU | no
Timers | 1 x 32 bit
ADCs | 1 x 10 bit (1 channel)
LEDs | 1 x GPIO1
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)
Board Schematic | [ESP8266 Thing](https://cdn.sparkfun.com/datasheets/Wireless/WiFi/SparkFun_ESP8266_Thing.pdf) <br> [ESP8266 Thing Dev](https://cdn.sparkfun.com/datasheets/Wireless/WiFi/ESP8266-Thing-Dev-v10.pdf)
</center>
### Board Versions
Although the board definition works with both boards, it's important to know that they differ slightly in some features:
<center>
Feature | ESP8266 Thing | ESP8266 Thing Dev
-------------------------------|---------------|------------------
USB to Serial adapter on-board | no | yes
I2C pull-up resistors on-board | yes (jumpable)| no [1]
Programming interface | FTDI USB to Serial adapter | USB
Reset/Flash/Boot logic | FTDI | USB
Battery connector | yes | no (can be retrofitted)
LiPo Charger on-board | yes | no
LED (GPIO5) | high active | low active [2]
GPIO15 broken out | no | yes
CHIP_EN broken out | yes | no
</center>
[1] Although the SparkFun ESP8266 Thing Dev has no on-board I2C pull-up resistors, the I2C interface can be used because the ESP8266 SoC has built-in pull-up resistors that are activated by the I2C peripheral driver.
[2] The board configuration defines high-active LEDs. If the SparkFun ESP8266 Thing Dev is used with this board configuration, the LED outputs must be inverted by the application.
### RIOT Pin Mapping
The following figures show the mapping of these pin holes to RIOT pins.
@image html "https://gitlab.com/gschorcht/RIOT.wiki-Images/raw/master/esp8266/Sparkfun_Thing_pinout.png?inline=false" "SparkFun Thin Pinout"
@image html "https://gitlab.com/gschorcht/RIOT.wiki-Images/raw/master/esp8266/Sparkfun_Thing_Dev_pinout.png?inline=false" "SparkFun Thin Dev Pinout"
Flash SPI pins including GPIO9 and GPIO10 are not broken out. The SparkFun Thing board has solder pads for these pins at the bottom layer.
## Flashing the Device
To flash the RIOT image, the device has to be connected to the host computer. Since the SparkFun Thing Dev board has an USB to Serial adapter on board, this can done directly using the Micro USB. SparkFun Thin board has to be connected to the host computer using the FTDI interface and a FTDI USB to Serial adapter/cable. For more information on how to program the SparkFun Thing board, please refer the [ESP8266 Thing Hookup Guide](https://learn.sparkfun.com/tutorials/esp8266-thing-hookup-guide/programming-the-thing).
@note Please make sure the FTDI USB to Serial adapter/cable uses 3.3 V.
Both boards have a reset/flash/boot logic on-board so that flashing is quite simple. To flash the RIOT image just type:
```
make flash BOARD=esp8266-sparkfun-thing ...
```
For detailed information about ESP8266 as well as configuring and compiling RIOT for ESP8266 boards, see \ref esp8266_riot.
*/

View File

@ -0,0 +1,74 @@
/*
* 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_sparkfun-thing
* @brief Board specific configuration for the Arduino API
* @file
* @author Gunar Schorcht <gunar@schorcht.net>
* @{
*/
#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 (GPIO5)
/**
* @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 */
GPIO4, /* 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
GPIO5, /* 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 */
GPIO2, /* ARDUINO_PIN_A4 (SDA) */
GPIO14, /* 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 */
/** @} */

View File

@ -0,0 +1,66 @@
/*
* 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_sparkfun-thing SparkFun ESP8266 Thing
* @ingroup boards_esp8266
*/
/**
* @ingroup boards_esp8266_sparkfun-thing
* @brief Board specific definitions for
* SparkFun ESP8266 Thing boards.
* @file
* @author Gunar Schorcht <gunar@schorcht.net>
* @{
*/
#ifndef BOARD_H
#define BOARD_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @name On-board LED configuration and control definitions
* @{
*/
#define LED0_PIN GPIO5 /**< GPIO5 is used as LED Pin */
#define LED0_ACTIVE (1) /**< LED is high active */
/** @} */
/**
* @name SPI configuration
* @{
*/
#if defined(MODULE_PERIPH_SPI) || defined(DOXYGEN)
/**
* GPIO15 is not available on SparkFun Thing Dev. Therefore another GPIO is
* define as default CS signal for HSPI interface SPI_DEV(0).
*/
#ifndef SPI0_CS0_GPIO
#define SPI0_CS0_GPIO GPIO16 /**< HSPI / SPI_DEV(0) CS default pin, only used when cs
parameter in spi_acquire is GPIO_UNDEF */
#endif
#endif /* defined(MODULE_PERIPH_SPI) || defined(DOXYGEN) */
/** @} */
#ifdef __cplusplus
} /* end extern "C" */
#endif
/* include common board definitions as last step */
#include "board_common.h"
#endif /* BOARD_H */
/** @} */

View File

@ -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_sparkfun-thing
* @brief Board specific configuration of direct mapped GPIOs
* @file
* @author Gunar Schorcht <gunar@schorcht.net>
* @{
*/
#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_INIT_CLEAR
}
};
#ifdef __cplusplus
}
#endif
#endif /* GPIO_PARAMS_H */
/** @} */

View File

@ -0,0 +1,59 @@
/*
* 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_sparkfun-thing
* @brief Board specific configuration of MCU periphery for
* SparkFun ESP8266 Thing boards.
* @file
* @author Gunar Schorcht <gunar@schorcht.net>
* @{
*/
#ifndef PERIPH_CONF_H
#define PERIPH_CONF_H
#include <stdint.h>
#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
/**
* @brief SPI Flash chip size can not be determined by the chip and therefore
* must be explicitly set to 512 kbytes
*/
#define SPI_FLASH_CHIP_SIZE 0x80000
/* include common peripheral definitions as last step */
#include "periph_conf_common.h"
#endif /* PERIPH_CONF_H */
/** @} */