Embedded MCU's ESP SoC

Introduction to ESP32

Introduction

The ESP32 family is a general-purpose, feature-rich, and versatile SoC solution that you can use in many different types of IoT projects where you require Wi-Fi connectivity. Let\’s have a quick look at the main features:

  • CPU and memory: 32-bit Xtensa® LX6 microprocessor with a clock frequency of up to 240 MHz/600 MIPS. Single- or dual-core variants. 448 KB ROM, 520 KB SRAM, and 16 KB RTC memory. Support for external SPI flash and SPI RAM for module variants. DMA for peripherals.
  • Connectivity: Wi-Fi 802.11 n (2.4 GHz) up to 150 Mbps and Bluetooth-compliant with Bluetooth v4.2 and BLE specifications.
  • Peripheral interfaces: GPIOs, ADC, DAC, SPI, I2C, I2S, UART, SD (chip variants), CAN, IR, PWM, touch sensor, and hall sensor.
  • Security: Cryptographic hardware acceleration (random number, hash, AES, RSA, and ECC), 1024-bit OTP, secure boot, and flash encryption.
  • Power modes: Different power modes with the help of an Ultra-Low-Power (ULP) co-processor and a Real-Time Clock (RTC). 100 μA power consumption in deep-sleep mode (ULP active).
\"\"
Figure 1: Block Diagram of ESP-32

ESP-32 Microcontroller Pinout

\"\"
Figure 2: Pinout of ESP-32 Microcontroller
Pin No.NameTypeFunction
1VDDAPowerAnalog power supply (2.3 V ∼ 3.6 V)
2LNA_INInput / OutputRF input and output
3VDD3P3PowerAnalog power supply (2.3 V ∼ 3.6 V)
4VDD3P3PowerAnalog power supply (2.3 V ∼ 3.6 V)
5SENSOR_VPInput

GPIO36,

ADC1_CH0,

RTC_GPIO0

6SENSOR_CAPPInput

GPIO37,

ADC1_CH1,

RTC_GPIO1

7SENSOR_CAPNInput

GPIO38,

ADC1_CH2,

RTC_GPIO2

8SENSOR_VNInput

GPIO39,

ADC1_CH3,

RTC_GPIO3

9CHIP_PUInput

High: On; enables the chip

Low: Off; the chip powers off

Note: Do not leave the CHIP_PU pin floating.

10VDET_1Input

GPIO34,

ADC1_CH6,

RTC_GPIO4

11VDET_2Input

GPIO35,

ADC1_CH7,

RTC_GPIO5

1232K_XPInput / Output

GPIO32,

ADC1_CH4,

RTC_GPIO9,

TOUCH9,

32K_XP (32.768 kHz crystal oscillator input)

1332K_XNInput / Output

GPIO33,

ADC1_CH5,

RTC_GPIO8,

TOUCH8,

32K_XN (32.768 kHz crystal oscillator output)

14GPIO25Input / Output

ADC2_CH8,

RTC_GPIO6,

DAC_1,

EMAC_RXD0

15GPIO26Input / Output

ADC2_CH9,

RTC_GPIO7,

DAC_2,

EMAC_RXD1

16GPIO27Input / Output

ADC2_CH7,

RTC_GPIO17,

TOUCH7,

EMAC_RX_DV

17MTMSInput / Output

GPIO14,

ADC2_CH6,

RTC_GPIO16,

TOUCH6,

EMAC_TXD2,

HSPICLK,

HS2_CLK,

SD_CLK,

18MTDIInput / Output

GPIO12,

ADC2_CH5,

RTC_GPIO15,

TOUCH5,

EMAC_TXD3,

HSPIQ,

HS2_DATA2,

SD_DATA2,

19VDD3P3_RTCPowerInput power supply for RTC IO (2.3 V ∼ 3.6 V)
20MTCKInput / Output

GPIO13,

ADC2_CH4,

RTC_GPIO14,

TOUCH4,

EMAC_RX_ER,

HSPID,

HS2_DATA3,

SD_DATA3,

21MTDOInput / Output

GPIO15,

ADC2_CH3,

