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

boards: add esp32-olimex-evb

This commit is contained in:
Schorcht 2018-10-08 12:20:49 +02:00
parent c11a36ec6c
commit d3444e2631
9 changed files with 691 additions and 0 deletions

View File

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

View File

@ -0,0 +1,5 @@
ifneq (,$(filter can,$(USEMODULE)))
USEMODULE += esp_can
endif
include $(RIOTBOARD)/common/esp32/Makefile.dep

View File

@ -0,0 +1,16 @@
# common board and CPU features
include $(RIOTBOARD)/common/esp32/Makefile.features
# additional features provided by the board (no ADC and no DAC)
FEATURES_PROVIDED += periph_adc
FEATURES_PROVIDED += periph_dac
FEATURES_PROVIDED += periph_i2c
FEATURES_PROVIDED += periph_pwm
FEATURES_PROVIDED += periph_spi
# unique features of the board
FEATURES_PROVIDED += periph_eth # Ethernet MAC (EMAC)
FEATURES_PROVIDED += periph_can # CAN peripheral interface
FEATURES_PROVIDED += periph_ir # IR peripheral interface
FEATURES_PROVIDED += arduino

View File

@ -0,0 +1,15 @@
PSEUDOMODULES += olimex_esp32_gateway
USEMODULE += boards_common_esp32
# enables esp_eth as network device
ifneq (,$(filter netdev_default gnrc_netdev_default,$(USEMODULE)))
# avoid multiple definitions when package depenedencies are resolved recursively
ifndef MODULE_ESP_ETH_ADDED
MODULE_ESP_ETH_ADDED = 1
USEMODULE += esp_eth
$(eval GNRC_NETIF_NUMOF=$(shell echo $$(($(GNRC_NETIF_NUMOF)+1))))
endif
endif
include $(RIOTBOARD)/common/esp32/Makefile.include

View File

