ESP32 Pin out
ESP32 Pin out differ depending of the physical hardware. What is common is the GPIO numbering. So refer to the documentation of your specific board to find out the physical relation.
You can find all the details for the default mapping in this file
The default mapping defines how the pins are configured on start up. These pins configurations can be configured/redefined using the nanoFramework.Hardware.Esp32 assembly.
// Define MOSI pin for SPI2 as GPIO 15 Configuration.SetPinFunction(15, DeviceFunction.SPI2_MOSI); // Define LED PWM channel 1 GPIO 16 Configuration.SetPinFunction(16, DeviceFunction.PWM1); // Redefine I2C2 data pin from GPIO 25 to GPIO 17 Configuration.SetPinFunction(17, DeviceFunction.I2C2_DATA);
ESP32 Default Mapping
NP = Pin is undefined at startup
There are 2 I2C bus available:
|I2C1||GPIO 18||GPIO 19|
|I2C2||GPIO 25||GPIO 26|
There are 2 SPI possible configurations:
|SPI1||GPIO 23||GPIO 25||GPIO 19|
You have 2 serial ports available, COM1 is reserved for debugging when enabled.
|COM#||Transfer (Tx)||Reception (Rx)||RTS||CTS|
|COM1||GPIO 1||GPIO 3||GPIO 19||GPIO 22|
There are 16 PWM channels on ESP32 For all channels the GPIO pins are undefined at startup.
The first 8 PWM (PWM0 to PWM7) are using a low precision timer, the last 8 ones (PWM8 to PWM15) a high resolution timer. You should setup the pin to select the timer resolution you need.
Note that PWM goes in pair. So PWM0 and PWM1 (2 and 3, and so on) will share the same frequency. If you need PWM with different frequencies, you'll have to select compatible PWM pins.
We use "ADC1" with 20 logical channels mapped to the ESP32 internal controllers ADC1 and ADC2 There are the 18 available ESP32 channels plus the internal Temperature and Hall sensors making the 20 logical channels.
- Channels 10 to 19 can not be used while the WiFi is enabled. (exception CLR_E_PIN_UNAVAILABLE)
- Hall sensor and Temperature sensor can not be used at same time as Channels 0 and 3.
- Gpio 0, 2, 15 are strapping pins and can not be freely used ( Channels 11, 12, 13 ), check board schematics.
|Logical channel #||Internal ADC#||GPIO #||Note|
|8||ADC1||36||Internal Temperture sensor (VP), See restrictions|
|9||ADC1||39||Internal Hall Sensor (VN), See restrictions|
2 DAC are available on the ESP32: