Skip to content

Commit

Permalink
boards/esp32s2-devkit: add board definition for ESP32-S2-DevKit
Browse files Browse the repository at this point in the history
  • Loading branch information
gschorcht committed Aug 30, 2022
1 parent d85e9b3 commit 1862d4e
Show file tree
Hide file tree
Showing 12 changed files with 755 additions and 0 deletions.
1 change: 1 addition & 0 deletions .murdock
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ esp32c3-ci
esp32c3-devkit
esp32s3-ci
esp32s3-devkit
esp32s2-devkit
esp8266-ci
esp8266-esp-12x
hamilton
Expand Down
64 changes: 64 additions & 0 deletions boards/esp32s2-devkit/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Copyright (c) 2020 HAW Hamburg
# 2022 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.

config BOARD
default "esp32s2-devkit" if BOARD_ESP32S2_DEVKIT

config BOARD_ESP32S2_DEVKIT
bool
default y
select BOARD_COMMON_ESP32S2
select CPU_MODEL_ESP32S2_MINI_1X_N4 if BOARD_VERSION_ESP32S2_DEVKITM_1
select CPU_MODEL_ESP32S2_MINI_1X_N4 if BOARD_VERSION_ESP32S2_DEVKITM_1U
select CPU_MODEL_ESP32S2_MINI_1X_N4R2 if BOARD_VERSION_ESP32S2_DEVKITM_1R
select CPU_MODEL_ESP32S2_MINI_1X_N4R2 if BOARD_VERSION_ESP32S2_DEVKITM_1RU
select CPU_MODEL_ESP32S2_SOLO_N4 if BOARD_VERSION_ESP32S2_DEVKITC_1
select CPU_MODEL_ESP32S2_SOLO_N4 if BOARD_VERSION_ESP32S2_DEVKITC_1U
select CPU_MODEL_ESP32S2_SOLO_N4R2 if BOARD_VERSION_ESP32S2_DEVKITC_1R
select CPU_MODEL_ESP32S2_SOLO_N4R2 if BOARD_VERSION_ESP32S2_DEVKITC_1RU
select CPU_MODEL_ESP32S2_WROOM if BOARD_VERSION_ESP32S2_SAOLA_1M
select CPU_MODEL_ESP32S2_WROOM if BOARD_VERSION_ESP32S2_SAOLA_1MI
select CPU_MODEL_ESP32S2_WROVER_N4R2 if BOARD_VERSION_ESP32S2_SAOLA_1R
select CPU_MODEL_ESP32S2_WROVER_N4R2 if BOARD_VERSION_ESP32S2_SAOLA_1RI
select HAS_ARDUINO
select HAS_PERIPH_ADC
select HAS_PERIPH_DAC
select HAS_PERIPH_I2C
select HAS_PERIPH_PWM
select HAS_PERIPH_SPI

choice
bool "ESP32-S2-DevKit board version"
default BOARD_VERSION_ESP32S2_DEVKITM_1

config BOARD_VERSION_ESP32S2_DEVKITM_1
bool "ESP32-S2-DevKitM-1"
config BOARD_VERSION_ESP32S2_DEVKITM_1U
bool "ESP32-S2-DevKitM-1U"
config BOARD_VERSION_ESP32S2_DEVKITM_1R
bool "ESP32-S2-DevKitM-1R"
config BOARD_VERSION_ESP32S2_DEVKITM_1RU
bool "ESP32-S2-DevKitM-1RU"
config BOARD_VERSION_ESP32S2_DEVKITC_1
bool "ESP32-S2-DevKitC-1"
config BOARD_VERSION_ESP32S2_DEVKITC_1U
bool "ESP32-S2-DevKitC-1U"
config BOARD_VERSION_ESP32S2_DEVKITC_1R
bool "ESP32-S2-DevKitC-1R"
config BOARD_VERSION_ESP32S2_DEVKITC_1RU
bool "ESP32-S2-DevKitC-1RU"
config BOARD_VERSION_ESP32S2_SAOLA_1M
bool "ESP32-S2-SAOLA-1M"
config BOARD_VERSION_ESP32S2_SAOLA_1MI
bool "ESP32-S2-SAOLA-1MI"
config BOARD_VERSION_ESP32S2_SAOLA_1R
bool "ESP32-S2-SAOLA-1R"
config BOARD_VERSION_ESP32S2_SAOLA_1RI
bool "ESP32-S2-SAOLA-1RI"
endchoice

source "$(RIOTBOARD)/common/esp32s2/Kconfig"
5 changes: 5 additions & 0 deletions boards/esp32s2-devkit/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
MODULE = board

DIRS = $(RIOTBOARD)/common/esp32s2

