1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-16 10:03:50 +01:00

boards: add ESP32-H2-DekitM-1 board definition

This commit is contained in:
Gunar Schorcht 2025-03-27 08:58:14 +01:00
parent 4326d1b685
commit 90b863c24f
10 changed files with 619 additions and 0 deletions

View File

@ -0,0 +1,16 @@
# Copyright (c) 2025 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 "esp32h2-devkit" if BOARD_ESP32H2_DEVKIT
config BOARD_ESP32H2_DEVKIT
bool
default y
select BOARD_COMMON_ESP32H2
select CPU_MODEL_ESP32H2_MINI_1X_H4S
source "$(RIOTBOARD)/common/esp32h2/Kconfig"

View File

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

View File

@ -0,0 +1,5 @@
include $(RIOTBOARD)/common/esp32h2/Makefile.dep
ifneq (,$(filter saul_default,$(USEMODULE)))
USEMODULE += saul_gpio
endif

View File

@ -0,0 +1,20 @@
CPU_MODEL = esp32h2_mini_1x_h4s
# common board and CPU features
include $(RIOTBOARD)/common/esp32h2/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_analog
FEATURES_PROVIDED += arduino_i2c
FEATURES_PROVIDED += arduino_pins
FEATURES_PROVIDED += arduino_pwm
FEATURES_PROVIDED += arduino_spi
FEATURES_PROVIDED += arduino_uart

View File

@ -0,0 +1,5 @@
include $(RIOTBOARD)/common/esp32h2/Makefile.include
# Only consider TTYs matching the following filter when auto-selecting the TTY
# with `MOST_RECENT_PORT=1`.
TTY_BOARD_FILTER := --driver 'cp210x' --vendor 'Silicon Labs' --model 'CP2102N USB to UART Bridge Controller'

View File

