diff --git a/.murdock b/.murdock index a338e1e10c..0a5af072b8 100755 --- a/.murdock +++ b/.murdock @@ -37,6 +37,7 @@ esp32-heltec-lora32-v2 esp32-olimex-evb esp32c3-ci esp32c3-devkit +esp32s3-devkit esp8266-ci esp8266-esp-12x hamilton diff --git a/boards/esp32s3-devkit/Kconfig b/boards/esp32s3-devkit/Kconfig new file mode 100644 index 0000000000..ca4e601b83 --- /dev/null +++ b/boards/esp32s3-devkit/Kconfig @@ -0,0 +1,73 @@ +# 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 "esp32s3-devkit" if BOARD_ESP32S3_DEVKIT + +config BOARD_VERSION + string + default "esp32s3-devkitc-1-n8" if BOARD_VERSION_ESP32S3_DEVKITC_1_N8 + default "esp32s3-devkitc-1-n8r2" if BOARD_VERSION_ESP32S3_DEVKITC_1_N8R2 + default "esp32s3-devkitc-1-n8r8" if BOARD_VERSION_ESP32S3_DEVKITC_1_N8R8 + default "esp32s3-devkitc-1-n16r8v" if BOARD_VERSION_ESP32S3_DEVKITC_1_N16R8V + default "esp32s3-devkitc-1-n32r8v" if BOARD_VERSION_ESP32S3_DEVKITC_1_N32R8V + default "esp32s3-devkitc-1u-n8" if BOARD_VERSION_ESP32S3_DEVKITC_1U_N8 + default "esp32s3-devkitc-1u-n8r2" if BOARD_VERSION_ESP32S3_DEVKITC_1U_N8R2 + default "esp32s3-devkitc-1u-n8r8" if BOARD_VERSION_ESP32S3_DEVKITC_1U_N8R8 + default "esp32s3-devkitm-1-n8" if BOARD_VERSION_ESP32S3_DEVKITM_1_N8 + default "esp32s3-devkitm-1u-n8" if BOARD_VERSION_ESP32S3_DEVKITM_1U_N8 + help + Set variable BOARD_VERSION for the make system. + +config BOARD_ESP32S3_DEVKIT + bool + default y + select BOARD_COMMON_ESP32S3 + select CPU_MODEL_ESP32S3_WROOM_1X_N8 if BOARD_VERSION_ESP32S3_DEVKITC_1_N8 + select CPU_MODEL_ESP32S3_WROOM_1X_N8R2 if BOARD_VERSION_ESP32S3_DEVKITC_1_N8R2 + select CPU_MODEL_ESP32S3_WROOM_1X_N8R8 if BOARD_VERSION_ESP32S3_DEVKITC_1_N8R8 + select CPU_MODEL_ESP32S3_WROOM_1X_N16R8V if BOARD_VERSION_ESP32S3_DEVKITC_1_N16R8V + select CPU_MODEL_ESP32S3_WROOM_1X_N32R8V if BOARD_VERSION_ESP32S3_DEVKITC_1_N32R8V + select CPU_MODEL_ESP32S3_WROOM_1X_N8 if BOARD_VERSION_ESP32S3_DEVKITC_1U_N8 + select CPU_MODEL_ESP32S3_WROOM_1X_N8R2 if BOARD_VERSION_ESP32S3_DEVKITC_1U_N8R2 + select CPU_MODEL_ESP32S3_WROOM_1X_N8R8 if BOARD_VERSION_ESP32S3_DEVKITC_1U_N8R8 + select CPU_MODEL_ESP32S3_MINI_1X_N8 if BOARD_VERSION_ESP32S3_DEVKITM_1_N8 + select CPU_MODEL_ESP32S3_MINI_1X_N8 if BOARD_VERSION_ESP32S3_DEVKITM_1U_N8 + select HAS_ARDUINO + select HAS_ESP_JTAG + select HAS_PERIPH_ADC + select HAS_PERIPH_I2C + select HAS_PERIPH_PWM + select HAS_PERIPH_SPI + + choice + bool "ESP32-S3-DevKit board version" + default BOARD_VERSION_ESP32S3_DEVKITC_1_N8 + + config BOARD_VERSION_ESP32S3_DEVKITC_1_N8 + bool "ESP32-S3-DevKitC-1-N8" + config BOARD_VERSION_ESP32S3_DEVKITC_1_N8R2 + bool "ESP32-S3-DevKitC-1-N8R2" + config BOARD_VERSION_ESP32S3_DEVKITC_1_N8R8 + bool "ESP32-S3-DevKitC-1-N8R8" + config BOARD_VERSION_ESP32S3_DEVKITC_1_N16R8V + bool "ESP32-S3-DevKitC-1-N16R8V" + config BOARD_VERSION_ESP32S3_DEVKITC_1_N32R8V + bool "ESP32-S3-DevKitC-1-N32R8V" + config BOARD_VERSION_ESP32S3_DEVKITC_1U_N8 + bool "ESP32-S3-DevKitC-1U-N8" + config BOARD_VERSION_ESP32S3_DEVKITC_1U_N8R2 + bool "ESP32-S3-DevKitC-1U-N8R2" + config BOARD_VERSION_ESP32S3_DEVKITC_1U_N8R8 + bool "ESP32-S3-DevKitC-1U-N8R8" + config BOARD_VERSION_ESP32S3_DEVKITM_1_N8 + bool "ESP32-S3-DevKitM-1-N8" + config BOARD_VERSION_ESP32S3_DEVKITM_1U_N8 + bool "ESP32-S3-DevKitM-1U-N8" + endchoice + +source "$(RIOTBOARD)/common/esp32s3/Kconfig" diff --git a/boards/esp32s3-devkit/Makefile b/boards/esp32s3-devkit/Makefile new file mode 100644 index 0000000000..a8b9d8fbed --- /dev/null +++ b/boards/esp32s3-devkit/Makefile @@ -0,0 +1,5 @@ +MODULE = board + +DIRS = $(RIOTBOARD)/common/esp32s3 + +include $(RIOTBASE)/Makefile.base diff --git a/boards/esp32s3-devkit/Makefile.dep b/boards/esp32s3-devkit/Makefile.dep new file mode 100644 index 0000000000..9b2d10be59 --- /dev/null +++ b/boards/esp32s3-devkit/Makefile.dep @@ -0,0 +1 @@ +include $(RIOTBOARD)/common/esp32s3/Makefile.dep diff --git a/boards/esp32s3-devkit/Makefile.features b/boards/esp32s3-devkit/Makefile.features new file mode 100644 index 0000000000..36b3a6e20b --- /dev/null +++ b/boards/esp32s3-devkit/Makefile.features @@ -0,0 +1,42 @@ +# default board version if not defined +ifeq (,$(BOARD_VERSION)) + BOARD_VERSION = esp32s3-devkitc-1-n8 +endif + +ifeq (esp32s3-devkitc-1-n8,$(BOARD_VERSION)) + CPU_MODEL = esp32s3_wroom_1x_n8 +else ifeq (esp32s3-devkitc-1-n8r2,$(BOARD_VERSION)) + CPU_MODEL = esp32s3_wroom_1x_n8r2 +else ifeq (esp32s3-devkitc-1-n8r8,$(BOARD_VERSION)) + CPU_MODEL = esp32s3_wroom_1x_n8r8 +else ifeq (esp32s3-devkitc-1-n16r8v,$(BOARD_VERSION)) + CPU_MODEL = esp32s3_wroom_2_n16r8v +else ifeq (esp32s3-devkitc-1-n32r8v,$(BOARD_VERSION)) + CPU_MODEL = esp32s3_wroom_2_n32r8v +else ifeq (esp32s3-devkitc-1u-n8,$(BOARD_VERSION)) + CPU_MODEL = esp32s3_wroom_1x_n8 +else ifeq (esp32s3-devkitc-1u-n8r2,$(BOARD_VERSION)) + CPU_MODEL = esp32s3_wroom_1x_n8r2 +else ifeq (esp32s3-devkitc-1u-n8r8,$(BOARD_VERSION)) + CPU_MODEL = esp32s3_wroom_1x_n8r8 +else ifeq (esp32s3-devkitm-1-n8,$(BOARD_VERSION)) + CPU_MODEL = esp32s3_mini_1x_n8 +else ifeq (esp32s3-devkitm-1u-n8,$(BOARD_VERSION)) + CPU_MODEL = esp32s3_mini_1x_n8 +else + $(error BOARD_VERSION is unknown) +endif + +# common board and CPU features +include $(RIOTBOARD)/common/esp32s3/Makefile.features + +# additional features provided by the board +FEATURES_PROVIDED += periph_adc +FEATURES_PROVIDED += periph_i2c +FEATURES_PROVIDED += periph_pwm +FEATURES_PROVIDED += periph_spi + +# unique features provided by the board +FEATURES_PROVIDED += esp_jtag + +FEATURES_PROVIDED += arduino diff --git a/boards/esp32s3-devkit/Makefile.include b/boards/esp32s3-devkit/Makefile.include new file mode 100644 index 0000000000..c1027951e0 --- /dev/null +++ b/boards/esp32s3-devkit/Makefile.include @@ -0,0 +1,12 @@ +PSEUDOMODULES += esp32s3_devkitc_1_n8 +PSEUDOMODULES += esp32s3_devkitc_1_n8r2 +PSEUDOMODULES += esp32s3_devkitc_1_n8r8 +PSEUDOMODULES += esp32s3_devkitc_1_n16r8v +PSEUDOMODULES += esp32s3_devkitc_1_n32r8v +PSEUDOMODULES += esp32s3_devkitc_1u_n8 +PSEUDOMODULES += esp32s3_devkitc_1u_n8r2 +PSEUDOMODULES += esp32s3_devkitc_1u_n8r8 +PSEUDOMODULES += esp32s3_devkitm_1_n8r8 +PSEUDOMODULES += esp32s3_devkitm_1u_n8r8 + +include $(RIOTBOARD)/common/esp32s3/Makefile.include diff --git a/boards/esp32s3-devkit/doc.txt b/boards/esp32s3-devkit/doc.txt new file mode 100644 index 0000000000..b9628abcb8 --- /dev/null +++ b/boards/esp32s3-devkit/doc.txt @@ -0,0 +1,202 @@ +/* + * 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_esp32s3_devkit ESP32-S3-DevKit Board + * @ingroup boards_esp32s3 + * @brief Support for generic ESP32S3 boards + * @author Gunar Schorcht + +\section esp32s3_devkit ESP32-S3-DevKit + +## Table of Contents {#esp32s3_devkit_toc} + +1. [Overview](#esp32s3_devkit_overview) +2. [Hardware](#esp32s3_devkit_hardware) + 1. [MCU](#esp32s3_devkit_mcu) + 2. [Board Configuration](#esp32s3_devkit_board_configuration) + 3. [Board Pinout](#esp32s3_devkit_pinout) +3. [Flashing the Device](#esp32s3_devkit_flashing) + +## Overview {#esp32s3_devkit_overview} + +The Espressif ESP32-S3-DevKit boards are a couple of boards that use one of +the following modules: + +- ESP32-S3-MINI-1x module (ESP32-S3-DevKitM-1 board) +- ESP32-S3-WROOM-1x module (ESP32-S3-DevKitC-1 board) +- ESP32-S3-WROOM-2 module (ESP32-S3-DevKitC-1 board) + +\image html "https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/_images/ESP32-S3-DevKitC-1_v2-annotated-photo.png" "Espressif ESP32-S3-DevKitM-1" width=600px + +
+Due to the different modules used, the available versions of the +ESP32-S3-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=esp32s3-devkit BOARD_VERSION=esp32s3-devkitc-1-n8 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. + +
+| Board Version | Flash (Mode) | SPI RAM (Mode) | `BOARD_VERSION` +|:--------------------------|:--------------|:---------------|:------------------- +| ESP32-S3-DevKitC-1-N8 | 8 MB (Quad) | - | `esp32s3-devkitc-1-n8` (default) +| ESP32-S3-DevKitC-1-N8R2 | 8 MB (Quad) | 2 MB (Quad) | `esp32s3-devkitc-1-n8r2` +| ESP32-S3-DevKitC-1-N8R8 | 8 MB (Quad) | 8 MB (Octal) | `esp32s3-devkitc-1-n8r8` +| ESP32-S3-DevKitC-1-N16R8V | 16 MB (Octal) | 8 MB (Octal) | `esp32s3-devkitc-1-n16r8v` +| ESP32-S3-DevKitC-1-N32R8V | 32 MB (Octal) | 8 MB (Octal) | `esp32s3-devkitc-1-n32r8v` +| ESP32-S3-DevKitC-1U-N8 | 8 MB (Quad) | - | `esp32s3-devkitc-1u-n8` +| ESP32-S3-DevKitC-1U-N8R2 | 8 MB (Quad) | 2 MB (Quad) | `esp32s3-devkitc-1u-n8r2` +| ESP32-S3-DevKitC-1U-N8R8 | 8 MB (Quad) | 8 MB (Octal) | `esp32s3-devkitc-1u-n8r8` +| ESP32-S3-DevKitM-1-N8 | 8 MB (Quad) | - | `esp32s3-devkitm-1-n8` +| ESP32-S3-DevKitM-1U-N8 | 8 MB (Quad) | - | `esp32s3-devkitm-1u-n8` +
+
+ +@note +- If the board version is not specified, ESP32-S3-DevKitC-1-N8 with 8 MByte + Flash is assumed and `BOARD_VERSION` is set to `esp32s3-devkitc-1-n8` + by default. +- Using a board version with embedded SPI RAM (`BOARD_VERSION` is any of + `esp32s3-devkitx-1x-*r*` 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. +- Depending on the specified board version, one of the following modes is used + for the SPI RAM: + - **Quad SPI mode**: If `BOARD_VERSION` is one of the values + `esp32s3_devkitx-1x-*r2`, the Quad SPI mode is used. In this mode, + **GPIO26 ... GPIO32** are occupied and are not available for other purposes. + - **Octal SPI mode**: If `BOARD_VERSION` is one of the values + `esp32s3_devkitx-1x-*r8x`, the Octal-SPI mode is used and the + feature \ref esp32_spi_ram "esp_spi_oct" is additionally enabled. If + then the SPI RAM is activated by using the pseudomodule \ref esp32_spi_ram + "esp_spi_ram", **GPIO33 ... GPIO37** are occupied and are not available + for other purposes. Conflicts may then occur when using these GPIOs. + +[Back to table of contents](#esp32s3_devkit_toc) + +## Hardware {#esp32s3_devkit_hardware} + +This section describes + +- the [MCU](#esp32s3_devkit_mcu), +- the default [board configuration](#esp32s3_devkit_board_configuration), +- [optional hardware configurations](#esp32s3_devkit_optional_hardware), +- the [board pinout](#esp32s3_devkit_pinout). + +[Back to table of contents](#esp32s3_devkit_toc) + +### MCU {#esp32s3_devkit_mcu} + +Most features of the board are provided by the ESP32-S3 SoC. For detailed +information about the ESP32-S3 SoC variant (family) and ESP32x SoCs, +see section \ref esp32_mcu_esp32 "ESP32 SoC Series". + +[Back to table of contents](#esp32s3_devkit_toc) + +### Board Configuration {#esp32s3_devkit_board_configuration} + +ESP32-S3-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 not broken out: + +- ESP32-S3-DevKitC-1x: GPIO26..GPIO34 +- ESP32-S3-DevKitM-1x: GPIO27..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". + +
+Function | GPIOs | Remarks | Configuration +:---------------|:-------|:--------|:---------------------------------- +BUTTON0 | GPIO0 | | | +ADC_LINE(n) | GPIO1, GPIO2, GPIO4, GPIO5, GPIO6, GPIO7, GPIO8, GPIO9 | | \ref esp32_adc_channels "ADC Channels" +PWM_DEV(0) | GPIO14, GPIO17, GPIO18, GPIO21 | - | \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" +I2C_DEV(0) SCL | GPIO9 | | \ref esp32_i2c_interfaces "I2C Interfaces" +I2C_DEV(0) SDA | GPIO8 | | \ref esp32_i2c_interfaces "I2C Interfaces" +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" +
+\n + +For detailed information about the peripheral configurations of ESP32-S3 +boards, see section \ref esp32_peripherals "Common Peripherals". + +[Back to table of contents](#esp32s3_devkit_toc) + +### Board Pinout {#esp32s3_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/esp32s3/_images/ESP32-S3_DevKitC-1_pinlayout.jpg "ESP32-S3-DevKitC-1 Pinout" width=900px +@image html https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/_images/ESP32-S3_DevKitM-1_pinlayout.jpg "ESP32-S3-DevKitM-1 Pinout" width=900px + +The corresponding board schematics can be found: + +- [ESP32-S3-DevKitC-1](https://dl.espressif.com/dl/SCH_ESP32-S3-DEVKITC-1_V1_20210312C.pdf) +- [ESP32-S3-DevKitM-1](https://dl.espressif.com/dl/schematics/SCH_ESP32-S3-DEVKITM-1_V1_20210310A.pdf) + +[Back to table of contents](#esp32s3_devkit_toc) + +## Flashing the Device {#esp32s3_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=esp32s3-devkit make flash ... +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +For detailed information about ESP32-S3 as well as configuring and compiling +RIOT for ESP32-S3 boards, see \ref esp32_riot. + +[Back to table of contents](#esp32s3_devkit_toc) + */ diff --git a/boards/esp32s3-devkit/include/arduino_board.h b/boards/esp32s3-devkit/include/arduino_board.h new file mode 100644 index 0000000000..c666ee85d2 --- /dev/null +++ b/boards/esp32s3-devkit/include/arduino_board.h @@ -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_esp32s3_devkit + * @{ + * + * @file + * @brief Board specific configuration for the Arduino API + * + * @author Gunar Schorcht + */ + +#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 */ +/** @} */ diff --git a/boards/esp32s3-devkit/include/arduino_pinmap.h b/boards/esp32s3-devkit/include/arduino_pinmap.h new file mode 100644 index 0000000000..45fdd9f28f --- /dev/null +++ b/boards/esp32s3-devkit/include/arduino_pinmap.h @@ -0,0 +1,63 @@ +/* + * 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_esp32s3_devkit + * @{ + * + * @file + * @brief Mapping from MCU pins to Arduino pins + * + * @author Gunar Schorcht + */ + +#ifndef ARDUINO_PINMAP_H +#define ARDUINO_PINMAP_H + +#include "periph/gpio.h" +#include "periph/adc.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @name Mapping of MCU pins to Arduino pins + * @{ + */ +#define ARDUINO_PIN_0 GPIO44 /**< Arduino Uno pin 0 (RxD) */ +#define ARDUINO_PIN_1 GPIO43 /**< Arduino Uno pin 1 (TxD) */ +#define ARDUINO_PIN_2 GPIO0 /**< Arduino Uno pin 2 */ +#define ARDUINO_PIN_3 GPIO14 /**< Arduino Uno pin 3 (PWM) */ +#define ARDUINO_PIN_4 GPIO3 /**< Arduino Uno pin 4 */ +#define ARDUINO_PIN_5 GPIO17 /**< Arduino Uno pin 5 (PWM) */ +#define ARDUINO_PIN_6 GPIO18 /**< Arduino Uno pin 6 (PWM) */ +#define ARDUINO_PIN_7 GPIO6 /**< Arduino Uno pin 7 */ +#define ARDUINO_PIN_8 GPIO7 /**< Arduino Uno pin 8 */ +#define ARDUINO_PIN_9 GPIO21 /**< Arduino Uno pin 9 (PWM) */ + +#define ARDUINO_PIN_10 GPIO10 /**< Arduino Uno pin 10 (CS0 / PWM) */ +#define ARDUINO_PIN_11 GPIO11 /**< Arduino Uno pin 11 (MOSI / PWM) */ +#define ARDUINO_PIN_12 GPIO13 /**< Arduino Uno pin 12 (MISO) */ +#define ARDUINO_PIN_13 GPIO12 /**< Arduino Uno pin 13 (SCK) */ + +#define ARDUINO_PIN_A0 GPIO1 /**< Arduino Uno pin A0 */ +#define ARDUINO_PIN_A1 GPIO2 /**< Arduino Uno pin A1 */ +#define ARDUINO_PIN_A2 GPIO4 /**< Arduino Uno pin A2 */ +#define ARDUINO_PIN_A3 GPIO5 /**< Arduino Uno pin A3 */ + +#define ARDUINO_PIN_A4 GPIO8 /**< Arduino Uno pin A4 (SDA) */ +#define ARDUINO_PIN_A5 GPIO9 /**< Arduino Uno pin A5 (SCL) */ +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* ARDUINO_PINMAP_H */ +/** @} */ diff --git a/boards/esp32s3-devkit/include/board.h b/boards/esp32s3-devkit/include/board.h new file mode 100644 index 0000000000..92220ffca1 --- /dev/null +++ b/boards/esp32s3-devkit/include/board.h @@ -0,0 +1,97 @@ +/* + * 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_esp32s3_devkit + * @brief Board definitions for ESP32-S3-DevKit boards + * @{ + * + * The board definitions in this file are valid for Espressif + * ESP32-S3-DevKitx boards that use one of the following modules: + * + * - ESP32-S3-MINI-1x module (ESP32-S3-DevKitM-1 board) + * - ESP32-S3-WROOM-1x module (ESP32-S3-DevKitC-1 board) + * - ESP32-S3-WROOM-2x module (ESP32-S3-DevKitC-1 board) + * + * where x stands for the module version with and without U + * (external antenna connector). + * + * Any modifications required for specific applications + * can be overridden by \ref esp32_application_specific_configurations + * "application-specific board configuration". + * + * @file + * @author Gunar Schorcht + */ + +#ifndef BOARD_H +#define BOARD_H + +#include + +/** + * @name Button pin definitions + * @{ + */ + +/** + * @brief Default button GPIO pin definition + * + * ESP32-S3-DevKit boards have a BOOT button connected to GPIO9, which can be + * used as button during normal operation. Since the GPIO9 pin is pulled up, + * the button signal is inverted, i.e., pressing the button will give a + * low signal. + */ +#define BTN0_PIN GPIO0 + +/** + * @brief Default button GPIO mode definition + * + * Since the GPIO of the button is pulled up with an external resistor, the + * mode for the GPIO pin has to be GPIO_IN. + */ +#define BTN0_MODE GPIO_IN_PU + +/** + * @brief Default interrupt flank definition for the button GPIO + */ +#ifndef BTN0_INT_FLANK +#define BTN0_INT_FLANK GPIO_FALLING +#endif + +/** + * @brief Definition for compatibility with previous versions + */ +#define BUTTON0_PIN BTN0_PIN + +/** @} */ + +/** + * @name LED (on-board) configuration + * + * ESP32-S3-DevKit boards have a SK68XXMINI-HS smart RGB-LED connected to + * GPIO48 on-board. This RGB-LEDs uses a special bit-oriented protocol to + * control the RGB-LED by 24-bit RGB values. Therefore, it can't be used as + * default LED definition for RIOT. + * @{ + */ +/** @} */ + +/* include common board definitions as last step */ +#include "board_common.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __cplusplus +} /* end extern "C" */ +#endif + +#endif /* BOARD_H */ +/** @} */ diff --git a/boards/esp32s3-devkit/include/gpio_params.h b/boards/esp32s3-devkit/include/gpio_params.h new file mode 100644 index 0000000000..32f7b49087 --- /dev/null +++ b/boards/esp32s3-devkit/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_esp32s3_devkit + * @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 and Button configuration + */ +static const saul_gpio_params_t saul_gpio_params[] = +{ + { + .name = "BOOT", + .pin = BTN0_PIN, + .mode = BTN0_MODE, + .flags = SAUL_GPIO_INVERTED + }, +}; + +#ifdef __cplusplus +} +#endif + +#endif /* GPIO_PARAMS_H */ +/** @} */ diff --git a/boards/esp32s3-devkit/include/periph_conf.h b/boards/esp32s3-devkit/include/periph_conf.h new file mode 100644 index 0000000000..c33064eebe --- /dev/null +++ b/boards/esp32s3-devkit/include/periph_conf.h @@ -0,0 +1,173 @@ +/* + * 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_esp32s3_devkit + * @brief Peripheral configurations for ESP32-S3-DevKit boards + * @{ + * + * The peripheral configurations in this file can be used for Espressif + * ESP32-S3-DevKitx boards that use one of the following modules: + * + * - ESP32-S3-WROOM-1x module (ESP32-S3-DevKitC-1 board) + * - ESP32-S3-WROOM-2x module (ESP32-S3-DevKitC-1 board) + * - ESP32-S3-MINI-1x module (ESP32-S3-DevKitM-1 board) + * + * Any modifications required for specific applications + * can be overridden by \ref esp32_application_specific_configurations + * "application-specific board configuration". + * + * For detailed information about the peripheral configuration for ESP32-S3 + * boards, see section \ref esp32_peripherals "Common Peripherals". + * + * @note + * Most definitions can be overridden by an \ref esp32_application_specific_configurations + * "application-specific board configuration" if necessary. + * + * @file + * @author Gunar Schorcht + */ + +#ifndef PERIPH_CONF_H +#define PERIPH_CONF_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @name ADC and DAC channel configuration + * @{ + */ +/** + * @brief Declaration of GPIOs that can be used as ADC channels + * + * For generic boards, almost all ADC pins of ADC1 that are broken out are + * declared as ADC channels, except GPIO3, which is a strapping pin. + * + * @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 +#define ADC_GPIOS { GPIO1, GPIO2, GPIO4, GPIO5, GPIO6, GPIO7, GPIO8, GPIO9 } +#endif +/** @} */ + +/** + * @name I2C configuration + * + * For generic boards, only one I2C interface I2C_DEV(0) is defined. + * + * The GPIOs listed in the configuration are only initialized as I2C signals + * when module `periph_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 +#ifndef I2C0_SCL +#define I2C0_SCL GPIO9 /**< SCL signal of I2C_DEV(0) */ +#endif +#ifndef I2C0_SDA +#define I2C0_SDA GPIO8 /**< SDA signal of I2C_DEV(0) */ +#endif +/** @} */ + +/** + * @name PWM channel configuration + * + * For generic boards, two PWM devices are configured. These devices + * contain all GPIOs that are not defined as I2C, SPI or UART for this board. + * Generally, all outputs pins could be used as PWM channels. + * + * @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. + * + * @{ + */ + +/** + * @brief Declaration of the channels for device PWM_DEV(0), + * at maximum PWM_CHANNEL_NUM_DEV_MAX. + */ +#ifndef PWM0_GPIOS +#define PWM0_GPIOS { GPIO14, GPIO17, GPIO18, GPIO21 } +#endif + +/** + * @brief Declaration of the channels for device PWM_DEV(1), + * at maximum PWM_CHANNEL_NUM_DEV_MAX. + * + * These PWM channels cannot be used if an external 32 kHz crystal is + * connected to the board at GPIO15 and GPIO16. + */ +#ifndef MODULE_ESP_RTC_TIMER_32K +#ifndef PWM1_GPIOS +#define PWM1_GPIOS { GPIO15, GPIO16 } +#endif +#endif + +/** @} */ + +/** + * @name SPI configuration + * + * @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_CTRL +#define SPI0_CTRL FSPI /**< FSPI is used as SPI_DEV(0) */ +#endif +#ifndef SPI0_SCK +#define SPI0_SCK GPIO12 /**< FSPI SCK (pin FSPICLK) */ +#endif +#ifndef SPI0_MISO +#define SPI0_MISO GPIO13 /**< FSPI MISO (pin FSPIQ) */ +#endif +#ifndef SPI0_MOSI +#define SPI0_MOSI GPIO11 /**< FSPI MOSI (pin FSPID) */ +#endif +#ifndef SPI0_CS0 +#define SPI0_CS0 GPIO10 /**< FSPI CS0 (pin FSPICS0) */ +#endif +/** @} */ + +/** + * @name UART configuration + * + * ESP32-S3 provides 3 UART interfaces at maximum: + * + * UART_DEV(0) uses fixed standard configuration.
+ * UART_DEV(1) is not used.
+ * + * @{ + */ +#define UART0_TXD GPIO43 /**< direct I/O pin for UART_DEV(0) TxD, can't be changed */ +#define UART0_RXD GPIO44 /**< direct I/O pin for UART_DEV(0) RxD, can't be changed */ + +/** @} */ + +#ifdef __cplusplus +} /* end extern "C" */ +#endif + +/* include common peripheral definitions as last step */ +#include "periph_conf_common.h" + +#endif /* PERIPH_CONF_H */ +/** @} */