include $(RIOTBASE)/Makefile.base
1 change: 1 addition & 0 deletions boards/esp32s2-devkit/Makefile.dep
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include $(RIOTBOARD)/common/esp32s2/Makefile.dep
44 changes: 44 additions & 0 deletions boards/esp32s2-devkit/Makefile.features
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# default board version if not defined
ifeq (,$(BOARD_VERSION))
BOARD_VERSION += esp32s2-devkitm-1
endif

ifeq (esp32s2-devkitm-1,$(BOARD_VERSION))
CPU_MODEL = esp32s2_mini_1x_n4
else ifeq (esp32s2-devkitm-1u,$(BOARD_VERSION))
CPU_MODEL = esp32s2_mini_1x_n4
else ifeq (esp32s2-devkitm-1r,$(BOARD_VERSION))
CPU_MODEL = esp32s2_mini-1x_n4r2
else ifeq (esp32s2-devkitm-1ru,$(BOARD_VERSION))
CPU_MODEL = esp32s2_mini-1x_n4r2
else ifeq (esp32s2-devkitc_1,$(BOARD_VERSION))
CPU_MODEL = esp32s2_solo_n4
else ifeq (esp32s2-devkitc_1u,$(BOARD_VERSION))
CPU_MODEL = esp32s2_solo_n4
else ifeq (esp32s2-devkitc-1r,$(BOARD_VERSION))
CPU_MODEL = esp32s2_solo_n4r2
else ifeq (esp32s2-devkitc-1ru,$(BOARD_VERSION))
CPU_MODEL = esp32s2_solo_n4r2
else ifeq (esp32s2-saola-1m,$(BOARD_VERSION))
CPU_MODEL = esp32s2_wroom
else ifeq (esp32s2-saola-1mi,$(BOARD_VERSION))
CPU_MODEL = esp32s2_wroom
else ifeq (esp32s2-saola-1r,$(BOARD_VERSION))
CPU_MODEL = esp32s2_wrover_n4r2
else ifeq (esp32s2-saola-1ri,$(BOARD_VERSION))
CPU_MODEL = esp32s2_wrover_n4r2
else
$(error BOARD_VERSION is unknown)
endif

# common board and CPU features
include $(RIOTBOARD)/common/esp32s2/Makefile.features

# additional features provided by the board
FEATURES_PROVIDED += periph_adc
FEATURES_PROVIDED += periph_dac
FEATURES_PROVIDED += periph_i2c
FEATURES_PROVIDED += periph_pwm
FEATURES_PROVIDED += periph_spi

FEATURES_PROVIDED += arduino
8 changes: 8 additions & 0 deletions boards/esp32s2-devkit/Makefile.include
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
PSEUDOMODULES += esp32s2_devkitm_1
PSEUDOMODULES += esp32s2_devkitm_1r
PSEUDOMODULES += esp32s2_devkitc_1
PSEUDOMODULES += esp32s2_devkitc_1r
PSEUDOMODULES += esp32s2_saola_1
PSEUDOMODULES += esp32s2_saola_1r

