[ESP32-C5] Add hardware specific info about ESP32-C5

This commit is contained in:
TD-er
2025-06-20 17:28:41 +02:00
parent 54e0ad486f
commit a9b749c34a
16 changed files with 176 additions and 89 deletions
+1 -1
View File
@@ -4,7 +4,7 @@
"ldscript": "esp32c5_out.ld"
},
"core": "esp32",
"extra_flags": "-DARDUINO_TASMOTA -DARDUINO_USB_MODE=1 -DUSE_USB_CDC_CONSOLE -DESP32_8M -DESP32C5 -DARDUINO_USB_CDC_ON_BOOT=1",
"extra_flags": "-DARDUINO_TASMOTA -DBOARD_HAS_PSRAM -DARDUINO_USB_MODE=1 -DUSE_USB_CDC_CONSOLE -DESP32_8M -DESP32C5 -DARDUINO_USB_CDC_ON_BOOT=1",
"f_cpu": "160000000L",
"f_flash": "80000000L",
"flash_mode": "qio",
+5 -2
View File
@@ -593,6 +593,7 @@ Datasheets
* `DS:ESP32-S3 <https://www.espressif.com/sites/default/files/documentation/esp32-s3_datasheet_en.pdf>`_
* `DS:ESP32-C3 <https://www.espressif.com/sites/default/files/documentation/esp32-c3_datasheet_en.pdf>`_ / `DS:ESP8685 <https://www.espressif.com/sites/default/files/documentation/esp8685_datasheet_en.pdf>`_
* `DS:ESP32-C2 <https://www.espressif.com/sites/default/files/documentation/esp8684_datasheet_en.pdf>`_ / `DS:ESP8684 <https://www.espressif.com/sites/default/files/documentation/esp8684_datasheet_en.pdf>`_
* `DS:ESP32-C5 <https://www.espressif.com/sites/default/files/documentation/esp32-c5_datasheet_en.pdf>`_
* `DS:ESP32-C6 <https://www.espressif.com/sites/default/files/documentation/esp32-c6_datasheet_en.pdf>`_
* `DS:ESP32-H2 <https://cdn-shop.adafruit.com/product-files/5715/esp32-h2_datasheet_en.pdf>`_
@@ -606,6 +607,7 @@ Technical Reference Manuals
* `TR:ESP32-S3 <https://www.espressif.com/sites/default/files/documentation/esp32-s3_technical_reference_manual_en.pdf>`_
* `TR:ESP32-C3 <https://www.espressif.com/sites/default/files/documentation/esp32-c3_technical_reference_manual_en.pdf>`_
* `TR:ESP32-C2 <https://www.espressif.com/sites/default/files/documentation/esp8684_technical_reference_manual_en.pdf>`_
* `TR:ESP32-C5 <https://www.espressif.com/sites/default/files/documentation/esp32-c5_technical_reference_manual_en.pdf>`_
* `TR:ESP32-C6 <https://www.espressif.com/sites/default/files/documentation/esp32-c6_technical_reference_manual_en.pdf>`_
* `TR:ESP32-H2 <https://www.espressif.com/sites/default/files/documentation/esp32-h2_technical_reference_manual_en.pdf>`_
@@ -854,7 +856,7 @@ ESP32-C5
This will be the first Espressif SoC supporting 5 GHz WiFi.
.. note:: Not yet available (as of Dec 2024)
.. note:: Beta silicon is available (as of June 2025), which may change in Q3 or Q4 of 2025. So not yet adviced to be used in real products
ESP32-C6
========
@@ -897,4 +899,5 @@ The CPU is rather powerful and there are versions with quite a large amount of P
It does have a RMII interface for Ethernet, like the ESP32-classic does.
.. note:: Not yet supported (as of Dec 2024)
.. note:: Not yet supported. Beta silicon is available (as of June 2025), which may change in Q3 or Q4 of 2025. So not yet adviced to be used in real products
+15
View File
@@ -614,6 +614,21 @@ ESP32-C2 (ESP8684)
The strapping combination of GPIO-8 = 0 and GPIO-9 = 0 is invalid and will trigger unexpected behavior.
ESP32-C5
~~~~~~~~
* GPIO-26 ... 28: "Select Bootloader Mode" pin
* GPIO-27: Enable or disable ROM messages printing
* GPIO-7: JTAG signal source
* GPIO-2: MTMS, used to select crystal frequency in non-standard boot mode
GPIO-2 is only used when the crystal frequency isn't explicitly set via efuses (which should not happen).
GPIO-25 and -3 are used to set SDIO sampling and driving clock edge.
However this is also never used as SDIO mode means no flash and the chip is connected to a CPU and used as WiFi card.
ESP32-C6
~~~~~~~~
+58 -36
View File
@@ -16,15 +16,15 @@
// SPI_HOST = SPI1_HOST // Only usable on ESP32
// HSPI_HOST = SPI2_HOST
// VSPI_HOST = SPI3_HOST
//
//
// ESP32-S2:
// FSPI_HOST = SPI2_HOST
// HSPI_HOST = SPI3_HOST
//
//
// ESP32-S3:
// FSPI_HOST = SPI2_HOST
// HSPI_HOST = SPI3_HOST
//
//
// ESP32-C6:
// FSPI_HOST = SPI1_HOST
// ESP32-C3:
@@ -39,51 +39,72 @@
// HSPI option is disabled for now on other than ESP32_CLASSIC.
// Should be added later as "Custom HSPI" when we support multiple SPI busses.
#ifdef ESP32
# if CONFIG_IDF_TARGET_ESP32S3 // ESP32-S3
#define VSPI_FSPI_SCK 36
#define VSPI_FSPI_MISO 37
#define VSPI_FSPI_MOSI 35
# elif CONFIG_IDF_TARGET_ESP32S2 // ESP32-S2
#define VSPI_FSPI_SCK 36
#define VSPI_FSPI_MISO 37
#define VSPI_FSPI_MOSI 35
# if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 4, 0)
# if CONFIG_IDF_TARGET_ESP32S3 // ESP32-S3
# define VSPI_FSPI_SCK 36
# define VSPI_FSPI_MISO 37
# define VSPI_FSPI_MOSI 35
# elif CONFIG_IDF_TARGET_ESP32S2 // ESP32-S2
# define VSPI_FSPI_SCK 36
# define VSPI_FSPI_MISO 37
# define VSPI_FSPI_MOSI 35
# elif CONFIG_IDF_TARGET_ESP32C6 // ESP32-C6
#define VSPI_FSPI_SCK 21
#define VSPI_FSPI_MISO 20
#define VSPI_FSPI_MOSI 19
# define VSPI_FSPI_SCK 21
# define VSPI_FSPI_MISO 20
# define VSPI_FSPI_MOSI 19
# elif CONFIG_IDF_TARGET_ESP32C5 // ESP32-C5
#define VSPI_FSPI_SCK 4
#define VSPI_FSPI_MISO 5
#define VSPI_FSPI_MOSI 6
# define VSPI_FSPI_SCK SPI2_IOMUX_PIN_NUM_CLK
# define VSPI_FSPI_MISO SPI2_IOMUX_PIN_NUM_MISO
# define VSPI_FSPI_MOSI SPI2_IOMUX_PIN_NUM_MOSI
# elif CONFIG_IDF_TARGET_ESP32C3 // ESP32-C3
#define VSPI_FSPI_SCK 4
#define VSPI_FSPI_MISO 5
#define VSPI_FSPI_MOSI 6
# define VSPI_FSPI_SCK 4
# define VSPI_FSPI_MISO 5
# define VSPI_FSPI_MOSI 6
# elif CONFIG_IDF_TARGET_ESP32C2 // ESP32-C2
#define VSPI_FSPI_SCK 4
#define VSPI_FSPI_MISO 5
#define VSPI_FSPI_MOSI 6
# elif CONFIG_IDF_TARGET_ESP32 // ESP32/PICO-D4
#define VSPI_FSPI_SCK 18
#define VSPI_FSPI_MISO 19
#define VSPI_FSPI_MOSI 23
# define VSPI_FSPI_SCK 4
# define VSPI_FSPI_MISO 5
# define VSPI_FSPI_MOSI 6
# elif CONFIG_IDF_TARGET_ESP32 // ESP32/PICO-D4
# define VSPI_FSPI_SCK 18
# define VSPI_FSPI_MISO 19
# define VSPI_FSPI_MOSI 23
# define HSPI_SCLK 14
# define HSPI_MISO 12
# define HSPI_MOSI 13
# define HSPI_SS 15
# define HSPI_SCLK 14
# define HSPI_MISO 12
# define HSPI_MOSI 13
# define HSPI_SS 15
# else // if CONFIG_IDF_TARGET_ESP32S2
# error Target CONFIG_IDF_TARGET is not supported
# endif // if CONFIG_IDF_TARGET_ESP32S2
# else // if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 4, 0)
# if CONFIG_IDF_TARGET_ESP32 // ESP32/PICO-D4
#endif
# define VSPI_FSPI_SCK 18
# define VSPI_FSPI_MISO 19
# define VSPI_FSPI_MOSI 23
enum class SPI_Options_e { // Do not change values as this is stored in the settings!
None = 0,
Vspi_Fspi = 1, // Default SPI bus
# define HSPI_SCLK 14
# define HSPI_MISO 12
# define HSPI_MOSI 13
# define HSPI_SS 15
# else // if CONFIG_IDF_TARGET_ESP32
# include <soc/spi_pins.h>
# define VSPI_FSPI_SCK SPI2_IOMUX_PIN_NUM_CLK
# define VSPI_FSPI_MISO SPI2_IOMUX_PIN_NUM_MISO
# define VSPI_FSPI_MOSI SPI2_IOMUX_PIN_NUM_MOSI
# endif // if CONFIG_IDF_TARGET_ESP32
# endif // if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 4, 0)
#endif // ifdef ESP32
enum class SPI_Options_e {
// Do not change values as this is stored in the settings!
None = 0,
Vspi_Fspi = 1, // General-purpose SPI (GP-SPI) mode (Default SPI bus)
#ifdef ESP32_CLASSIC
Hspi = 2,
Hspi = 2,
#endif
// UserDefined is using the default SPI bus.
@@ -91,6 +112,7 @@ enum class SPI_Options_e { // Do not change values as this is stored in the sett
// For later versions it is called FSPI
// N.B. the ESP32-C3 does not seem to name these as there is no SPI3_HOST.
UserDefined = 9 // Leave some room for other, possible future, hardware-related options
};
#ifdef ESP32
+1
View File
@@ -17,6 +17,7 @@ bool getGpioInfo(int gpio,
bool& input,
bool& output,
bool& warning);
bool isBootModePin(int gpio);
bool isBootStrapPin(int gpio);
+6
View File
@@ -82,6 +82,12 @@ bool getGpioInfo(int gpio, int& pinnr, bool& input, bool& output, bool& warning)
return (input || output);
}
bool isBootModePin(int gpio)
{
return gpio == 0;
}
bool isBootStrapPin(int gpio)
{
// GPIO 0 & 2 can't be used as an input. State during boot is dependent on boot mode.
@@ -36,6 +36,11 @@ bool getGpioInfo(int gpio, int& pinnr, bool& input, bool& output, bool& warning)
return (input || output);
}
bool isBootModePin(int gpio)
{
return gpio == 9;
}
bool isBootStrapPin(int gpio)
{
if (gpio == 8) {
+6 -3
View File
@@ -45,9 +45,7 @@ bool getGpioInfo(int gpio, int& pinnr, bool& input, bool& output, bool& warning)
output = false;
} else {
// See: https://www.letscontrolit.com/forum/viewtopic.php?p=71880#p71874
if ((gpio == 12) || (gpio == 13)) {
// SPIHD/GPIO12
// SPIWP/GPIO13
if ((gpio == MSPI_IOMUX_PIN_NUM_HD) || (gpio == MSPI_IOMUX_PIN_NUM_WP)) {
if ((ESP.getFlashChipMode() != FM_DOUT) &&
(ESP.getFlashChipMode() != FM_DIO)) {
input = false;
@@ -73,6 +71,11 @@ bool getGpioInfo(int gpio, int& pinnr, bool& input, bool& output, bool& warning)
return (input || output);
}
bool isBootModePin(int gpio)
{
return gpio == 9;
}
bool isBootStrapPin(int gpio)
{
if (gpio == 2) {
+37 -46
View File
@@ -2,9 +2,12 @@
#ifdef ESP32C5
# include <driver/gpio.h>
# include <soc/spi_pins.h>
# include "../Helpers/Hardware_device_info.h"
// ********************************************************************************
// Get info of a specific GPIO pin
// ********************************************************************************
@@ -21,33 +24,18 @@ bool getGpioInfo(int gpio, int& pinnr, bool& input, bool& output, bool& warning)
// FIXME TD-er: Implement for ESP32-C5
// See:
// - https://docs.espressif.com/projects/esp-idf/en/v5.0/esp32c3/hw-reference/esp32c3/user-guide-devkitm-1.html
// - https://docs.espressif.com/projects/esp-idf/en/latest/esp32c3/api-reference/peripherals/gpio.html
// - https://docs.espressif.com/projects/esp-idf/en/v5.0/esp32c5/hw-reference/esp32c3/user-guide-devkitm-1.html
// - https://docs.espressif.com/projects/esp-idf/en/latest/esp32c5/api-reference/peripherals/gpio.html
// Datasheet: https://www.espressif.com/sites/default/files/documentation/esp32-c3_datasheet_en.pdf
if (gpio == 11) {
if (getChipFeatures().embeddedFlash /* || !flashVddPinCanBeUsedAsGPIO() */) {
// See: https://www.letscontrolit.com/forum/viewtopic.php?p=71880#p71874
//
// By default VDD_SPI is the power supply pin for embedded flash or external flash.
// It can only be used as GPIO11 only when the chip is connected to an
// external flash, and this flash is powered by an external power supply
input = false;
output = false;
}
warning = true;
}
if (isFlashInterfacePin_ESPEasy(gpio)) {
if (isFlashInterfacePin_ESPEasy(gpio) || isPSRAMInterfacePin(gpio)) {
if (getChipFeatures().embeddedFlash) {
// Connected to the integrated SPI flash.
input = false;
output = false;
} else {
// See: https://www.letscontrolit.com/forum/viewtopic.php?p=71880#p71874
if ((gpio == 12) || (gpio == 13)) {
// SPIHD/GPIO12
// SPIWP/GPIO13
if ((gpio == MSPI_IOMUX_PIN_NUM_HD) || (gpio == MSPI_IOMUX_PIN_NUM_WP)) {
if ((ESP.getFlashChipMode() != FM_DOUT) &&
(ESP.getFlashChipMode() != FM_DIO)) {
input = false;
@@ -64,31 +52,44 @@ bool getGpioInfo(int gpio, int& pinnr, bool& input, bool& output, bool& warning)
warning = true;
}
// GPIO 18: USB_D-
// GPIO 19: USB_D+
// GPIO 20: U0RXD
// GPIO 21: U0TXD
return (input || output);
}
bool isBootModePin(int gpio)
{
return gpio == 28;
}
bool isBootStrapPin(int gpio)
{
if (gpio == 2) {
// Strapping pin which must be high during boot
// Boot mode | GPIO26 | GPIO27 | GPIO28
//
// SPI Boot | Any | Any | 1
// Joint Download Boot 0 | Any | 1 | 0
// Joint Download Boot 1 | 0 | 0 | 0
/*
Joint Download Boot 0 mode supports the following download methods:
- USB-Serial-JTAG Download Boot
- UART Download Boot
- SPI Slave Download Boot (chip revision v0.1 only)
Joint Download Boot 1 mode supports the following download methods:
- UART Download Boot
- SDIO Download Boot
*/
if (gpio == 26 || gpio == 27 || gpio == 28) {
// Strapping pin setting boot mode
return true;
}
if (gpio == 8) {
// Strapping pin which must be high during flashing
if (gpio == 7) {
// Strapping pin JTAG signal source
return true;
}
if (gpio == 9) {
// Strapping pin to force download mode (like GPIO-0 on ESP8266/ESP32-classic)
return true;
}
// Ignoring strapping pins GPIO-2, -3, 25
// as they should never cause issues for users.
return false;
}
@@ -125,22 +126,12 @@ bool getADC_gpio_info(int gpio_pin, int& adc, int& ch, int& t)
ch = -1;
t = -1;
if ((gpio_pin >= 0) && (gpio_pin <= 4)) {
// GPIO 1 ... 6 -> Channel 0 ... 5
if ((gpio_pin > 0) && (gpio_pin <= 6)) {
adc = 1;
ch = gpio_pin;
ch = gpio_pin - 1;
return true;
}
# if ESP_IDF_VERSION_MAJOR >= 5
// Support for ADC2 has been dropped.
# else // if ESP_IDF_VERSION_MAJOR >= 5
if (gpio_pin == 5) {
adc = 2;
ch = 0;
return true;
}
# endif // if ESP_IDF_VERSION_MAJOR >= 5
return false;
}
@@ -42,6 +42,11 @@ bool getGpioInfo(int gpio, int& pinnr, bool& input, bool& output, bool& warning)
return (input || output);
}
bool isBootModePin(int gpio)
{
return gpio == 9;
}
bool isBootStrapPin(int gpio)
{
// See: https://www.espressif.com/sites/default/files/documentation/esp32-c6_datasheet_en.pdf
@@ -58,12 +63,15 @@ bool isBootStrapPin(int gpio)
return true;
}
// Ignoring SDIO stapping pins as this will not be used in typical use cases where ESPEasy is used.
/*
if (gpio == 4 || gpio == 5) {
// SDIO Sampling and Driving Clock Edge
// MTMS = GPIO-4
// MTDI = Gpio-5
return true;
}
*/
if (gpio == 15) {
// JTAG signal source
@@ -47,6 +47,12 @@ bool getGpioInfo(int gpio, int& pinnr, bool& input, bool& output, bool& warning)
return (input || output);
}
bool isBootModePin(int gpio)
{
return gpio == 35;
}
bool isBootStrapPin(int gpio)
{
@@ -45,6 +45,12 @@ bool getGpioInfo(int gpio, int& pinnr, bool& input, bool& output, bool& warning)
return (input || output);
}
bool isBootModePin(int gpio)
{
return gpio == 0;
}
bool isBootStrapPin(int gpio)
{
if (gpio == 45) {
@@ -46,6 +46,11 @@ bool getGpioInfo(int gpio, int& pinnr, bool& input, bool& output, bool& warning)
return (input || output);
}
bool isBootModePin(int gpio)
{
return gpio == 0;
}
bool isBootStrapPin(int gpio)
{
if (gpio == 45) {
@@ -66,6 +66,11 @@ bool getGpioInfo(int gpio, int& pinnr, bool& input, bool& output, bool& warning)
return input || output;
}
bool isBootModePin(int gpio)
{
return gpio == 0;
}
bool isBootStrapPin(int gpio)
{
return (gpio == 0 || gpio == 2 || gpio == 15);
@@ -25,6 +25,10 @@ bool isFlashInterfacePin_ESPEasy(int gpio) {
case MSPI_IOMUX_PIN_NUM_MOSI:
case MSPI_IOMUX_PIN_NUM_MISO:
return true;
case 19:
// special pin to power flash
return true;
}
return false;
@@ -63,14 +67,16 @@ int32_t getEmbeddedPSRAMSize()
return 0;
}
# ifndef isPSRAMInterfacePin
bool isPSRAMInterfacePin(int gpio) {
return false;
return FoundPSRAM() ? ((gpio) >= MSPI_IOMUX_PIN_NUM_CS1 && (gpio) <= MSPI_IOMUX_PIN_NUM_MOSI) : false;
}
# endif // ifndef isPSRAMInterfacePin
const __FlashStringHelper* getChipModel(uint32_t chip_model, uint32_t chip_revision, uint32_t pkg_version, bool single_core)
{
return F("ESP32-C5");
+5
View File
@@ -373,6 +373,11 @@ const __FlashStringHelper* getConflictingUse(int gpio, PinSelectPurpose purpose,
}
#endif // if FEATURE_ETHERNET
if (isBootModePin(gpio)) {
return F("Boot Mode");
}
if (isBootStrapPin(gpio)) {
return F("Boot Strapping");
}