RTC_GPIO13,

TOUCH3,

EMAC_RXD3,

HSPICS0,

HS2_CMD,

SD_CMD,

22GPIO2Input / Output

ADC2_CH2,

RTC_GPIO12,

TOUCH2,

HSPIWP,

HS2_DATA0,

SD_DATA0

23GPIO0Input / Output

ADC2_CH1,

RTC_GPIO11,

TOUCH1,

EMAC_TX_CLK,

CLK_OUT1

24GPIO4Input / Output

ADC2_CH0,

RTC_GPIO10,

TOUCH0,

EMAC_TX_ER,

HSPIHD,

HS2_DATA1,

SD_DATA1

25GPIO16Input / Output

HS1_DATA4,

U2RXD,

EMAC_CLK_OUT

26VDD_SDIOPowerOutput power supply: 1.8 V or the same voltage as VDD3P3_RTC
27GPIO17Input / Output

HS1_DATA5,

U2TXD,

EMAC_CLK_OUT_180

28SD_DATA_2Input / Output

GPIO9,

HS1_DATA2,

U1RXD,

SPIHD

29SD_DATA_3Input / Output

GPIO10,

HS1_DATA3,

U1TXD,

SPIWP

30SD_CMDInput / Output

GPIO11,

HS1_CMD,

U1RTS,

SPICS0

31SD_CLKInput / Output

GPIO6,

HS1_CLK,

U1CTS,

SPICLK

32SD_DATA_0Input / Output

GPIO7,

HS1_DATA0,

U2RTS,

SPIQ

33SD_DATA_1Input / Output

GPIO8,,

U2CTS,

HS1_DATA1,

SPID

34GPIO5Input / Output

HS1_DATA6,

VSPICS0,

EMAC_RX_CLK

35GPIO18Input / Output

HS1_DATA7,

VSPICLK

36GPIO23Input / Output

HS1_STROBE,

VSPID

37VDD3P3_CPUPowerInput power supply for CPU IO (1.8 V ∼ 3.6 V)
38GPIO19Input / Output

U0CTS,

VSPIQ,

EMAC_TXD0

39GPIO22Input / Output

U0RTS,

VSPIWP,

EMAC_TXD1

40U0RXDInput / Output

GPIO3,

CLK_OUT2

41U0TXDInput / Output

GPIO1,

CLK_OUT3,

EMAC_RXD2

42GPIO21Input / Output

VSPIHD,

EMAC_TX_EN

43VDDAPowerAnalog power supply (2.3 V ∼ 3.6 V)
44XTAL_NOutputExternal crystal output
45XTAL_PInputExternal crystal input
46VDDAPowerAnalog power supply (2.3 V ∼ 3.6 V)
47CAP2InputConnects to a 3.3 nF (10%) capacitor and 20 kΩ resistors in parallel to CAP1
48CAP1InputConnects to a 10 nF series capacitor to ground
49GNDPowerGround
\"\"
Figure 3: Schematic of ESP-32 Microcontroller

ESP-32 WROOM 32 Module

ESP32-WROOM-32 is a powerful, generic Wi-Fi+BT+BLE MCU module that targets a wide variety of applications, ranging from low-power sensor networks to the most demanding tasks, such as voice encoding, music streaming and MP3 decoding.

The chip embedded is designed to be scalable and adaptive. There are two CPU cores that can be individually controlled, and the CPU clock frequency is adjustable from 80 MHz to 240 MHz. The chip also has a low-power co-processor that can be used instead of the CPU to save power while performing tasks that do not require much computing power, such as monitoring of peripherals. ESP32 integrates a rich set of peripherals, ranging from capacitive touch sensors, Hall sensors, SD card interface, Ethernet, high-speed SPI, UART, I²S, and I²C.

\"\"
Figure 4: ESP-32 WROOM 32 Pinout
Pin No.NameTypeFunction
 GNDPowerGround
 3V3PowerPower supply
9ENInputModule-enable signal. Active high.
5SENSOR_VPInput

ADC1_CH0,

RTC_GPIO0

8SENSOR_VNInput

ADC1_CH3,

