Loading...
Searching...
No Matches
periph_conf.h File Reference

Peripheral configurations for the Adafruit Metro ESP32-S2 board. More...

Detailed Description

Peripheral configurations for the Adafruit Metro ESP32-S2 board.

The peripheral configurations in this file can be used for the Adafruit Metro ESP32-S2 board.

Author
Gunar Schorcht gunar.nosp@m.@sch.nosp@m.orcht.nosp@m..net

Definition in file periph_conf.h.

#include <stdint.h>
#include "periph_conf_common.h"
+ Include dependency graph for periph_conf.h:

Go to the source code of this file.

ADC and DAC channel configuration

#define ADC_GPIOS   { GPIO17, GPIO18, GPIO1, GPIO2, GPIO3, GPIO4 }
 Declaration of GPIOs that can be used as ADC channels.
 
#define DAC_GPIOS   { GPIO17, GPIO18 }
 Declaration of GPIOs that can be used as DAC channels.
 

I2C configuration

Only I2C interface I2C_DEV(0) is used.

It is connected to the SDA/SCL pins of the Arduino header and to the STEMMA QT connector.

Note
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.
#define I2C0_SPEED   I2C_SPEED_FAST
 I2C bus speed of I2C_DEV(0)
 
#define I2C0_SCL   GPIO34
 SCL signal of I2C_DEV(0)
 
#define I2C0_SDA   GPIO33
 SDA signal of I2C_DEV(0)
 

PWM channel configuration

The PWM channels are mapped to the Arduino UNO PWM pins D3, D5, D6, D9, D10 and D11.

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.
#define PWM0_GPIOS   { GPIO8, GPIO10, GPIO11, GPIO14 }
 Declaration of the channels for device PWM_DEV(0), at maximum PWM_CHANNEL_NUM_DEV_MAX.
 
#define PWM1_GPIOS   { GPIO15, GPIO16 }
 Declaration of the channels for device PWM_DEV(1), at maximum PWM_CHANNEL_NUM_DEV_MAX.
 

SPI configuration

SPI_DEV(0) uses the FSPI controller and is connected to the SPI (ICSP) header.

SPI_DEV(1) uses the HSPI controller and is connected to the Arduino pins D11 (MOSI), D12 (MISO) and D13 (SCK). Both use the Arduino pin D10 as default CS signal.

Note
SCK of SPI_DEV(1) is connected to the same pin (GPIO42) as the red on-board LED.
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.
#define SPI0_CTRL   FSPI
 FSPI is used as SPI_DEV(0)
 
#define SPI0_SCK   GPIO36
 FSPI SCK (pin FSPICLK)
 
#define SPI0_MISO   GPIO37
 FSPI MISO (pin FSPIQ)
 
#define SPI0_MOSI   GPIO35
 FSPI MOSI (pin FSPID)
 
#define SPI0_CS0   GPIO15
 FSPI CS0 (Arduino pin D10)
 
#define SPI1_CTRL   HSPI
 HSPI (SPI Controller 3) is used as SPI_DEV(1)
 
#define SPI1_SCK   GPIO42
 HSPI SCK (Arduino pin D13)
 
#define SPI1_MISO   GPIO21
 HSPI MISO (Arduino pin D12)
 
#define SPI1_MOSI   GPIO16
 HSPI MOSI (Arduino pin D11)
 
#define SPI1_CS0   GPIO15
 HSPI CS0 (Arduino pin D10)
 

UART configuration

ESP32-S2 provides 2 UART interfaces at maximum:

UART_DEV(0) uses the DEBUG TX/RX pins GPIO43 and GPIO44 (default configuration from periph_conf_common_esp32s2.h).
UART_DEV(1) uses the Arduino pins D0 (RX, GPIO5) and D1 (TX, GPIO6).

Note
The stdio is provided via the USB interface of the ESP32-S2 by default (module stdio_cdc_acm).
#define UART1_TXD   GPIO6
 direct I/O pin for UART_DEV(1) TxD
 
#define UART1_RXD   GPIO5
 direct I/O pin for UART_DEV(1) RxD
 

Macro Definition Documentation

◆ ADC_GPIOS

#define ADC_GPIOS   { GPIO17, GPIO18, GPIO1, GPIO2, GPIO3, GPIO4 }

Declaration of GPIOs that can be used as ADC channels.

The analog pins A0 ... A5 are mapped to ADC_LINE(0) ... ADC_LINE(5).

Note
A0 (GPIO17) and A1 (GPIO18) are ADC2 channels which cannot be used while WiFi is active.
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.

Definition at line 43 of file periph_conf.h.

◆ DAC_GPIOS

#define DAC_GPIOS   { GPIO17, GPIO18 }

Declaration of GPIOs that can be used as DAC channels.

DAC_LINE(0) and DAC_LINE(1) are available at the analog pins A0 and A1.

Note
As long as the GPIOs listed in DAC_GPIOS are not initialized as DAC channels with the dac_init function, they can be used for other purposes.

Definition at line 56 of file periph_conf.h.

◆ I2C0_SCL

#define I2C0_SCL   GPIO34

SCL signal of I2C_DEV(0)

Definition at line 76 of file periph_conf.h.

◆ I2C0_SDA

#define I2C0_SDA   GPIO33

SDA signal of I2C_DEV(0)

Definition at line 79 of file periph_conf.h.

◆ I2C0_SPEED

#define I2C0_SPEED   I2C_SPEED_FAST

I2C bus speed of I2C_DEV(0)

Definition at line 73 of file periph_conf.h.

◆ PWM0_GPIOS

#define PWM0_GPIOS   { GPIO8, GPIO10, GPIO11, GPIO14 }

Declaration of the channels for device PWM_DEV(0), at maximum PWM_CHANNEL_NUM_DEV_MAX.

Definition at line 101 of file periph_conf.h.

◆ PWM1_GPIOS

#define PWM1_GPIOS   { GPIO15, GPIO16 }

Declaration of the channels for device PWM_DEV(1), at maximum PWM_CHANNEL_NUM_DEV_MAX.

Definition at line 109 of file periph_conf.h.

◆ SPI0_CS0

#define SPI0_CS0   GPIO15

FSPI CS0 (Arduino pin D10)

Definition at line 144 of file periph_conf.h.

◆ SPI0_CTRL

#define SPI0_CTRL   FSPI

FSPI is used as SPI_DEV(0)

Definition at line 132 of file periph_conf.h.

◆ SPI0_MISO

#define SPI0_MISO   GPIO37

FSPI MISO (pin FSPIQ)

Definition at line 138 of file periph_conf.h.

◆ SPI0_MOSI

#define SPI0_MOSI   GPIO35

FSPI MOSI (pin FSPID)

Definition at line 141 of file periph_conf.h.

◆ SPI0_SCK

#define SPI0_SCK   GPIO36

FSPI SCK (pin FSPICLK)

Definition at line 135 of file periph_conf.h.

◆ SPI1_CS0

#define SPI1_CS0   GPIO15

HSPI CS0 (Arduino pin D10)

Definition at line 160 of file periph_conf.h.

◆ SPI1_CTRL

#define SPI1_CTRL   HSPI

HSPI (SPI Controller 3) is used as SPI_DEV(1)

Definition at line 148 of file periph_conf.h.

◆ SPI1_MISO

#define SPI1_MISO   GPIO21

HSPI MISO (Arduino pin D12)

Definition at line 154 of file periph_conf.h.

◆ SPI1_MOSI

#define SPI1_MOSI   GPIO16

HSPI MOSI (Arduino pin D11)

Definition at line 157 of file periph_conf.h.

◆ SPI1_SCK

#define SPI1_SCK   GPIO42

HSPI SCK (Arduino pin D13)

Definition at line 151 of file periph_conf.h.

◆ UART1_RXD

#define UART1_RXD   GPIO5

direct I/O pin for UART_DEV(1) RxD

Definition at line 182 of file periph_conf.h.

◆ UART1_TXD

#define UART1_TXD   GPIO6

direct I/O pin for UART_DEV(1) TxD

Definition at line 179 of file periph_conf.h.