include $(RIOTBOARD)/common/esp32s2/Makefile.include
201 changes: 201 additions & 0 deletions boards/esp32s2-devkit/doc.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
/*
* Copyright (C) 2022 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_esp32s2_devkit ESP32-S2-DevKit Board
* @ingroup boards_esp32s2
* @brief Support for generic ESP32S2 boards
* @author Gunar Schorcht <gunar@schorcht.net>

\section esp32s2_devkit ESP32-S2-DevKit

## Table of Contents {#esp32s2_devkit_toc}

1. [Overview](#esp32s2_devkit_overview)
2. [Hardware](#esp32s2_devkit_hardware)
1. [MCU](#esp32s2_devkit_mcu)
2. [Board Configuration](#esp32s2_devkit_board_configuration)
3. [Board Pinout](#esp32s2_devkit_pinout)
3. [Flashing the Device](#esp32s2_devkit_flashing)

## Overview {#esp32s2_devkit_overview}

The Espressif ESP32-S2-DevKit boards are a couple of boards that use one of
the following modules:

- ESP32-S2-MINI-1x-N4 module (ESP32-S2-DevKitM-1 board)
- ESP32-S2-MINI-1x-N4R2 module (ESP32-S2-DevKitM-1R board)
- ESP32-S2-SOLO-N4 module (ESP32-S2-DevKitC-1 board)
- ESP32-S2-SOLO-N4R2 module (ESP32-S2-DevKitC-1R board)
- ESP32-S2-WROOM module (ESP32-S2-Saola-1 board)
- ESP32-S2-WROVER-N4R2 module (ESP32-S2-Saola-1R board)

\image html "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/_images/esp32-s2-devkitm-1-v1-annotated-photo.png" "Espressif ESP32-S2-DevKitM-1" width=600px

<br>
Due to the different modules used, the available versions of the
ESP32-S2-DevKit board differ regarding the Flash size, the integrated SPI RAM
and the SPI voltage. To be able to use all these different versions of the
board with a single board definition, used board version can be specified
by the variable `BOARD_VERSION` during compilation, for example:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BOARD=esp32s2-devkit BOARD_VERSION=esp32s2-devkitc-1r make ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The following table shows the available board versions, the size of the
Flash and the SPI RAM as well as the value of the variable `BOARD_VERSION`
that is used to specify the board version.

<center>
| Board Version | Flash (Mode) | SPI RAM (Mode) | `BOARD_VERSION`
|:----------------------|:-------------|:---------------|:-----------------
| <b>ESP32-S2-DevKitM-1 | 4 MB (Quad) | - | `esp32s2-devkitm-1` (default)</b>
| ESP32-S2-DevKitM-1U | 4 MB (Quad) | - | `esp32s2-devkitm-1u`
| ESP32-S2-DevKitM-1R | 4 MB (Quad) | 2 MB (Quad) | `esp32s2-devkitm-1r`
| ESP32-S2-DevKitM-1RU | 4 MB (Quad) | 2 MB (Quad) | `esp32s2-devkitm-1ru`
| ESP32-S2-DevKitC-1 | 4 MB (Quad) | - | `esp32s2-devkitc-1`
| ESP32-S2-DevKitC-1U | 4 MB (Quad) | - | `esp32s2-devkitc-1u`
| ESP32-S2-DevKitC-1R | 4 MB (Quad) | 2 MB (Quad) | `esp32s2-devkitc-1r`
| ESP32-S2-DevKitC-1RU | 4 MB (Quad) | 2 MB (Quad) | `esp32s2-devkitc-1ru`
| ESP32-S2-Saola-1M | 4 MB (Quad) | - | `esp32s2-saola-1m`
| ESP32-S2-Saola-1MI | 4 MB (Quad) | - | `esp32s2-saola-1mi`
| ESP32-S2-Saola-1R | 4 MB (Quad) | 2 MB (Quad) | `esp32s2-saola-1r`
| ESP32-S2-Saola-1RI | 4 MB (Quad) | 2 MB (Quad) | `esp32s2-saola-1ri`
</center>
<br>

@note
- If the board version is not specified, <b>ESP32-S2-DevKitM-1 with 4 MByte
Flash</b> is assumed and `BOARD_VERSION` is set to <b>`esp32s2-devkitm-1`</b>
by default.
- Using a board version with embedded SPI RAM (`BOARD_VERSION` is any of
<b>`esp32s2-*-1r*`</b> values) enables the
\ref esp32_spi_ram "esp_spi_ram" feature. The SPI RAM can then be used as
heap by enabling the \ref esp32_spi_ram "esp_spi_ram" pseudomodule.

[Back to table of contents](#esp32s2_devkit_toc)

## Hardware {#esp32s2_devkit_hardware}

This section describes

- the [MCU](#esp32s2_devkit_mcu),
- the default [board configuration](#esp32s2_devkit_board_configuration),
- [optional hardware configurations](#esp32s2_devkit_optional_hardware),
- the [board pinout](#esp32s2_devkit_pinout).

[Back to table of contents](#esp32s2_devkit_toc)

### MCU {#esp32s2_devkit_mcu}

Most features of the board are provided by the ESP32-S2 SoC. For detailed
information about the ESP32-S2 SoC variant (family) and ESP32x SoCs,
see section \ref esp32_mcu_esp32 "ESP32 SoC Series".

[Back to table of contents](#esp32s2_devkit_toc)

### Board Configuration {#esp32s2_devkit_board_configuration}

ESP32-S2-DevKit boards have no special hardware on board with the exception
of a single pin RGB-LED that uses a special bit-oriented protocol to
control the RGB-LED by 24-bit RGB values which is not supported yet.

All GPIOs are simply broken out for flexibility. Therefore, the board
configuration is the most flexible one which provides:

- 20 x ADC channels at maximum
- 2 x SPI
- 1 x I2C
- 2 x UART
- 1 RGB-LED

Since almost GPIOs have broken out, GPIOs can be used for different purposes
in different applications. Following GPIOs are used for Flash and SPI RAM and
are not broken out:

- ESP32-S2-DevKitC-1x: GPIO27..GPIO32
- ESP32-S2-DevKitM-1x: GPIO26..GPIO32
- ESP32-S2-Saola-1x: GPIO26..GPIO32

For flexibility, GPIOs can be used in multiple peripheral configurations,
but they can only be used for one peripheral at a time. For example, GPIO9
is used in the ADC channel definition and the definition of the SCL signal
for I2C_DEV(0).

This is possible because GPIOs are only used for a specific peripheral
interface when either

- the corresponding peripheral module is used, e.g. `periph_i2c`, or
- the corresponding init function is called, e.g. `adc_init`.

That is, the purpose for which a GPIO is used depends on which module
or function is used first.

For example, if module `periph_i2c` is not used, the GPIOs listed in I2C
configuration can be used for the other purposes, that is, GPIO9 can be
used as ADC channel.

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_application_specific_configurations
"application-specific configurations".

<center>
Function | GPIOs | Remarks | Configuration
:---------------|:-------|:--------|:----------------------------------
BUTTON0 | GPIO0 | | |
ADC_LINE(n) | GPIO1 ... GPIO10 | | \ref esp32_adc_channels "ADC Channels"
DAC_LINE(n) | GPIO17, GPIO18 | | \ref esp32_dac_channels "DAC Channels"
I2C_DEV(0) SCL | GPIO9 | | \ref esp32_i2c_interfaces "I2C Interfaces"
I2C_DEV(0) SDA | GPIO8 | | \ref esp32_i2c_interfaces "I2C Interfaces"
PWM_DEV(0) | GPIO11, GPIO12, GPIO13, GPIO14 | - | \ref esp32_pwm_channels "PWM Channels"
PWM_DEV(1) | GPIO15, GPIO16 | if module `esp_rtc_timer_32k` is not used | \ref esp32_pwm_channels "PWM Channels"
SPI_DEV(0) CLK | GPIO12 | SPI2_HOST (FSPI) is used | \ref esp32_spi_interfaces "SPI Interfaces"
SPI_DEV(0) MISO | GPIO13 | SPI2_HOST (FSPI) is used | \ref esp32_spi_interfaces "SPI Interfaces"
SPI_DEV(0) MOSI | GPIO11 | SPI2_HOST (FSPI) is used | \ref esp32_spi_interfaces "SPI Interfaces"
SPI_DEV(0) CS0 | GPIO10 | SPI2_HOST (FSPI) is used | \ref esp32_spi_interfaces "SPI Interfaces"
UART_DEV(0) TxD | GPIO43 | Console (configuration is fixed) | \ref esp32_uart_interfaces "UART interfaces"
UART_DEV(0) RxD | GPIO44 | Console (configuration is fixed) | \ref esp32_uart_interfaces "UART interfaces"
</center>
\n

For detailed information about the peripheral configurations of ESP32-S2
boards, see section \ref esp32_peripherals "Common Peripherals".

[Back to table of contents](#esp32s2_devkit_toc)

### Board Pinout {#esp32s2_devkit_pinout}

The following figures show the pinouts as configured by default board
definition.

@image html https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/_images/esp32-s2-devkitm-1-v1-pin-layout.png "ESP32-S2-DevKitM-1x Pinout" width=900px
@image html https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/_images/esp32-s2-devkitc-1-v1-pinout.png "ESP32-S2-DevKitC-1x Pinout" width=900px
@image html https://docs.espressif.com/projects/esp-idf/en/latest/esp32s2/_images/esp32-s2_saola1-pinout.jpg "ESP32-S2-Saola-1x Pinout" width=900px

The corresponding board schematics can be found:

- [ESP32-S2-DevKitM-1x](https://dl.espressif.com/dl/schematics/ESP32-S2-DevKitM-1_V1_Schematics.pdf)
- [ESP32-S2-DevKitC-1x](https://dl.espressif.com/dl/schematics/SCH_ESP32-S2-DEVKITC-1_V1_20210508.pdf)
- [ESP32-S2-Saola-1x](https://dl.espressif.com/dl/schematics/ESP32-S2-SAOLA-1_V1.1_schematics.pdf)

[Back to table of contents](#esp32s2_devkit_toc)

## Flashing the Device {#esp32s2_devkit_flashing}

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:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BOARD=esp32s2-devkit make flash ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
For detailed information about ESP32-S2 as well as configuring and compiling
RIOT for ESP32-S2 boards, see \ref esp32_riot.

[Back to table of contents](#esp32s2_devkit_toc)
*/
38 changes: 38 additions & 0 deletions boards/esp32s2-devkit/include/arduino_board.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright (C) 2022 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_esp32s2_devkit
* @{
*
* @file
* @brief Board specific configuration for the Arduino API
*
* @author Gunar Schorcht <gunar@schorcht.net>
*/

#ifndef ARDUINO_BOARD_H
#define ARDUINO_BOARD_H

#include "arduino_board_common.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
* @brief The on-board LED is not available
*/
#define ARDUINO_LED (0)

#ifdef __cplusplus
}
#endif

#endif /* ARDUINO_BOARD_H */
/** @} */
Loading

0 comments on commit 1862d4e

Please sign in to comment.