RTC_GPIO3

10GPIO34Input

ADC1_CH6,

RTC_GPIO4

11GPIO35Input

ADC1_CH7,

RTC_GPIO5

12GPIO32Input / Output

XTAL_32K_P (32.768 kHz crystal oscillator input),

ADC1_CH4,

TOUCH9,

RTC_GPIO9

13GPIO33Input / Output

XTAL_32K_N (32.768 kHz crystal oscillator output),

ADC1_CH5,

TOUCH8,

RTC_GPIO8

14GPIO25Input / Output

DAC_1,

ADC2_CH8,

RTC_GPIO6,

EMAC_RXD0

15GPIO26Input / Output

DAC_2,

ADC2_CH9,

RTC_GPIO7,

EMAC_RXD1

16GPIO27Input / Output

ADC2_CH7,

TOUCH7,

RTC_GPIO17,

EMAC_RX_DV

17GPIO14Input / Output

ADC2_CH6,

TOUCH6,

RTC_GPIO16,

MTMS,

HSPICLK,

HS2_CLK,

SD_CLK,

EMAC_TXD2

18GPIO12Input / Output

ADC2_CH5,

TOUCH5,

RTC_GPIO15,

MTDI,

HSPIQ,

HS2_DATA2,

SD_DATA2,

EMAC_TXD3

 GNDPowerGround
20GPIO13Input / Output

ADC2_CH4,

TOUCH4,

RTC_GPIO14,

MTCK,

HSPID,

HS2_DATA3,

SD_DATA3,

EMAC_RX_ER

28SHD/SD2Input / Output

GPIO9,

SD_DATA2,

SPIHD,

HS1_DATA2,

U1RXD

29SWP/SD3Input / Output

GPIO10,

SD_DATA3,

SPIWP,

HS1_DATA3,

U1TXD

30SCS/CMDInput / Output

GPIO11,

SD_CMD,

SPICS0,

HS1_CMD,

U1RTS

31SCK/CLKInput / Output

GPIO6,

SD_CLK,

SPICLK,

HS1_CLK,

U1CTS

32SDO/SD0Input / Output

GPIO7,

SD_DATA0,

SPIQ,

HS1_DATA0,

U2RTS

33SDI/SD1Input / Output

GPIO8,

SD_DATA1,

SPID,

HS1_DATA1,

U2CTS

21GPIO15Input / Output

ADC2_CH3,

TOUCH3,

MTDO,

HSPICS0,

RTC_GPIO13,

HS2_CMD,

SD_CMD,

EMAC_RXD3

22GPIO2Input / Output

ADC2_CH2,

TOUCH2,

RTC_GPIO12,

HSPIWP,

HS2_DATA0,

SD_DATA0

23GPIO0Input / Output

ADC2_CH1,

TOUCH1,

RTC_GPIO11,

CLK_OUT1,

EMAC_TX_CLK

24GPIO4Input / Output

ADC2_CH0,

TOUCH0,

RTC_GPIO10,

HSPIHD,

HS2_DATA1,

SD_DATA1,

EMAC_TX_ER

25GPIO16Input / Output

HS1_DATA4,

U2RXD,

EMAC_CLK_OUT

27GPIO17Input / Output

HS1_DATA5,

U2TXD,

EMAC_CLK_OUT_180

34GPIO5Input / Output

VSPICS0,

HS1_DATA6,

EMAC_RX_CLK

35GPIO18Input / Output

VSPICLK,

HS1_DATA7

38GPIO19Input / Output

VSPIQ,

U0CTS,

EMAC_TXD0

NC
42GPIO21Input / Output

VSPIHD,

EMAC_TX_EN

40RXD0Input / Output

GPIO3,

U0RXD,

CLK_OUT2

41TXD0Input / Output

GPIO1,

U0TXD,

CLK_OUT3,

EMAC_RXD2

39GPIO22Input / Output

VSPIWP,

U0RTS,

EMAC_TXD1

36GPIO23Input / Output

VSPID,

HS1_STROBE

 GNDPowerGround

ESP-32 WROOM 32 DEV-KIT