@ -0,0 +1,184 @@
/*
* 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_esp32_olimex-esp32-evb Olimex ESP32-EVB
* @ingroup boards_esp32
* @brief Support for Olimex ESP32-EVB and ESP32-GATEWAY
* @author Gunar Schorcht <gunar@schorcht.net>
## <a name="toc"> Table of Contents </a>
1. [Overview](#overview)
2. [Hardware](#hardware)
1. [MCU](#mcu)
2. [Board Configuration](#board_configuration)
3. [Board Pinout](#pinout)
4. [Optional Hardware Configurations](#optional_hardware)
3. [Flashing the Device](#flashing)
## <a name="overview"> Overview </a> &nbsp;&nbsp; [[TOC](#toc)]
[Olimex ESP32-EVB](https://github.com/OLIMEX/ESP32-EVB) and [Olimex ESP32-GATEWAY](https://github.com/OLIMEX/ESP32-GATEWAY) are open source hardware boards which use the ESP32-WROOM module. The key features of the boards are:
- Ethernet LAN interface
- MicroSD card interface
- IR interface (Olimex ESP32-EVB only)
- CAN interface (Olimex ESP32-EVB only)
- two Relais (Olimex ESP32-EVB only)
- [UEXT](https://www.olimex.com/Products/Modules/UEXT/) connector with I2C, SPI and UART interfaces (Olimex ESP32-EVB only)
Using the UEXT connector, a lot of [off-board hardware modules](https://www.olimex.com/Products/Modules/) can be connected to Olimex ESP32-EVB to extend the hardware without the need for soldering iron or breadboards.
Because of the differences in the on-board hardware, it is necessary to add the following line to the makefile of the application to use the according configuration for Olimex ESP32-GATEWAY:
```
USEMODULE += olimex_esp32_gateway
```
@image html "https://gitlab.com/gschorcht/RIOT.wiki-Images/raw/master/esp32/Olimex_ESP32-EVB_GATEWAY.png?inline=false" "Olimex ESP32-EVB (left) and Olimex ESP32-GATEWAY (right)"
## <a name="hardware"> Hardware </a> &nbsp;&nbsp; [[TOC](#toc)]
This section describes
- the [MCU](#mcu),
- the default [board configuration](#board_configuration),
- [optional hardware configurations](#optional_hardware),
- the [board pinout](#pinout).
### <a name="mcu"> MCU </a> &nbsp;&nbsp; [[TOC](#toc)]
Most features of the boards are provided by the ESP32 SoC. The following table summarizes these features and gives an overview of which of these features are supported by RIOT. For detailed information about the ESP32, see section \ref esp32_mcu "MCU ESP32".
<center>
MCU | ESP32 | Supported by RIOT
------------|-----------|------------------
Vendor | Espressif | |
Cores | 1 or 2 x Tensilica Xtensa LX6 | 1 core
FPU | yes (ULP - Ultra low power co-processor) | no
RAM | 520 kByte SRAM <br> 16 kByte RTC SRAM | yes
ROM | 520 kByte | yes
Flash | 512 kByte ... 16 MByte | yes
Frequency | 240 MHz, 160 MHz, 80 MHz | yes
Power Consumption | 68 mA @ 240 MHz <br> 44 mA @ 160 MHz <br> 31 mA @ 80 MHz <br> 5 uA in deep sleep mode | yes <br> yes <br> yes <br> no
Timers | 4 x 64 bit | yes
ADCs | 2 x SAR-ADC with up to 18 x 12 bit channels total | yes
DACs | 2 x DAC with 8 bit | yes
GPIOs | 34 (6 of them are only inputs) | yes
I2Cs | 2 | yes
SPIs | 4 | yes
UARTs | 3 | yes
WiFi | IEEE 802.11 b/g/n built in | yes
Bluetooth | v4.2 BR/EDR and BLE | no
Ethernet | MAC interface with dedicated DMA and IEEE 1588 support | yes
CAN | version 2.0 | no
IR | up to 8 channels TX/RX | no
Motor PWM | 2 devices x 6 channels | yes
LED PWM | 16 channels | no
Crypto | Hardware acceleration of AES, SHA-2, RSA, ECC, RNG | no
Vcc | 2.5 - 3.6 V | |
Documents | [Datasheet](https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf) <br> [Technical Reference](https://www.espressif.com/sites/default/files/documentation/esp32_technical_reference_manual_en.pdf) | |
</center>
### <a name="board_configuration"> Board Configuration </a> &nbsp;&nbsp; [[TOC](#toc)]
Olimex ESP32-EVB and Olimex ESP32-GATEWAY have the following on-board components:
- Ethernet LAN interface
- MicroSD card interface
- IR interface (Olimex ESP32-EVB only)
- CAN interface (Olimex ESP32-EVB only)
- two Relais (Olimex ESP32-EVB only)
- [UEXT](https://www.olimex.com/Products/Modules/UEXT/) connector with I2C, SPI and UART interfaces (Olimex ESP32-EVB only)
The following table shows the default board configuration, which is sorted according to the defined functionality of GPIOs. This configuration can be overridden by \ref esp32_app_spec_conf "application-specific configurations".
<center>
\anchor esp32_olimex-esp32-evb_table_board_configuration
Pin | Configuration<b>*</b><br>ESP32-EVB | Configuration<b>*</b><br>ESP32-GATEWAY | Remarks / Prerequisites | Configuration
:------|:------------------|:-----------------|-|-|
GPIO13 | I2C_DEV(0):SDA | SDCARD_CS | on ESP32-EVB available at [[UEXT1](https://www.olimex.com/Products/Modules/UEXT)] | \ref esp32_i2c_interfaces "I2C Interfaces"
GPIO16 | I2C_DEV(0):SCL | I2C_DEV(0):SCL | on ESP32-EVB available at [[UEXT1](https://www.olimex.com/Products/Modules/UEXT)] | \ref esp32_i2c_interfaces "I2C Interfaces"
GPIO14 | SPI_DEV(0):CLK | SDCARD_CLK | on ESP32-EVB available at [[UEXT1](https://www.olimex.com/Products/Modules/UEXT)] | \ref esp32_spi_interfaces "SPI Interfaces"
GPIO2 | SPI_DEV(0):MISO | SDCARD_MISO | on ESP32-EVB available at [[UEXT1](https://www.olimex.com/Products/Modules/UEXT)] | \ref esp32_spi_interfaces "SPI Interfaces"
GPIO15 | SPI_DEV(0):MOSI | SDCARD_MOSI | on ESP32-EVB available at [[UEXT1](https://www.olimex.com/Products/Modules/UEXT)] | \ref esp32_spi_interfaces "SPI Interfaces"
GPIO17 | SPI_DEV(0):CS0 | I2C_DEV(0):SDA | on ESP32-EVB available at [[UEXT1](https://www.olimex.com/Products/Modules/UEXT)] | \ref esp32_spi_interfaces "SPI Interfaces"
GPIO1 | UART_DEV(0):TxD | UART_DEV(0):TxD | Console (cannot be changed) | \ref esp32_uart_interfaces "UART interfaces"
GPIO3 | UART_DEV(0):RxD | UART_DEV(0):RxD | Console (cannot be changed) | \ref esp32_uart_interfaces "UART interfaces"
GPIO4 | UART_DEV(1):TxD | N/A | ESP32-EVB [[UEXT1](https://www.olimex.com/Products/Modules/UEXT)] | \ref esp32_uart_interfaces "UART interfaces"
GPIO36 | UART_DEV(1):RxD | ADC_LINE(2) | on ESP32-EVB available at [[UEXT1](https://www.olimex.com/Products/Modules/UEXT)] | \ref esp32_uart_interfaces "UART interfaces"
GPIO32 | Relais 1 | ADC_LINE(0) | | \ref esp32_adc_channels "ADC Channels"
GPIO33 | Relais 2 | LED0 | | |
GPIO34 | BUTTON0 | BUTTON0 | | |
GPIO9 | PWM_DEV(0):0 | PWM_DEV(0):0 | | \ref esp32_pwm_channels "PWM Channels"
GPIO10 | PWM_DEV(0):1 | PWM_DEV(0):1 | | \ref esp32_pwm_channels "PWM Channels"
GPIO5 | CAN_DEV(0):TX | | | \ref esp32_can_interfaces "CAN Interfaces"
GPIO35 | CAN_DEV(0):RX | ADC_LINE(1) | | \ref esp32_adc_channels "ADC Channels"
GPIO12 | IR_DEV(0):TX | N/A | IR is not yet supported | |
GPIO39 | IR_DEV(0):RX | ADC_LINE(3) | IR is not yet supported | \ref esp32_adc_channels "ADC Channels"
GPIO18 | EMAC_SMI:MDIO | EMAC_SMI:MDIO | LAN interface | \ref esp32_ethernet_network_interface "Ethernet MAC"
GPIO23 | EMAC_SMI:MDC | EMAC_SMI:MDC | LAN interface | \ref esp32_ethernet_network_interface "Ethernet MAC"
GPIO0 | EMAC_RMII:TX_CLK | EMAC_RMII:TX_CLK | LAN interface | \ref esp32_ethernet_network_interface "Ethernet MAC"
GPIO21 | EMAC_RMII:TX_EN | EMAC_RMII:TX_EN | LAN interface | \ref esp32_ethernet_network_interface "Ethernet MAC"
GPIO19 | EMAC_RMII:TXD0 | EMAC_RMII:TXD0 | LAN interface | \ref esp32_ethernet_network_interface "Ethernet MAC"
GPIO22 | EMAC_RMII:TXD1 | EMAC_RMII:TXD1 | LAN interface | \ref esp32_ethernet_network_interface "Ethernet MAC"
GPIO25 | EMAC_RMII:RXD0 | EMAC_RMII:RXD0 | LAN interface | \ref esp32_ethernet_network_interface "Ethernet MAC"
GPIO26 | EMAC_RMII:RXD1 | EMAC_RMII:RXD1 | LAN interface | \ref esp32_ethernet_network_interface "Ethernet MAC"
GPIO27 | EMAC_RMII:RX_DV | EMAC_RMII:RX_DV | LAN interface | \ref esp32_ethernet_network_interface "Ethernet MAC"
</center>
@note
- To use the board configuration for Olimex-ESP32-GATEWAY, it is necessary to add the following line to makefile of the application:<br><br>
```
USEMODULE += olimex_esp32_gateway
```
- GPIO9 and GIOP10 can only be used in **dout** and **dio** \ref esp32_flash_modes "flash modes".
- It might be necessary to remove the SD card or the peripheral hardware attached to the SPI_DEV(0) interface for flashing RIOT. Reason is that the **SPI_DEV(0)** interface uses the HSPI interface with the GPIO2 pin as the MISO signal, which has bootstrapping functionality.
For detailed information about the configuration of ESP32 boards, see section \ref esp32_comm_periph "Common Peripherals".
### <a name="optional_hardware"> Optional Hardware Configurations </a> &nbsp;&nbsp; [[TOC](#toc)]
MRF24J40-based IEEE 802.15.4 radio modules have been tested with the board. You could use the following code in your \ref esp32_app_spec_conf "application-specific configuration" to use such modules:
```
#ifdef BOARD_ESP32_OLIMEX_EVB && !MODULE_ESP32_OLIMEX_GATEWAY
#if MODULE_MRF24J40
#define MRF24J40_PARAM_CS GPIO9 /* MRF24J40 CS signal */
#define MRF24J40_PARAM_RESET GPIO10 /* MRF24J40 RESET signal */
#define MRF24J40_PARAM_INT GPIO34 /* MRF24J40 INT signal */
#endif
#endif
```
For other parameters, the default values defined by the drivers can be used.
@note
- Since the Olimex-ESP32-GATEWAY does not break out the GPIO of the HSPI interface SPI_DEV(0), it is not possible to connect such module to Olimex-ESP32-GATEWAY.
- Since the Olimex-ESP32-EVB has a lot of on-board hardware, only a few GPIOs are available for external hardware.
- The **RESET** signal of MRF24J40 based modules can also be connected to the **RST** pin of the board (see \ref esp32_olimex-esp32-evb_pinout "pinout") to keep the configured GPIO free for other purposes.
### <a name="pinout"> Board Pinout </a> &nbsp;&nbsp; [[TOC](#toc)]
The following pictures shows the pinout of Olimex ESP32-EVB and Olimex ESP32-GATEWAY boards as defined by the default board configuration. The light green GPIOs are not used by configured on-board hardware components and can be used for any purpose. However, if optional off-board hardware modules are used, these GPIOs may also be occupied, see \ref esp32_olimex-esp32-evb_table_board_configuration "optional functions" in table board configuration.
The corresponding board schematics can be found on GitHub for [Olimex ESP32-EVB board](https://github.com/OLIMEX/ESP32-EVB/raw/master/HARDWARE/REV-D/ESP32-EVB_Rev_D.pdf) and for [Olimex ESP32-GATEWAY](https://github.com/OLIMEX/ESP32-GATEWAY/raw/master/HARDWARE/Hardware%20revision%20C/ESP32-GATEWAY_Rev_C.pdf).
\anchor esp32_olimex-esp32-evb_pinout
@image html "https://gitlab.com/gschorcht/RIOT.wiki-Images/raw/master/esp32/Olimex_ESP32-EVB_pinout.png?inline=false" "Olimex ESP32-EVB pinout"
@image html "https://gitlab.com/gschorcht/RIOT.wiki-Images/raw/master/esp32/Olimex_ESP32-GATEWAY_pinout.png?inline=false" "Olimex ESP32-GATEWAY pinout"
## <a name="flashing"> Flashing the Device </a> &nbsp;&nbsp; [[TOC](#toc)]
Flashing RIOT is quite easy. The board has a Micro-USB connector with reset/boot/flash logic. Just connect the board to your host computer and type using the programming port:
```
make flash BOARD=esp32-olimex-evb ...
```
For detailed information about ESP32 as well as configuring and compiling RIOT for ESP32 boards, see \ref esp32_riot.
*/

View File

@ -0,0 +1,82 @@
/*
* 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_esp32_olimex-esp32-evb
* @{
*
* @file
* @brief Board specific configuration for the Arduino API
*
* @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 not available
*/
#define ARDUINO_LED (0)
/**
* @brief Look-up table for the Arduino's digital pins
*/
static const gpio_t arduino_pinmap[] = {
GPIO3, /* ARDUINO_PIN_0 (RxD) */
GPIO1, /* ARDUINO_PIN_1 (TxD) */
GPIO32, /* ARDUINO_PIN_2 */
GPIO33, /* ARDUINO_PIN_3 (PWM) */
GPIO4, /* ARDUINO_PIN_4 */
GPIO9, /* ARDUINO_PIN_5 (PWM) */
GPIO10, /* ARDUINO_PIN_6 (PWM) */
GPIO7, /* ARDUINO_PIN_7 */
GPIO8, /* ARDUINO_PIN_8 */
GPIO_UNDEF, /* ARDUINO_PIN_9 (PWM) */
GPIO17, /* ARDUINO_PIN_10 (CS0 / PWM) */
GPIO15, /* ARDUINO_PIN_11 (MOSI / PWM) */
GPIO2, /* ARDUINO_PIN_12 (MISO) */
GPIO14, /* ARDUINO_PIN_13 (SCK) */
GPIO34, /* ARDUINO_PIN_A0 */
GPIO35, /* ARDUINO_PIN_A1 */
GPIO36, /* ARDUINO_PIN_A2 */
GPIO39, /* ARDUINO_PIN_A3 */
GPIO13, /* ARDUINO_PIN_A4 (SDA) */
GPIO16, /* ARDUINO_PIN_A5 (SCL) */
};
/**
* @brief Look-up table for the Arduino's analog pins
*/
static const adc_t arduino_analog_map[] = {
GPIO34, /* ARDUINO_PIN_A0 */
GPIO35, /* ARDUINO_PIN_A1 */
GPIO36, /* ARDUINO_PIN_A2 */
GPIO39, /* ARDUINO_PIN_A3 */
GPIO13, /* ARDUINO_PIN_A4 (SDA) */
GPIO16, /* ARDUINO_PIN_A5 (SCL) */
};
#ifdef __cplusplus
}
#endif
#endif /* ARDUINO_BOARD_H */
/** @} */

View File

@ -0,0 +1,106 @@
/*
* 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_esp32_olimex-esp32-evb
* @brief Board specific definitions for Olimex ESP32-EVB (ESP32-GATEWAY)
*
* This configuration is for the Olimex ESP32-EVB, but can also be used
* for the Olimex ESP32-GATEWAY. To use this board definition with Olimex
* ESP32-GATEWAY, add
* ```
* USEMODULE += olimex_esp32_gateway
* ```
* to the makefile of the application to use the according default board
* configuration.
*
* For detailed information about the configuration of ESP32 boards, see
* section \ref esp32_comm_periph "Common Peripherals".
*
* @note
* Most definitions can be overridden by an \ref esp32_app_spec_conf
* "application-specific board configuration".
*
* @author Gunar Schorcht <gunar@schorcht.net>
* @file
* @{
*/
#ifndef BOARD_H
#define BOARD_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @name Button pin definitions
* @{
*/
#define BUTTON0_PIN GPIO34
/** @} */
/**
* @name LED (on-board) configuration
*
* Olimex ESP32-GATEWAY has an ob-board LED.
* @{
*/
#if MODULE_OLIMEX_ESP32_GATEWAY
#define LED0_PIN GPIO33
#define LED0_ACTIVE (1) /**< LED is high active */
#endif
/** @} */
/**
* @name SD-Card interface configuration
*
* SD-Card interface uses SPI_DEV(1) on this board.
*
* @note On Olimex ESP32-EVB, the CD/CS pin is not connected and
* simply pulled-up. Therefore, SPI bus mode is not available and the card
* interface can be used only in 1-bit SD bus mode. That is, SPI SD-Card
* is not working. On Olimex ESP32-GATEWAY, the CD/CS pin is connected to
* GPIO13. The SPI SD-Card driver should work on this board.
* @{
*/
#if (MODULE_SDCARD_SPI && MODULE_OLIMEX_ESP32_GATEWAY) || DOXYGEN
#define SDCARD_SPI_PARAM_SPI SPI_DEV(0)
#define SDCARD_SPI_PARAM_CS GPIO13
#define SDCARD_SPI_PARAM_CLK SPI0_SCK
#define SDCARD_SPI_PARAM_MOSI SPI0_MOSI
#define SDCARD_SPI_PARAM_MISO SPI0_MISO
#define SDCARD_SPI_PARAM_POWER GPIO_UNDEF
#endif
/** @} */
/**
* @name ESP32 Ethernet (EMAC) configuration
* @{
*/
#if MODULE_ESP_ETH || DOXYGEN
#define EMAC_PHY_LAN8720 1 /**< LAN8710 used as PHY interface */
#define EMAC_PHY_ADDRESS 0 /**< PHY0 used as base address */
#define EMAC_PHY_SMI_MDC_PIN 23 /**< SMI MDC pin */
#define EMAC_PHY_SMI_MDIO_PIN 18 /**< SMI MDC pin */
#define EMAC_PHY_CLOCK_MODE ETH_CLOCK_GPIO0_IN /**< external 50 MHz clock */
#define EMAC_PHY_POWER_PIN GPIO_UNDEF /**< power enable pin not used */
#endif
/** @} */
/* include common board definitions as last step */
#include "board_common.h"
#ifdef __cplusplus
} /* end extern "C" */
#endif
#endif /* BOARD_H */
/** @} */

View File

@ -0,0 +1,53 @@
/*
* 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_esp32_olimex-esp32-evb
* @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 and button configuration
*/
static const saul_gpio_params_t saul_gpio_params[] =
{
#if MODULE_OLIMEX_ESP32_GATEWAY
{
.name = "LED",
.pin = LED0_PIN,
.mode = GPIO_OUT,
.flags = SAUL_GPIO_INIT_CLEAR
},
#endif
{
.name = "BUT1",
.pin = BUTTON0_PIN,
.mode = GPIO_IN,
.flags = 0
},
};
#ifdef __cplusplus
}
#endif
#endif /* GPIO_PARAMS_H */
/** @} */

View File

@ -0,0 +1,225 @@
/*
* 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_esp32_olimex-esp32-evb
* @brief Peripheral MCU configuration for Olimex ESP32-EVB (ESP32-GATEWAY)
* @{
*
* This configuration is for the Olimex ESP32-EVB, but can also be used
* for the Olimex ESP32-GATEWAY. To use this board definition with Olimex
* ESP32-GATEWAY, add
* ```
* USEMODULE += olimex_esp32_gateway
* ```
* to the makefile of the application to use the according default board
* configuration.
*
* For detailed information about the configuration of ESP32 boards, see
* section \ref esp32_comm_periph "Common Peripherals".
*
* @note
* Most definitions can be overridden by an \ref esp32_app_spec_conf
* "application-specific board configuration".
*
* @author Gunar Schorcht <gunar@schorcht.net>
* @file
*/
#ifndef PERIPH_CONF_H
#define PERIPH_CONF_H
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @name ADC and DAC channel configuration
*
* @note As long as the GPIOs listed in ADC_GPIOS are not initialized as ADC
* channels with the ```adc_init``` function, they can be used for other
*
* purposes.
* @{
*/
/**
* @brief Declaration of GPIOs that can be used as ADC channels
*
* @note As long as the GPIOs listed in ADC_GPIOS are not initialized as ADC
* channels with the ```adc_init``` function, they can be used for other
* purposes.
*/
#ifndef ADC_GPIOS
#if MODULE_OLIMEX_ESP32_GATEWAY
#define ADC_GPIOS { GPIO32, GPIO35, GPIO36, GPIO39 }
#else /* MODULE_OLIMEX_ESP32_GATEWAY */
#define ADC_GPIOS { }
#endif /* MODULE_OLIMEX_ESP32_GATEWAY */
#endif /* ADC_GPIOS */
/** Olimex ESP32-EVB has no GPIOs left that might be used as DAC channels. */
#ifndef DAC_GPIOS
#define DAC_GPIOS { }
#endif
/** @} */
/**
* @name CAN configuration
*
* Olimex ESP32-EVB has a CAN interface including a CAN tranceiver on board.
*/
#ifndef MODULE_OLIMEX_ESP32_GATEWAY
#define CAN_TX GPIO5 /**< CAN TX tranceiver signal */
#define CAN_RX GPIO35 /**< CAN RX tranceiver signal */
#endif
/**
* @name I2C configuration
*
* Olimex ESP32-EVB/GATEWAY have one I2C interface ```I2C_DEV(0)```. However,
* they use different GPIOs. Olimex ESP32-EVB, the interface is also available
* at the [UEXT] connector.
*
* @note The GPIOs listed in the configuration are only initialized as I2C
* signals when module ```perpih_i2c``` is used. Otherwise they are not
* allocated and can be used for other purposes.
*
* @{
*/
#ifndef I2C0_SPEED
#define I2C0_SPEED I2C_SPEED_FAST /**< I2C bus speed of I2C_DEV(0) */
#endif
#ifdef MODULE_OLIMEX_ESP32_GATEWAY
#ifndef I2C0_SCL
#define I2C0_SCL GPIO16 /**< SCL signal of I2C_DEV(0) [UEXT] */
#endif
#ifndef I2C0_SDA
#define I2C0_SDA GPIO17 /**< SDA signal of I2C_DEV(0) [UEXT] */
#endif
#else /* MODULE_OLIMEX_ESP32_GATEWAY */
#ifndef I2C0_SCL
#define I2C0_SCL GPIO16 /**< SCL signal of I2C_DEV(0) */
#endif
#ifndef I2C0_SDA
#define I2C0_SDA GPIO13 /**< SDA signal of I2C_DEV(0) */
#endif
#endif /* MODULE_OLIMEX_ESP32_GATEWAY */
/** @} */
/**
* @name PWM channel configuration
*
* @note As long as the according PWM device is not initialized with
* the ```pwm_init```, the GPIOs declared for this device can be used
* for other purposes.
*
* @{
*/
/**
* In DOUT and DIO flash mode, GPIO9 and GIO10 are available and can be used
* as PWM channels with ```PWM_DEV(0)```.
*/
#ifndef PWM0_GPIOS
#if FLASH_MODE_DOUT || FLASH_MODE_DIO || DOXYGEN
#define PWM0_GPIOS { GPIO9, GPIO10 }
#else
#error Configuration problem: Flash mode qio or qout is used, \
GPIO9 and GPIO10 cannot be used as PWM channels as configured
#define PWM0_GPIOS { }
#endif
#endif
/** PWM_DEV(1) is not used */
#ifndef PWM1_GPIOS
#define PWM1_GPIOS { }
#endif
/** @} */
/**
* @name SPI configuration
* @{
*/
/**
* @brief HSPI is used as SPI_DEV(0)
*
* It is available at the [UEXT] connector on Olimex ESP32-EVB.
*
* Although the SD card interface of the Olimex ESP32-EVB is also available at
* the ```SPI_DEV(0)``` interface, it does not have a CS signal. Therefore,
* it cannot be used in SPI mode with the ```sdcard_spi``` module. Olimex
* ESP32-GATEWAY uses the integrated SD card interface with another GPIO for
* the CS signal.
*
* @note The GPIOs listed in the configuration are first initialized as SPI
* signals when the corresponding SPI interface is used for the first time
* by either calling the ```spi_init_cs``` function or the ```spi_acquire```
* function. That is, they are not allocated as SPI signals before and can
* be used for other purposes as long as the SPI interface is not used.
*/
#ifndef SPI0_DEV
#define SPI0_DEV HSPI
#endif
#ifndef SPI0_SCK
#define SPI0_SCK GPIO14 /**< SCK [UEXT] / SD card interface] */
#endif
#ifndef SPI0_MISO
#define SPI0_MISO GPIO2 /**< MISO [UEXT] / SD card interface] */
#endif
#ifndef SPI0_MOSI
#define SPI0_MOSI GPIO15 /**< MOSI [UEXT] / SD Card interface] */
#endif
#ifndef SPI0_CS0
#ifndef MODULE_OLIMEX_ESP32_GATEWAY
#define SPI0_CS0 GPIO17 /**< CS0 [UEXT] */
#else /* MODULE_OLIMEX_ESP32_GATEWAY */
#define SPI0_CS0 GPIO13 /**< CS0 SD Card interface */
#endif /* MODULE_OLIMEX_ESP32_GATEWAY */
#endif /* SPI0_CS0 */
/** @} */
/**
* @name UART configuration
*
* ESP32 provides 3 UART interaces at maximum:
*
* UART_DEV(0) uses fixed standard configuration.<br>
* UART_DEV(1) is defined here.<br>
* UART_DEV(2) is not used.<br>
*
* If the board definition is used for Olimex EVB-GATEWAY, the UART_DEV(1)
* interface is not available.
*
* @{
*/
#define UART0_TXD GPIO1 /**< direct I/O pin for UART_DEV(0), can't be changed */
#define UART0_RXD GPIO3 /**< direct I/O pin for UART_DEV(0), can't be changed */
#ifndef UART1_TXD
#define UART1_TXD GPIO4 /**< UART_DEV(1) TxD */
#endif
#ifndef UART1_RXD
#define UART1_RXD GPIO36 /**< UART_DEV(1) RxD */
#endif
/** @} */
#ifdef __cplusplus
} /* end extern "C" */
#endif
/* include common peripheral definitions as last step */
#include "periph_conf_common.h"
#endif /* PERIPH_CONF_H */
/** @} */