@ -0,0 +1,153 @@
<!--
Copyright (C) 2025 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_esp32h2_devkit ESP32-H2-DevKitM-1 Board
@ingroup boards_esp32h2
@brief Support for generic ESP32-H2 boards
@author Gunar Schorcht <gunar@schorcht.net>
\section esp32h2_devkit ESP32-H2-DevKitM-1
## Table of Contents {#esp32h2_devkit_toc}
-# [Overview](#esp32h2_devkit_overview)
-# [Hardware](#esp32h2_devkit_hardware)
-# [MCU](#esp32h2_devkit_mcu)
-# [Board Configuration](#esp32h2_devkit_board_configuration)
-# [Board Pinout](#esp32h2_devkit_pinout)
-# [Flashing the Device](#esp32h2_devkit_flashing)
## Overview {#esp32h2_devkit_overview}
The Espressif ESP32-H2-DevKitM-1 board uses the ESP32-H2-MINI-1x module.
Since the number of GPIOs and their possible uses on the ESP32-H2 are quite
limited, the ESP32-H2-DevKitM-1 should also work for most other ESP32-H2 boards.
Any modifications required for specific applications could be overridden by
\ref esp32_application_specific_configurations "application-specific board configuration".
\image html "https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32h2/_images/esp32-h2-devkitm-1_v1.2_callouts.png" "Espressif ESP32-H2-DevKitM-1" width=800px
[Back to table of contents](#esp32h2_devkit_toc)
## Hardware {#esp32h2_devkit_hardware}
This section describes
- the [MCU](#esp32h2_devkit_mcu),
- the default [board configuration](#esp32h2_devkit_board_configuration),
- [optional hardware configurations](#esp32h2_devkit_optional_hardware),
- the [board pinout](#esp32h2_devkit_pinout).
[Back to table of contents](#esp32h2_devkit_toc)
### MCU {#esp32h2_devkit_mcu}
Most features of the board are provided by the ESP32-H2 SoC. For detailed
information about the ESP32-H2 variant (family) and ESP32x SoCs,
see section \ref esp32_mcu_esp32 "ESP32 SoC Series".
[Back to table of contents](#esp32h2_devkit_toc)
### Board Configuration {#esp32h2_devkit_board_configuration}
ESP32-H2-DevKitM-1 boards have no special hardware on board with the exception
of a WS2812-compatible RGB-LED.
All GPIOs are simply broken out for flexibility. Therefore, the board
configuration is the most flexible one which provides:
- 5 x ADC channels at maximum
- 1 x SPI
- 1 x I2C
- 1 x UART
- 2 x PWM with 3 channels each
- 1 x RGB-LED
Since all GPIOs are broken out, GPIOs can be used for different purposes
in different applications. For flexibility, GPIOs can be listed in multiple
peripheral configurations, but they can only be used for one peripheral
at a time. For example, GPIO1, GPIO3, GPIO4 and GPIO5 can be used as ADC
channels or as signals for SPI_DEV(0) and PWM_DEV(1).
This is possible because GPIOs are only used for a specific peripheral
interface when either
- the corresponding peripheral module is used, i.e. `periph_spi`, or
- the corresponding init function is called, i.e. `adc_init`, or
- the corresponding init function is called, i.e. `pwm_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_spi` is not used, the GPIOs listed in SPI
configuration can be used for the other purposes, that is, GPIO1, GPIO4 and
GPIO5 can be used as ADC channels or PWM channels.
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 | GPIO9 | | |
ADC | GPIO1, GPIO2, GPIO3, GPIO4, GPIO5 | | see \ref esp32_adc_channels "ADC Channels"
PWM_DEV(0) | GPIO2, GPIO12, GPIO22 | - | \ref esp32_pwm_channels "PWM Channels"
PWM_DEV(1) | GPIO1, GPIO3, GPIO5 | - | \ref esp32_pwm_channels "PWM Channels"
I2C_DEV(0):SCL | GPIO10 | | \ref esp32_i2c_interfaces "I2C Interfaces"
I2C_DEV(0):SDA | GPIO11 | | \ref esp32_i2c_interfaces "I2C Interfaces"
RGB-LED | GPIO8 | supported by driver module `ws281x` | |
SPI_DEV(0):SCK | GPIO4 | SPI2_HOST (FSPI) is used | \ref esp32_spi_interfaces "SPI Interfaces"
SPI_DEV(0):MISO | GPIO5 | SPI2_HOST (FSPI) is used | \ref esp32_spi_interfaces "SPI Interfaces"
SPI_DEV(0):MOSI | GPIO0 | SPI2_HOST (FSPI) is used | \ref esp32_spi_interfaces "SPI Interfaces"
SPI_DEV(0):CS0 | GPIO1 | SPI2_HOST (FSPI) is used | \ref esp32_spi_interfaces "SPI Interfaces"
UART_DEV(0):TxD | GPIO24 | Console (configuration is fixed) | \ref esp32_uart_interfaces "UART interfaces"
UART_DEV(0):RxD | GPIO23 | Console (configuration is fixed) | \ref esp32_uart_interfaces "UART interfaces"
USB D- | GPIO26 | | |
USB D+ | GPIO26 | | |
</center>
\n
@note
- The configuration of ADC channels contains all ESP32-H2 GPIOs that could
be used as ADC channels.
- GPIO6 and GPIO7 are not broken out for any reason.
- GPPIO15 to GPIO21 are used for the in-package flash and are not broken out.
For detailed information about the peripheral configurations of ESP32-H2
boards, see section \ref esp32_peripherals "Common Peripherals".
[Back to table of contents](#esp32h2_devkit_toc)
### Board Pinout {#esp32h2_devkit_pinout}
The following figures show the pinout as configured by default board
definition.
@image html https://docs.espressif.com/projects/esp-dev-kits/en/latest/esp32h2/_images/esp32-h2-devkitm-1-v1.2_pinlayout.png "EPS32-H2-DevKitM-1 Pinout"
The corresponding board schematics can be found:
- [ESP32-H2-DevKitM-1 v1.2](https://dl.espressif.com/dl/schematics/esp32-h2-devkitm-1_v1.2_schematics.pdf)
- [ESP32-H2-DevKitM-1 v1.3](https://dl.espressif.com/dl/schematics/esp32-h2-devkitm-1_v1.3_schematics.pdf)
[Back to table of contents](#esp32h2_devkit_toc)
## Flashing the Device {#esp32h2_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:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make flash BOARD=esp32h2-devkit ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
For detailed information about ESP32-H2 as well as configuring and compiling
RIOT for ESP32-H2 boards, see \ref esp32_riot.
[Back to table of contents](#esp32h2_devkit_toc)

View File

@ -0,0 +1,112 @@
/*
* Copyright (C) 2025 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.
*/
#pragma once
/**
* @ingroup boards_esp32h2_devkit
* @{
*
* @file
* @brief Mapping from MCU pins to Arduino pins
*
* @author Gunar Schorcht <gunar@schorcht.net>
*/
#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 GPIO23 /**< Arduino pin 0 (RxD) */
#define ARDUINO_PIN_1 GPIO24 /**< Arduino pin 1 (TxD) */
#define ARDUINO_PIN_2 GPIO25 /**< Arduino pin 2 */
#define ARDUINO_PIN_3 GPIO2 /**< Arduino pin 3 (PWM) */
#if !defined(MODULE_ESP_RTC_TIMER_32K)
# define ARDUINO_PIN_4 GPIO13 /**< Arduino pin 4 */
#endif
#define ARDUINO_PIN_5 GPIO12 /**< Arduino pin 5 (PWM) */
#define ARDUINO_PIN_6 GPIO22 /**< Arduino pin 6 (PWM) */
#define ARDUINO_PIN_7 GPIO9 /**< Arduino pin 7 (BTN0 input) */
#define ARDUINO_PIN_8 GPIO8 /**< Arduino pin 8 (RGB output) */
#define ARDUINO_PIN_9 GPIO3 /**< Arduino pin 9 (PWM) */
#define ARDUINO_PIN_10 GPIO1 /**< Arduino pin 10 (CS0 / PWM) */
#define ARDUINO_PIN_11 GPIO5 /**< Arduino pin 11 (MOSI / PWM) */
#define ARDUINO_PIN_12 GPIO0 /**< Arduino pin 12 (MISO) */
#define ARDUINO_PIN_13 GPIO4 /**< Arduino pin 13 (SCK) */
/* analog pins as digital pins: */
#define ARDUINO_PIN_14 GPIO1 /**< Arduino pin A0 */
#define ARDUINO_PIN_15 GPIO2 /**< Arduino pin A1 */
#define ARDUINO_PIN_16 GPIO3 /**< Arduino pin A2 */
#define ARDUINO_PIN_17 GPIO4 /**< Arduino pin A3 */
/* I2C digital pins: */
#define ARDUINO_PIN_18 GPIO11 /**< Arduino SDA */
#define ARDUINO_PIN_19 GPIO10 /**< Arduino SCL */
#define ARDUINO_PIN_LAST 19 /**< Last Arduino pin */
/** @} */
/**
* @name Aliases for analog pins
* @{
*/
#define ARDUINO_PIN_A0 ARDUINO_PIN_14 /**< Arduino pin A0 */
#define ARDUINO_PIN_A1 ARDUINO_PIN_15 /**< Arduino pin A1 */
#define ARDUINO_PIN_A2 ARDUINO_PIN_16 /**< Arduino pin A2 */
#define ARDUINO_PIN_A3 ARDUINO_PIN_17 /**< Arduino pin A3 */
#define ARDUINO_ANALOG_PIN_LAST 3 /**< Last analogue Arduino pin */
/** @} */
/**
* @name Mapping of Arduino analog pins to RIOT ADC lines
* @{
*/
#define ARDUINO_A0 ADC_LINE(0) /**< ADC line for Arduino pin A0 */
#define ARDUINO_A1 ADC_LINE(1) /**< ADC line for Arduino pin A1 */
#define ARDUINO_A2 ADC_LINE(2) /**< ADC line for Arduino pin A2 */
#define ARDUINO_A3 ADC_LINE(3) /**< ADC line for Arduino pin A3 */
/** @} */
/**
* @name Mapping of Arduino pins to RIOT PWM dev and channel pairs
* @{
*/
#define ARDUINO_PIN_3_PWM_DEV PWM_DEV(0) /**< PWM device for Arduino pin3 */
#define ARDUINO_PIN_3_PWM_CHAN 0 /**< PWM channel for Arduino pin3 */
#define ARDUINO_PIN_5_PWM_DEV PWM_DEV(0) /**< PWM device for Arduino pin5 */
#define ARDUINO_PIN_5_PWM_CHAN 1 /**< PWM channel for Arduino pin5 */
#define ARDUINO_PIN_6_PWM_DEV PWM_DEV(0) /**< PWM device for Arduino pin6 */
#define ARDUINO_PIN_6_PWM_CHAN 2 /**< PWM channel for Arduino pin6 */
#define ARDUINO_PIN_9_PWM_DEV PWM_DEV(1) /**< PWM device for Arduino pin9 */
#define ARDUINO_PIN_9_PWM_CHAN 1 /**< PWM channel for Arduino pin9 */
#define ARDUINO_PIN_10_PWM_DEV PWM_DEV(1) /**< PWM device for Arduino pin10 */
#define ARDUINO_PIN_10_PWM_CHAN 0 /**< PWM channel for Arduino pin10 */
#define ARDUINO_PIN_11_PWM_DEV PWM_DEV(1) /**< PWM device for Arduino pin11 */
#define ARDUINO_PIN_11_PWM_CHAN 2 /**< PWM channel for Arduino pin11 */
/** @} */
#ifdef __cplusplus
}
#endif
/** @} */

View File

@ -0,0 +1,94 @@
/*
* Copyright (C) 2025 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.
*/
#pragma once
/**
* @ingroup boards_esp32h2_devkit
* @brief Board definitions for ESP32-H2-DevKitM-1 boards
* @{
*
* The board definitions in this file are valid for the Espressif
* ESP32-H2-DevKitM-1 board the ESP32-H2-MINI-1x module.
*
* Since the number of GPIOs and their possible uses on the ESP32-H2 are quite
* limited, these board definitions can also be used for most other
* ESP32-H2 boards. Any modifications required for specific applications
* can be overridden by \ref esp32_application_specific_configurations
* "application-specific board configuration".
*
* @file
* @author Gunar Schorcht <gunar@schorcht.net>
*/
#include <stdint.h>
/**
* @name Button pin definitions
* @{
*/
/**
* @brief Default button GPIO pin definition
*
* ESP32-H2-DevKitM-1 boards have a BOOT button connected to GPIO9, which can be
* used as button during normal operation. Since the button connects GPIO9 pin
* to GND, the button signal is inverted, i.e., pressing the button will give a
* low signal.
*/
#define BTN0_PIN GPIO9
/**
* @brief Default button GPIO mode definition
*
* Since the GPIO of the button is not pulled up with an external resistor, the
* mode for the GPIO pin has to be GPIO_IN_PU.
*/
#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-H2-DevKitM-1 boards have a SK68XXMINI-HS smart RGB-LED connected to
* GPIO8 on-board. The WS281x driver module `ws281x` can be used to control it.
* @{
*/
#ifndef WS281X_PARAM_PIN
# define WS281X_PARAM_PIN (GPIO8) /**< GPIO pin connected to the data pin */
#endif
#ifndef WS281X_PARAM_NUMOF
# define WS281X_PARAM_NUMOF (1U) /**< Number of LEDs chained */
#endif
/** @} */
/* include common board definitions as last step */
#include "board_common.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
} /* end extern "C" */
#endif
/** @} */

View File

@ -0,0 +1,43 @@
/*
* Copyright (C) 2025 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.
*/
#pragma once
/**
* @ingroup boards_esp32h2_devkit
* @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[] =
{
{
.name = "BOOT",
.pin = BTN0_PIN,
.mode = BTN0_MODE,
.flags = SAUL_GPIO_INVERTED
},
};
#ifdef __cplusplus
}
#endif
/** @} */

View File

@ -0,0 +1,166 @@
/*
* Copyright (C) 2025 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.
*/
#pragma once
/**
* @ingroup boards_esp32h2_devkit
* @brief Peripheral configurations for ESP32-H2-DevKit boards
* @{
*
* The peripheral configurations in this file are valid for Espressif
* ESP32-H2-DevKitx boards that use the ESP32-H2-MINI-1x module.
*
* Since the number of GPIOs and their possible uses on the ESP32-H2 are quite
* limited, these peripheral configurations can also be used for most other
* ESP32-H2 boards. 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-H2
* 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 <gunar@schorcht.net>
*/
#include <stdint.h>
#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, all ADC pins that are broken out are declared 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
# define ADC_GPIOS { GPIO1, GPIO2, GPIO3, GPIO4, GPIO5 }
#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 GPIO10 /**< SCL signal of I2C_DEV(0) */
#endif
#ifndef I2C0_SDA
# define I2C0_SDA GPIO11 /**< SDA signal of I2C_DEV(0) */
#endif
/** @} */
/**
* @name PWM channel configuration
*
* For generic boards, two PWM devices are configured. Generally, all output
* pins could be used as PWM channels.
* @{
*/
/**
* @brief Declaration of the channels for device PWM_DEV(0), at maximum PWM_CHANNEL_NUM_DEV_MAX.
*
* @note PWM_DEV(0) contains only GPIOs that are not used for I2C, SPI
* or UART on this board. As long as the according PWM device is not
* initialized with the `pwm_init` function, the GPIOs declared for
* this device can be used for the other purposes.
*/
#ifndef PWM0_GPIOS
# define PWM0_GPIOS { GPIO2, GPIO12, GPIO22 }
#endif
/**
* @brief Declaration of the channels for device PWM_DEV(1), at maximum PWM_CHANNEL_NUM_DEV_MAX.
*
* @note PMW_DEV(1) contains pins that are also used by SPI_DEV(0) or as ADC
* channel. However, as long as the according PWM device is not
* initialized with the `pwm_init` function, the GPIOs declared for
* this device can be used for the other purposes.
*/
#ifndef PWM1_GPIOS
# define PWM1_GPIOS { GPIO1, GPIO3, GPIO5 }
#endif
/** @} */
/**
* @name SPI configuration
*
* @note The GPIOs listed in the configuration are only 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 GPIO4 /**< FSPI SCK (pin FSPICLK) */
#endif
#ifndef SPI0_MISO
# define SPI0_MISO GPIO5 /**< FSPI MISO (pin FSPIQ) */
#endif
#ifndef SPI0_MOSI
# define SPI0_MOSI GPIO0 /**< FSPI MOSI (pin FSPID) */
#endif
#ifndef SPI0_CS0
# define SPI0_CS0 GPIO1 /**< FSPI CS0 (pin FSPICS0) */
#endif
/** @} */
/**
* @name UART configuration
*
* ESP32-H2 provides 2 UART interfaces:
*
* UART_DEV(0) uses fixed standard configuration.<br>
* UART_DEV(1) is not used.<br>
*
* @{
*/
#define UART0_TXD GPIO24 /**< direct I/O pin for UART_DEV(0) TxD, can't be changed */
#define UART0_RXD GPIO23 /**< 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"
/** @} */