ESP32 Development board is based on the ESP WROOM32 WIFI + BLE Module. This is the latest generation of the ESP32 IoT development modules. This development board breaks out all ESP32 modules pins into a 0.1\” header and also provides a 3.3 Volt power regulator, Reset, and programming button.

\"\"
Figure 5: ESP-32 WROOM 32 DEV-KIT Pinout

Peripheral Configurations

InterfaceSignalPin NumberFunction

ADC

(Analog to Digital)

ADC1_CH0

ADC1_CH1

ADC1_CH2

ADC1_CH3

ADC1_CH4

ADC1_CH5

ADC1_CH6

ADC1_CH7

ADC2_CH0

ADC2_CH1

ADC2_CH2

ADC2_CH3

ADC2_CH4

ADC2_CH5

ADC2_CH6

ADC2_CH7

ADC2_CH8

ADC2_CH9

SENSOR_VP

SENSOR_CAPP

SENSOR_CAPN

SENSOR_VN

32K_XP

32K_XN

VDET_1

VDET_2

GPIO4

GPIO0

GPIO2

MTDO

MTCK

MTDI

MTMS

GPIO27

GPIO25

GPIO26

ESP32 integrates 12-bit SAR ADCs and supports measurements on 18 channels (analog-enabled pins).

DAC

(Digital to Analog)

DAC_1

DAC_2

GPIO25

GPIO26

Two 8-bit DAC channels can be used to convert two digital signals into two analog voltage signal outputs. The design structure is composed of integrated resistor strings and a buffer. This dual DAC supports the power supply as an input voltage reference. The two DAC channels can also support independent conversions.
Touch Sensor

TOUCH0

TOUCH1

TOUCH2

TOUCH3

TOUCH4

TOUCH5

TOUCH6

TOUCH7

TOUCH8

TOUCH9

GPIO4

GPIO0

GPIO2

MTDO

MTCK

MTDI

MTMS

GPIO27

32K_XN

32K_XP

ESP32 has 10 capacitive-sensing GPIOs, which detect variations induced by touching or approaching the GPIOs with a finger or other objects. The low-noise nature of the design and the high sensitivity of the circuit allows relatively small pads to be used. Arrays of pads can also be used so that a larger area or more points can be detected.
JTAG

MTDI

MTCK

MTMS

MTDO

MTDI

MTCK

MTMS

MTDO

JTAG for software debugging
SD/MMC Host Controller

HS2_CLK

HS2_CMD

HS2_DATA0

HS2_DATA1

HS2_DATA2

HS2_DATA3

HS2_CLK

HS2_CMD

HS2_DATA0

HS2_DATA1

HS2_DATA2

HS2_DATA3

An SD/SDIO/MMC host controller is available on ESP32, which supports the following features:

• Secure Digital memory (SD mem Version 3.0 and Version 3.01)

• Secure Digital I/O (SDIO Version 3.0)

• Consumer Electronics Advanced Transport Architecture (CE-ATA Version 1.1)

• Multimedia Cards (MMC Version 4.41, eMMC Version 4.5 and Version 4.51)

The controller allows up to 80 MHz clock output in three different data-bus modes: 1-bit, 4-bit, and 8-bit. It supports two SD/SDIO/MMC4.41 cards in a 4-bit data-bus mode. It also supports one SD card operating at 1.8V.

Motor PWM

PWM0_OUT0~2

PWM1_OUT_IN0~2

PWM0_FLT_IN0~2

PWM1_FLT_IN0~2

PWM0_CAP_IN0~2

PWM1_CAP_IN0~2

PWM0_SYNC_IN0~2

PWM1_SYNC_IN0~2

Any GPIO PinsThree channels of 16-bit timers generate PWM waveforms. Each channel has a pair of output signals, three fault detection signals, three event-capture signals, and three sync signals.
SDIO/SPI Slave Controller

SD_CLK

SD_CMD

SD_DATA0

SD_DATA1

SD_DATA2

SD_DATA3

MTMS

MTDO

GPIO2

GPIO4

MTDI

MTCK

ESP32 integrates a SD device interface that conforms to the industry-standard SDIO Card Specification Version 2.0 and allows a host controller to access the SoC, using the SDIO bus interface and protocol. ESP32 acts as

the slave on the SDIO bus.

UART

U0RXD_in

U0CTS_in

U0DSR_in

U0TXD_out

U0RTS_out

U0DTR_out

U1RXD_in

U1CTS_in

U1TXD_out

U1RTS_out

U2RXD_in

U2CTS_in

U2TXD_out

U2RTS_out

Any GPIO PinsESP32 has three UART interfaces, i.e., UART0, UART1, and UART2, which provide asynchronous communication (RS232 and RS485) and IrDA support, communicating at a speed of up to 5 Mbps.
I2C

I2CEXT0_SCL_in

I2CEXT0_SDA_in

I2CEXT1_SCL_in

I2CEXT1_SDA_in

I2CEXT0_SCL_out

I2CEXT0_SDA_out

I2CEXT1_SCL_out

I2CEXT1_SDA_out

Any GPIO Pins

ESP32 has two I2C bus interfaces which can serve as I2C master or slave, depending on the user’s

configuration. The I2C interfaces support:

• Standard mode (100 Kbit/s)

• Fast mode (400 Kbit/s)

• Up to 5 MHz, yet constrained by SDA pull-up strength

• 7-bit/10-bit addressing mode

• Dual addressing mode

Users can program command registers to control I2C interfaces so that they have more flexibility.

LED PWM

ledc_hs_sig_out0~7

ledc_ls_sig_out0~7

Any GPIO PinsThe LED PWM controller can generate 16 independent channels of digital waveforms with configurable periods and duties.
I2S

I2S0I_DATA_in0~15

I2S0O_BCK_in

I2S0O_WS_in

I2S0I_BCK_in

I2S0I_WS_in

I2S0I_H_SYNC

I2S0I_V_SYNC

I2S0I_H_ENABLE

I2S0O_BCK_out

I2S0O_WS_out

I2S0I_BCK_out

I2S0I_WS_out

I2S0O_DATA_out0~23

I2S1I_DATA_in0~15

I2S1O_BCK_in

I2S1O_WS_in

I2S1I_BCK_in

I2S1I_WS_in

I2S1I_H_SYNC

I2S1I_V_SYNC

I2S1I_H_ENABLE

I2S1O_BCK_out

I2S1O_WS_out

I2S1I_BCK_out

I2S1I_WS_out

I2S1O_DATA_out0~23

Any GPIO PinsTwo standard I2S interfaces are available in ESP32. They can be operated in master or slave mode, in full-duplex and half-duplex communication modes, and can be configured to operate with an 8-/16-/32-/48-/64-bit resolution as input or output channels. BCK clock frequency, from 10 kHz up to 40 MHz, is supported.

RMT

(Infrared remote Controller)

RMT_SIG_IN0~7

RMT_SIG_OUT0~7

Any GPIO PinsThe infrared remote controller supports eight channels of infrared remote transmission and receiving. By programming the pulse waveform, it supports various infrared protocols. Eight channels share a 512 x 32-bit block of memory to store the transmitting or receiving waveform.
General Purpose SPI

HSPIQ_in/_out

HSPID_in/_out

HSPICLK_in/_out

HSPI_CS0_in/_out

HSPI_CS1_out

HSPI_CS2_out

VSPIQ_in/_out

VSPID_in/_out

VSPICLK_in/_out

VSPI_CS0_in/_out

VSPI_CS1_out

VSPI_CS2_out

Any GPIO Pins

Standard SPI consists of clock,

chip-select, MOSI and MISO. These SPIs can be connected to LCD and other external devices. They support the following features:

• Both master and slave modes;

• Four sub-modes of the SPI transfer

format;

• Configurable SPI frequency.

Parallel QSPI

SPIHD

SPIWP

SPICS0

SPICLK

SPIQ

SPID

HSPICLK

HSPICS0

HSPIQ

HSPID

HSPIHD

HSPIWP

VSPICLK

VSPICS0

VSPIQ

VSPID

VSPIHD

VSPIWP

SD_DATA_2

SD_DATA_3

SD_CMD

SD_CLK

SD_DATA_0

SD_DATA_1

MTMS

MTDO

MTDI

MTCK

GPIO4

GPIO2

GPIO18

GPIO5

GPIO19

GPIO23

GPIO21

GPIO22

Supports Standard SPI, Dual SPI, and Quad SPI that can be connected to the external flash and SRAM
EMAC

EMAC_TX_CLK

EMAC_RX_CLK

EMAC_TX_EN

EMAC_TXD0

EMAC_TXD1

EMAC_TXD2

EMAC_TXD3

EMAC_RX_ER

EMAC_RX_DV

EMAC_RXD0

EMAC_RXD1

EMAC_RXD2

EMAC_RXD3

EMAC_CLK_OUT

EMAC_CLK_OUT_180

EMAC_TX_ER

EMAC_MDC_out

EMAC_MDI_in

EMAC_MDO_out

EMAC_CRS_out

EMAC_COL_out

GPIO0

GPIO5

GPIO21

GPIO19

GPIO22

MTMS

MTDI

MTCK

GPIO27

GPIO25

GPIO26

U0TXD

MTDO

GPIO16

GPIO17

GPIO4

Any GPIO Pins

Any GPIO Pins

Any GPIO Pins

Any GPIO Pins

Any GPIO Pins

An IEEE-802.3-2008-compliant Media Access Controller (MAC) is provided for Ethernet LAN communications. ESP32 requires an external physical interface device (PHY) to connect to the physical LAN bus (twisted-pair, fiber, etc.).
Pulse Counter

pcnt_sig_ch0_in0

pcnt_sig_ch1_in0

pcnt_ctrl_ch0_in0

pcnt_ctrl_ch1_in0

pcnt_sig_ch0_in1

pcnt_sig_ch1_in1

pcnt_ctrl_ch0_in1

pcnt_ctrl_ch1_in1

pcnt_sig_ch0_in2

pcnt_sig_ch1_in2

pcnt_ctrl_ch0_in2

pcnt_ctrl_ch1_in2

pcnt_sig_ch0_in3

pcnt_sig_ch1_in3

pcnt_ctrl_ch0_in3

pcnt_ctrl_ch1_in3

pcnt_sig_ch0_in4

pcnt_sig_ch1_in4

pcnt_ctrl_ch0_in4

pcnt_ctrl_ch1_in4

pcnt_sig_ch0_in5

pcnt_sig_ch1_in5

pcnt_ctrl_ch0_in5

pcnt_ctrl_ch1_in5

pcnt_sig_ch0_in6

pcnt_sig_ch1_in6

pcnt_ctrl_ch0_in6

pcnt_ctrl_ch1_in6

pcnt_sig_ch0_in7

pcnt_sig_ch1_in7

pcnt_ctrl_ch0_in7

pcnt_ctrl_ch1_in7

Any GPIO Pins

The pulse counter captures pulse and counts pulse edges through seven modes. It has eight channels, each of which captures four signals at a time. The four input signals include two pulse signals and two control signals.

When the counter reaches a defined threshold, an interrupt is generated

TWAI

  twai_rx

twai_tx

twai_bus_off_on

twai_clkout

Any GPIO Pins

Compatible with ISO 11898-1 protocol

(CAN Specification 2.0)

CONCLUSION

We have understood the basic diagrams and pin configurations of ESP-32, ESP-32 WROOM 32, and ESP-32 WROOM 32 DEV-KIT.

References

  1. https://www.researchgate.net/figure/ESP32-dual-core-IoT-ready-MCU-arhitecture-6_fig4_316173015
  2. https://www.espressif.com/sites/default/files/documentation/esp32_datasheet_en.pdf
  3. https://www.espressif.com/sites/default/files/documentation/esp32-wroom-32_datasheet_en.pdf
  4. Developing IoT Projects with ESP-32 by Vedat Ozen Onar
Kunal Gupta
Author: Kunal Gupta

Author

Kunal Gupta

Leave a comment

Stay Updated With Us

Error: Contact form not found.

      Blog