diff --git a/components/esp_wifi/esp32c3/esp_adapter.c b/components/esp_wifi/esp32c3/esp_adapter.c index 3cbb3e4723..4b91fc9405 100644 --- a/components/esp_wifi/esp32c3/esp_adapter.c +++ b/components/esp_wifi/esp32c3/esp_adapter.c @@ -420,12 +420,12 @@ static void IRAM_ATTR wifi_rtc_disable_iso_wrapper(void) #endif } -static void IRAM_ATTR wifi_clock_enable_wrapper(void) +static void wifi_clock_enable_wrapper(void) { wifi_module_enable(); } -static void IRAM_ATTR wifi_clock_disable_wrapper(void) +static void wifi_clock_disable_wrapper(void) { wifi_module_disable(); } diff --git a/components/freemodbus/CMakeLists.txt b/components/freemodbus/CMakeLists.txt index 3af4831360..482616eb1b 100644 --- a/components/freemodbus/CMakeLists.txt +++ b/components/freemodbus/CMakeLists.txt @@ -1,7 +1,4 @@ idf_build_get_property(target IDF_TARGET) -if(${target} STREQUAL "esp32c3") - return() # TODO ESP32-C3 IDF-2173 -endif() # The following five lines of boilerplate have to be in your project's # CMakeLists in this exact order for cmake to work correctly diff --git a/components/freemodbus/port/port.h b/components/freemodbus/port/port.h index 1924e67d23..3ff8e95477 100644 --- a/components/freemodbus/port/port.h +++ b/components/freemodbus/port/port.h @@ -17,7 +17,6 @@ #define PORT_COMMON_H_ #include "freertos/FreeRTOS.h" -#include "freertos/xtensa_api.h" #include "esp_log.h" // for ESP_LOGE macro #include "mbconfig.h" diff --git a/components/freertos/port/riscv/include/freertos/portmacro.h b/components/freertos/port/riscv/include/freertos/portmacro.h index 68cd053c89..72358fe13f 100644 --- a/components/freertos/port/riscv/include/freertos/portmacro.h +++ b/components/freertos/port/riscv/include/freertos/portmacro.h @@ -38,6 +38,7 @@ extern "C" { #include #include #include +#include "esp_timer.h" /* required for FreeRTOS run time stats */ #include "sdkconfig.h" #include "esp_attr.h" @@ -270,7 +271,7 @@ static inline unsigned portENTER_CRITICAL_NESTED(void) { #ifdef CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER /* Coarse resolution time (us) */ -#define portALT_GET_RUN_TIME_COUNTER_VALUE(x) do{(void)x; }while(0) +#define portALT_GET_RUN_TIME_COUNTER_VALUE(x) do {x = (uint32_t)esp_timer_get_time();} while(0) #endif extern void esp_vApplicationIdleHook( void ); diff --git a/components/freertos/port/xtensa/include/freertos/portmacro.h b/components/freertos/port/xtensa/include/freertos/portmacro.h index 5efd1bc68c..222a5ae801 100644 --- a/components/freertos/port/xtensa/include/freertos/portmacro.h +++ b/components/freertos/port/xtensa/include/freertos/portmacro.h @@ -302,7 +302,7 @@ static inline void uxPortCompareSetExtram(volatile uint32_t *addr, uint32_t comp #ifdef CONFIG_FREERTOS_RUN_TIME_STATS_USING_ESP_TIMER /* Coarse resolution time (us) */ -#define portALT_GET_RUN_TIME_COUNTER_VALUE(x) x = (uint32_t)esp_timer_get_time() +#define portALT_GET_RUN_TIME_COUNTER_VALUE(x) do {x = (uint32_t)esp_timer_get_time();} while(0) #endif void vPortYield( void ); diff --git a/components/hal/include/hal/spi_types.h b/components/hal/include/hal/spi_types.h index ec992404dd..4872838e68 100644 --- a/components/hal/include/hal/spi_types.h +++ b/components/hal/include/hal/spi_types.h @@ -49,11 +49,16 @@ FLAG_ATTR(spi_event_t) #define SPI_HOST SPI1_HOST #define HSPI_HOST SPI2_HOST #define VSPI_HOST SPI3_HOST -#else // !CONFIG_IDF_TARGET_ESP32 +#elif CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 // SPI_HOST (SPI1_HOST) is not supported by the SPI Master and SPI Slave driver on ESP32-S2 and later #define SPI_HOST SPI1_HOST #define FSPI_HOST SPI2_HOST #define HSPI_HOST SPI3_HOST +#elif CONFIG_IDF_TARGET_ESP32C3 +/* No SPI3_host on C3 */ +#define SPI_HOST SPI1_HOST +#define FSPI_HOST SPI2_HOST +#define HSPI_HOST SPI2_HOST #endif /** @endcond */ diff --git a/components/mbedtls/CMakeLists.txt b/components/mbedtls/CMakeLists.txt index 5c4d6dc025..8817b9fa36 100644 --- a/components/mbedtls/CMakeLists.txt +++ b/components/mbedtls/CMakeLists.txt @@ -182,8 +182,12 @@ set_property(TARGET mbedcrypto APPEND PROPERTY LINK_INTERFACE_LIBRARIES mbedtls) target_link_libraries(${COMPONENT_LIB} PUBLIC ${mbedtls_targets}) if(CONFIG_ESP_TLS_USE_DS_PERIPHERAL) - # Link target (esp32s2) library to component library - target_link_libraries(${COMPONENT_LIB} PUBLIC ${target}) + # Link target (e.g. esp32s2) library to component library + idf_component_get_property(target_lib ${target} COMPONENT_LIB) + set_property(TARGET mbedcrypto APPEND PROPERTY INTERFACE_LINK_LIBRARIES $) + # The linker seems to be unable to resolve all the dependencies without increasing this + set_property(TARGET mbedcrypto APPEND PROPERTY LINK_INTERFACE_MULTIPLICITY 6) + target_link_libraries(${COMPONENT_LIB} PUBLIC ${target_lib}) endif() # Link esp-cryptoauthlib to mbedtls diff --git a/components/wpa_supplicant/src/common/bss.c b/components/wpa_supplicant/src/common/bss.c index 7891d08c71..88d8be4a81 100644 --- a/components/wpa_supplicant/src/common/bss.c +++ b/components/wpa_supplicant/src/common/bss.c @@ -14,7 +14,6 @@ #include "drivers/driver.h" #include "eap_peer/eap.h" #include "wpa_supplicant_i.h" -#include "config.h" #include "scan.h" #include "bss.h" #ifdef ESP_SUPPLICANT diff --git a/components/wpa_supplicant/src/common/scan.c b/components/wpa_supplicant/src/common/scan.c index 3e41749416..7625de274f 100644 --- a/components/wpa_supplicant/src/common/scan.c +++ b/components/wpa_supplicant/src/common/scan.c @@ -10,7 +10,6 @@ #include "utils/common.h" #include "common/ieee802_11_defs.h" -#include "config.h" #include "wpa_supplicant_i.h" #include "drivers/driver.h" #include "common/ieee802_11_common.h" diff --git a/components/wpa_supplicant/src/esp_supplicant/esp_common.c b/components/wpa_supplicant/src/esp_supplicant/esp_common.c index 25dcb253e8..27863b4ed1 100644 --- a/components/wpa_supplicant/src/esp_supplicant/esp_common.c +++ b/components/wpa_supplicant/src/esp_supplicant/esp_common.c @@ -194,7 +194,7 @@ static void esp_register_action_frame(struct wpa_supplicant *wpa_s) } static void esp_supplicant_sta_conn_handler(void* arg, esp_event_base_t event_base, - int event_id, void* event_data) + int32_t event_id, void* event_data) { u8 bssid[ETH_ALEN]; u8 *ie; @@ -221,7 +221,7 @@ static void esp_supplicant_sta_conn_handler(void* arg, esp_event_base_t event_ba } static void esp_supplicant_sta_disconn_handler(void* arg, esp_event_base_t event_base, - int event_id, void* event_data) + int32_t event_id, void* event_data) { struct wpa_supplicant *wpa_s = &g_wpa_supp; wpas_rrm_reset(wpa_s); diff --git a/components/wpa_supplicant/src/esp_supplicant/esp_scan.c b/components/wpa_supplicant/src/esp_supplicant/esp_scan.c index 286061d2d1..0caf22e637 100644 --- a/components/wpa_supplicant/src/esp_supplicant/esp_scan.c +++ b/components/wpa_supplicant/src/esp_supplicant/esp_scan.c @@ -33,7 +33,7 @@ extern struct wpa_supplicant g_wpa_supp; static void esp_scan_done_event_handler(void* arg, esp_event_base_t event_base, - int event_id, void* event_data) + int32_t event_id, void* event_data) { struct wpa_supplicant *wpa_s = &g_wpa_supp; if (!wpa_s->scanning) { diff --git a/examples/ethernet/iperf/README.md b/examples/ethernet/iperf/README.md index 053230e01f..3d8bf3149d 100644 --- a/examples/ethernet/iperf/README.md +++ b/examples/ethernet/iperf/README.md @@ -23,7 +23,7 @@ See common pin assignments for Ethernet examples from [upper level](../README.md ### Software Tools Preparation 1. Install iperf tool on PC - * Debian/Ubuntu: `sudo apt-get install iperf` + * Debian/Ubuntu: `sudo apt-get install iperf` * macOS: `brew install iperf`(if using Homebrew) or `sudo port install iperf`(if using MacPorts) * Windows(MSYS2): Downloads binaries from [here]( https://iperf.fr/iperf-download.php#windows) diff --git a/examples/ethernet/iperf/main/ethernet_example_main.c b/examples/ethernet/iperf/main/ethernet_example_main.c index 49b9c2c46d..0103f5a342 100644 --- a/examples/ethernet/iperf/main/ethernet_example_main.c +++ b/examples/ethernet/iperf/main/ethernet_example_main.c @@ -52,7 +52,7 @@ void app_main(void) ESP_ERROR_CHECK(esp_console_new_repl_uart(&uart_config, &repl_config, &repl)); /* Register commands */ - register_system(); + register_system_common(); register_ethernet(); printf("\n =======================================================\n"); diff --git a/examples/peripherals/pcnt/pulse_count_event/README.md b/examples/peripherals/pcnt/pulse_count_event/README.md index d640a24c8b..419beabe0f 100644 --- a/examples/peripherals/pcnt/pulse_count_event/README.md +++ b/examples/peripherals/pcnt/pulse_count_event/README.md @@ -1,3 +1,6 @@ +| Supported Targets | ESP32 | ESP32-S2 | +| ----------------- | ----- | -------- | + # Pulse Count Event Example (See the README.md file in the upper level 'examples' directory for more information about examples.) diff --git a/examples/peripherals/pcnt/rotary_encoder/README.md b/examples/peripherals/pcnt/rotary_encoder/README.md index 7f963c9589..7b6926b85e 100644 --- a/examples/peripherals/pcnt/rotary_encoder/README.md +++ b/examples/peripherals/pcnt/rotary_encoder/README.md @@ -1,3 +1,6 @@ +| Supported Targets | ESP32 | ESP32-S2 | +| ----------------- | ----- | -------- | + # Rotary Encoder Example (See the README.md file in the upper level 'examples' directory for more information about examples.) @@ -5,7 +8,7 @@ The PCNT peripheral is designed to count the number of rising and/or falling edges of an input signal. Each PCNT unit has two channels, which makes it possible to extract more information from two input signals than only one signal. This example shows how to make use of the HW features to decode the differential signals generated from a common rotary encoder -- [EC11](https://tech.alpsalpine.com/prod/e/html/encoder/incremental/ec11/ec11_list.html). -The signals a rotary encoder produces (and what can be handled by this example) are based on a 2-bit gray code available on 2 digital data signal lines. The typical encoders use 3 output pins: 2 for the signals and one for the common signal usually GND. +The signals a rotary encoder produces (and what can be handled by this example) are based on a 2-bit gray code available on 2 digital data signal lines. The typical encoders use 3 output pins: 2 for the signals and one for the common signal usually GND. Typical signals: diff --git a/examples/peripherals/rmt/ir_protocols/main/ir_protocols_main.c b/examples/peripherals/rmt/ir_protocols/main/ir_protocols_main.c index 3860818e56..1e866efcd0 100644 --- a/examples/peripherals/rmt/ir_protocols/main/ir_protocols_main.c +++ b/examples/peripherals/rmt/ir_protocols/main/ir_protocols_main.c @@ -28,7 +28,7 @@ static void example_ir_rx_task(void *arg) { uint32_t addr = 0; uint32_t cmd = 0; - uint32_t length = 0; + size_t length = 0; bool repeat = false; RingbufHandle_t rb = NULL; rmt_item32_t *items = NULL; @@ -77,7 +77,7 @@ static void example_ir_tx_task(void *arg) uint32_t addr = 0x10; uint32_t cmd = 0x20; rmt_item32_t *items = NULL; - uint32_t length = 0; + size_t length = 0; ir_builder_t *ir_builder = NULL; rmt_config_t rmt_tx_config = RMT_DEFAULT_CONFIG_TX(CONFIG_EXAMPLE_RMT_TX_GPIO, example_tx_channel); diff --git a/examples/peripherals/spi_master/hd_eeprom/README.md b/examples/peripherals/spi_master/hd_eeprom/README.md index 4b1f4458a7..40b533d9e3 100644 --- a/examples/peripherals/spi_master/hd_eeprom/README.md +++ b/examples/peripherals/spi_master/hd_eeprom/README.md @@ -8,16 +8,16 @@ For different chip and host used, the connections may be different. -| | ESP32 | ESP32 | ESP32S2 | -| ---- | ----- | ----- | ------- | -| Host | SPI1 | HSPI | FSPI | -| VCC | 3.3V | 3.3V | 3.3V | -| GND | GND | GND | GND | -| DO | 7 | 18 | 37 | -| DI | 8 | 23 | 35 | -| SK | 6 | 19 | 36 | -| CS | 13 | 13 | 34 | -| ORG | GND | GND | GND | +| | ESP32 | ESP32 | ESP32S2 | ESP32C3 | +| ---- | ----- | ----- | ------- | ------- | +| Host | SPI1 | HSPI | FSPI | SPI2 | +| VCC | 3.3V | 3.3V | 3.3V | 3.3V | +| GND | GND | GND | GND | GND | +| DO | 7 | 18 | 37 | 2 | +| DI | 8 | 23 | 35 | 7 | +| SK | 6 | 19 | 36 | 6 | +| CS | 13 | 13 | 34 | 10 | +| ORG | GND | GND | GND | GND | ### Notes diff --git a/examples/peripherals/spi_master/hd_eeprom/main/spi_eeprom_main.c b/examples/peripherals/spi_master/hd_eeprom/main/spi_eeprom_main.c index 06e5282dfd..1833c3fc0f 100644 --- a/examples/peripherals/spi_master/hd_eeprom/main/spi_eeprom_main.c +++ b/examples/peripherals/spi_master/hd_eeprom/main/spi_eeprom_main.c @@ -48,6 +48,14 @@ # define PIN_NUM_MOSI 35 # define PIN_NUM_CLK 36 # define PIN_NUM_CS 34 +#elif defined CONFIG_IDF_TARGET_ESP32C3 +# define EEPROM_HOST SPI2_HOST +# define DMA_CHAN EEPROM_HOST + +# define PIN_NUM_MISO 2 +# define PIN_NUM_MOSI 7 +# define PIN_NUM_CLK 6 +# define PIN_NUM_CS 10 #endif static const char TAG[] = "main"; diff --git a/examples/peripherals/spi_master/lcd/main/pretty_effect.c b/examples/peripherals/spi_master/lcd/main/pretty_effect.c index 285a57e1ee..f6ae7de41a 100644 --- a/examples/peripherals/spi_master/lcd/main/pretty_effect.c +++ b/examples/peripherals/spi_master/lcd/main/pretty_effect.c @@ -26,8 +26,8 @@ static inline uint16_t get_bgnd_pixel(int x, int y) y+=8; return pixels[y][x]; } -#elif defined CONFIG_IDF_TARGET_ESP32S2 -//esp32s2 doesn't have enough memory to hold the decoded image, calculate instead +#elif CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32C3 +//esp32s2/c3 doesn't have enough memory to hold the decoded image, calculate instead static inline uint16_t get_bgnd_pixel(int x, int y) { return ((x<<3)^(y<<3)^(x*y)); @@ -69,8 +69,8 @@ esp_err_t pretty_effect_init(void) { #ifdef CONFIG_IDF_TARGET_ESP32 return decode_image(&pixels); -#elif defined CONFIG_IDF_TARGET_ESP32S2 - //esp32s2 doesn't have enough memory to hold the decoded image, calculate instead +#elif CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32C3 + //esp32s2/c3 doesn't have enough memory to hold the decoded image, calculate instead return ESP_OK; #endif } diff --git a/examples/peripherals/spi_master/lcd/main/spi_master_example_main.c b/examples/peripherals/spi_master/lcd/main/spi_master_example_main.c index b83e73f8f7..71184658ae 100644 --- a/examples/peripherals/spi_master/lcd/main/spi_master_example_main.c +++ b/examples/peripherals/spi_master/lcd/main/spi_master_example_main.c @@ -52,6 +52,18 @@ #define PIN_NUM_DC 4 #define PIN_NUM_RST 5 #define PIN_NUM_BCKL 6 +#elif defined CONFIG_IDF_TARGET_ESP32C3 +#define LCD_HOST SPI2_HOST +#define DMA_CHAN LCD_HOST + +#define PIN_NUM_MISO 2 +#define PIN_NUM_MOSI 7 +#define PIN_NUM_CLK 6 +#define PIN_NUM_CS 10 + +#define PIN_NUM_DC 9 +#define PIN_NUM_RST 18 +#define PIN_NUM_BCKL 19 #endif //To speed up transfers, every SPI transfer sends a bunch of lines. This define specifies how many. More means more memory use, diff --git a/examples/peripherals/spi_slave/README.md b/examples/peripherals/spi_slave/README.md index 2983d08051..c7e60ca686 100644 --- a/examples/peripherals/spi_slave/README.md +++ b/examples/peripherals/spi_slave/README.md @@ -1,15 +1,26 @@ ## SPI slave example -These two projects illustrate the SPI Slave driver. They're supposed to be flashed into two separate ESP32s connected to eachother using the SPI pins defined in app_main.c. Once connected and flashed, they will use the spi master and spi slave driver to communicate with eachother. The example also includes a handshaking line to allow the master to only poll the slave when it is actually ready to parse a transaction. +These two projects illustrate the SPI Slave driver. They're supposed to be flashed into two separate Espressif chips connected to eachother using the SPI pins defined in app_main.c. Once connected and flashed, they will use the spi master and spi slave driver to communicate with eachother. The example also includes a handshaking line to allow the master to only poll the slave when it is actually ready to parse a transaction. + +The default GPIOs used in the example are the following: + +| Signal | ESP32 | ESP32-S2 | ESP32-C3 | +|-----------|--------|----------|----------| +| Handshake | GPIO2 | GPIO2 | GPIO3 | +| MOSI | GPIO12 | GPIO12 | GPIO7 | +| MISO | GPIO13 | GPIO13 | GPIO2 | +| SCLK | GPIO15 | GPIO15 | GPIO6 | +| CS | GPIO14 | GPIO14 | GPIO10 | + Please run wires between the following GPIOs between the slave and master to make the example function: -| Signal | Slave | Master | -|-----------|--------|--------| -| Handshake | GPIO2 | GPIO2 | -| MOSI | GPIO12 | GPIO12 | -| MISO | GPIO13 | GPIO13 | -| SCLK | GPIO15 | GPIO15 | -| CS | GPIO14 | GPIO14 | +| Slave | Master | +|------------|-----------| +| Handshake | Handshake | +| MOSI | MOSI | +| MISO | MISO | +| SCLK | SCLK | +| CS | CS | -Be aware that the example by default uses lines normally reserved for JTAG. If this is an issue, either because of hardwired JTAG hardware or because of the need to do JTAG debugging, feel free to change the GPIO settings by editing defines in the top of main.c in the master/slave source code. \ No newline at end of file +Be aware that the example by default uses lines normally reserved for JTAG on ESP32. If this is an issue, either because of hardwired JTAG hardware or because of the need to do JTAG debugging, feel free to change the GPIO settings by editing defines in the top of main.c in the master/slave source code. \ No newline at end of file diff --git a/examples/peripherals/spi_slave/receiver/main/app_main.c b/examples/peripherals/spi_slave/receiver/main/app_main.c index fa5d7996c2..2321db6dbc 100644 --- a/examples/peripherals/spi_slave/receiver/main/app_main.c +++ b/examples/peripherals/spi_slave/receiver/main/app_main.c @@ -49,12 +49,23 @@ sending a transaction. As soon as the transaction is done, the line gets set low /* Pins in use. The SPI Master can use the GPIO mux, so feel free to change these if needed. */ +#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2 #define GPIO_HANDSHAKE 2 #define GPIO_MOSI 12 #define GPIO_MISO 13 #define GPIO_SCLK 15 #define GPIO_CS 14 +#elif CONFIG_IDF_TARGET_ESP32C3 +#define GPIO_HANDSHAKE 3 +#define GPIO_MOSI 7 +#define GPIO_MISO 2 +#define GPIO_SCLK 6 +#define GPIO_CS 10 + +#endif //CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2 + + #ifdef CONFIG_IDF_TARGET_ESP32 #define RCV_HOST HSPI_HOST #define DMA_CHAN 2 @@ -63,6 +74,10 @@ Pins in use. The SPI Master can use the GPIO mux, so feel free to change these i #define RCV_HOST SPI2_HOST #define DMA_CHAN RCV_HOST +#elif defined CONFIG_IDF_TARGET_ESP32C3 +#define RCV_HOST SPI2_HOST +#define DMA_CHAN RCV_HOST + #endif diff --git a/examples/peripherals/spi_slave/sender/main/app_main.c b/examples/peripherals/spi_slave/sender/main/app_main.c index 02dd79960b..34d5e2536f 100644 --- a/examples/peripherals/spi_slave/sender/main/app_main.c +++ b/examples/peripherals/spi_slave/sender/main/app_main.c @@ -50,12 +50,23 @@ task waits for this semaphore to be given before queueing a transmission. /* Pins in use. The SPI Master can use the GPIO mux, so feel free to change these if needed. */ +#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2 #define GPIO_HANDSHAKE 2 #define GPIO_MOSI 12 #define GPIO_MISO 13 #define GPIO_SCLK 15 #define GPIO_CS 14 +#elif CONFIG_IDF_TARGET_ESP32C3 +#define GPIO_HANDSHAKE 3 +#define GPIO_MOSI 7 +#define GPIO_MISO 2 +#define GPIO_SCLK 6 +#define GPIO_CS 10 + +#endif //CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2 + + #ifdef CONFIG_IDF_TARGET_ESP32 #define SENDER_HOST HSPI_HOST #define DMA_CHAN 2 @@ -64,6 +75,10 @@ Pins in use. The SPI Master can use the GPIO mux, so feel free to change these i #define SENDER_HOST SPI2_HOST #define DMA_CHAN SENDER_HOST +#elif defined CONFIG_IDF_TARGET_ESP32C3 +#define SENDER_HOST SPI2_HOST +#define DMA_CHAN SENDER_HOST + #endif @@ -78,7 +93,7 @@ static void IRAM_ATTR gpio_handshake_isr_handler(void* arg) //Sometimes due to interference or ringing or something, we get two irqs after eachother. This is solved by //looking at the time between interrupts and refusing any interrupt too close to another one. static uint32_t lasthandshaketime; - uint32_t currtime=xthal_get_ccount(); + uint32_t currtime=esp_cpu_get_ccount(); uint32_t diff=currtime-lasthandshaketime; if (diff<240000) return; //ignore everything <1ms after an earlier irq lasthandshaketime=currtime; diff --git a/examples/peripherals/touch_pad_interrupt/README.md b/examples/peripherals/touch_pad_interrupt/README.md index 6e05528515..395e689a32 100644 --- a/examples/peripherals/touch_pad_interrupt/README.md +++ b/examples/peripherals/touch_pad_interrupt/README.md @@ -1,12 +1,15 @@ +| Supported Targets | ESP32 | ESP32-S2 | +| ----------------- | ----- | -------- | + # Touch Pad Interrupt Example ## ESP32 platform -Demonstrates how to set up ESP32's capacitive touch pad peripheral to trigger interrupt when a pad is touched. It also shows how to detect the touch event by the software for sensor designs when greater touch detection sensitivity is required. +Demonstrates how to set up ESP32's capacitive touch pad peripheral to trigger interrupt when a pad is touched. It also shows how to detect the touch event by the software for sensor designs when greater touch detection sensitivity is required. -ESP32 supports touch detection by configuring hardware registers. The hardware periodically detects the pulse counts. If the number of pulse counts exceeds the set threshold, a hardware interrupt will be generated to notify the application layer that a certain touch sensor channel may be triggered. +ESP32 supports touch detection by configuring hardware registers. The hardware periodically detects the pulse counts. If the number of pulse counts exceeds the set threshold, a hardware interrupt will be generated to notify the application layer that a certain touch sensor channel may be triggered. -For the sensor designs when the pad is covered a glass or plastic, the difference caused by a 'touch' action could be very small. In such a case we are using software pooling and algorithms to reduce noise to still be able to detect small changes of the pulse counts. In certain cases we may need to use additional routines to adjust the threshold level dynamically as it may change depending on environment conditions. +For the sensor designs when the pad is covered a glass or plastic, the difference caused by a 'touch' action could be very small. In such a case we are using software pooling and algorithms to reduce noise to still be able to detect small changes of the pulse counts. In certain cases we may need to use additional routines to adjust the threshold level dynamically as it may change depending on environment conditions. Comparison of the two modes: @@ -30,13 +33,13 @@ I (17903) Touch pad: Waiting for any pad being touched... I (22903) Touch pad: Waiting for any pad being touched... ``` -Note: Sensing threshold is set up automatically at start up by performing simple calibration. Application is reading current value for each pad and assuming two thirds of this value as the sensing threshold. Do not touch pads on application start up, otherwise sensing may not work correctly. +Note: Sensing threshold is set up automatically at start up by performing simple calibration. Application is reading current value for each pad and assuming two thirds of this value as the sensing threshold. Do not touch pads on application start up, otherwise sensing may not work correctly. ## ESP32-S2 platform -Demonstrates how to set up ESP32-S2's capacitive touch pad peripheral to trigger interrupt when a pad is touched. It also shows how to detect the touch event by the software for sensor designs when greater touch detection sensitivity is required. +Demonstrates how to set up ESP32-S2's capacitive touch pad peripheral to trigger interrupt when a pad is touched. It also shows how to detect the touch event by the software for sensor designs when greater touch detection sensitivity is required. -ESP32-S2 supports touch detection by configuring hardware registers. The hardware periodically detects the pulse counts. If the number of pulse counts exceeds the set threshold, a hardware interrupt will be generated to notify the application layer that a certain touch sensor channel may be triggered. +ESP32-S2 supports touch detection by configuring hardware registers. The hardware periodically detects the pulse counts. If the number of pulse counts exceeds the set threshold, a hardware interrupt will be generated to notify the application layer that a certain touch sensor channel may be triggered. The application is cycling between the interrupt mode and the pooling mode with a filter, to compare performance of the touch sensor system in both scenarios: @@ -58,8 +61,8 @@ I (6194) Touch pad: TouchSensor [9] be inactived, status mask 0x0 ## Reference Information -For a simpler example how to configure and read capacitive touch pads, please refer to [touch_pad_read](../touch_pad_read). +For a simpler example how to configure and read capacitive touch pads, please refer to [touch_pad_read](../touch_pad_read). -Design and implementation of the touch sensor system is a complex process. The [Touch Sensor Application Note](https://github.com/espressif/esp-iot-solution/blob/master/documents/touch_pad_solution/touch_sensor_design_en.md) contains several ESP32 specific notes and comments to optimize the design and get the best out of the application with sensors controlled with the ESP32. +Design and implementation of the touch sensor system is a complex process. The [Touch Sensor Application Note](https://github.com/espressif/esp-iot-solution/blob/master/documents/touch_pad_solution/touch_sensor_design_en.md) contains several ESP32 specific notes and comments to optimize the design and get the best out of the application with sensors controlled with the ESP32. See the README.md file in the upper level 'examples' directory for more information about examples. \ No newline at end of file diff --git a/examples/peripherals/touch_pad_read/README.md b/examples/peripherals/touch_pad_read/README.md index c2ebf9a841..4e1fb2e044 100644 --- a/examples/peripherals/touch_pad_read/README.md +++ b/examples/peripherals/touch_pad_read/README.md @@ -1,8 +1,11 @@ +| Supported Targets | ESP32 | ESP32-S2 | +| ----------------- | ----- | -------- | + # Touch Pad Read Example ## ESP32 plaform -Read and display raw values or IIR filtered values from capacitive touch pad sensors. +Read and display raw values or IIR filtered values from capacitive touch pad sensors. Once configured, ESP32 is continuously measuring capacitance of touch pad sensors. Measurement is reflected as numeric value inversely related to sensor's capacitance. The capacitance is bigger when sensor is touched with a finger and the measured value smaller. In opposite situation, when finger is released, capacitance is smaller and the measured value bigger. @@ -11,17 +14,17 @@ To detect when a sensor is touched and when not, each particular design should b ESP32 supports reading up to ten capacitive touch pad sensors T0 - T9, connected to specific GPIO pins. For information on available pins please refer to [Technical Reference Manual](https://espressif.com/sites/default/files/documentation/esp32_technical_reference_manual_en.pdf). Application initializes all ten sensor pads. Then in a loop reads sensors T0 - T9 and displays obtained values (after a colon) on a serial terminal: ``` -Touch Sensor filter mode read, the output format is: +Touch Sensor filter mode read, the output format is: Touchpad num:[raw data, filtered data] -T0:[1072,1071] T1:[ 475, 475] T2:[1004,1003] T3:[1232,1231] T4:[1675,1676] T5:[1146,1146] T6:[1607,1607] T7:[1118,1118] T8:[1695,1695] T9:[1223,1222] -T0:[1072,1071] T1:[ 475, 475] T2:[1003,1003] T3:[1231,1231] T4:[1676,1676] T5:[1146,1146] T6:[1607,1607] T7:[1118,1118] T8:[1694,1694] T9:[1222,1221] -T0:[1071,1071] T1:[ 475, 475] T2:[1004,1004] T3:[1231,1231] T4:[1678,1677] T5:[1147,1146] T6:[1607,1607] T7:[1118,1118] T8:[1694,1694] T9:[1222,1221] +T0:[1072,1071] T1:[ 475, 475] T2:[1004,1003] T3:[1232,1231] T4:[1675,1676] T5:[1146,1146] T6:[1607,1607] T7:[1118,1118] T8:[1695,1695] T9:[1223,1222] +T0:[1072,1071] T1:[ 475, 475] T2:[1003,1003] T3:[1231,1231] T4:[1676,1676] T5:[1146,1146] T6:[1607,1607] T7:[1118,1118] T8:[1694,1694] T9:[1222,1221] +T0:[1071,1071] T1:[ 475, 475] T2:[1004,1004] T3:[1231,1231] T4:[1678,1677] T5:[1147,1146] T6:[1607,1607] T7:[1118,1118] T8:[1694,1694] T9:[1222,1221] ``` ## ESP32-S2 platform -Read and display raw values from capacitive touch pad sensors. +Read and display raw values from capacitive touch pad sensors. Once configured, ESP32-S2 is continuously measuring capacitance of touch pad sensors. Measurement is reflected as numeric value inversely related to sensor's capacitance. The capacitance is bigger when sensor is touched with a finger and the measured value bigger. In opposite situation, when finger is released, capacitance is smaller and the measured value smaller. diff --git a/examples/peripherals/uart/uart_echo/main/Kconfig.projbuild b/examples/peripherals/uart/uart_echo/main/Kconfig.projbuild index 78cbad09f7..91720d4419 100644 --- a/examples/peripherals/uart/uart_echo/main/Kconfig.projbuild +++ b/examples/peripherals/uart/uart_echo/main/Kconfig.projbuild @@ -3,9 +3,9 @@ menu "Echo Example Configuration" config EXAMPLE_UART_PORT_NUM int "UART port number" range 0 2 if IDF_TARGET_ESP32 - range 0 1 if IDF_TARGET_ESP32S2 + range 0 1 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32C3 default 2 if IDF_TARGET_ESP32 - default 1 if IDF_TARGET_ESP32S2 + default 1 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32C3 help UART communication port number for the example. See UART documentation for available port numbers. @@ -21,6 +21,7 @@ menu "Echo Example Configuration" int "UART RXD pin number" range 0 34 if IDF_TARGET_ESP32 range 0 46 if IDF_TARGET_ESP32S2 + range 0 19 if IDF_TARGET_ESP32C3 default 5 help GPIO number for UART RX pin. See UART documentation for more information @@ -30,6 +31,7 @@ menu "Echo Example Configuration" int "UART TXD pin number" range 0 34 if IDF_TARGET_ESP32 range 0 46 if IDF_TARGET_ESP32S2 + range 0 19 if IDF_TARGET_ESP32C3 default 4 help GPIO number for UART TX pin. See UART documentation for more information diff --git a/examples/peripherals/uart/uart_echo_rs485/main/Kconfig.projbuild b/examples/peripherals/uart/uart_echo_rs485/main/Kconfig.projbuild index c42fb70aa2..6c2612da74 100644 --- a/examples/peripherals/uart/uart_echo_rs485/main/Kconfig.projbuild +++ b/examples/peripherals/uart/uart_echo_rs485/main/Kconfig.projbuild @@ -3,9 +3,9 @@ menu "Echo RS485 Example Configuration" config ECHO_UART_PORT_NUM int "UART port number" range 0 2 if IDF_TARGET_ESP32 - range 0 1 if IDF_TARGET_ESP32S2 + range 0 1 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32C3 default 2 if IDF_TARGET_ESP32 - default 1 if IDF_TARGET_ESP32S2 + default 1 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32C3 help UART communication port number for the example. See UART documentation for available port numbers. @@ -23,6 +23,8 @@ menu "Echo RS485 Example Configuration" default 22 if IDF_TARGET_ESP32 range 0 46 if IDF_TARGET_ESP32S2 default 19 if IDF_TARGET_ESP32S2 + range 0 19 if IDF_TARGET_ESP32C3 + default 5 if IDF_TARGET_ESP32C3 help GPIO number for UART RX pin. See UART documentation for more information about available pin numbers for UART. @@ -33,6 +35,8 @@ menu "Echo RS485 Example Configuration" default 23 if IDF_TARGET_ESP32 range 0 46 if IDF_TARGET_ESP32S2 default 20 if IDF_TARGET_ESP32S2 + range 0 19 if IDF_TARGET_ESP32C3 + default 4 if IDF_TARGET_ESP32C3 help GPIO number for UART TX pin. See UART documentation for more information about available pin numbers for UART. @@ -41,6 +45,7 @@ menu "Echo RS485 Example Configuration" int "UART RTS pin number" range 0 34 if IDF_TARGET_ESP32 range 0 46 if IDF_TARGET_ESP32S2 + range 0 19 if IDF_TARGET_ESP32C3 default 18 help GPIO number for UART RTS pin. This pin is connected to diff --git a/examples/protocols/http_server/file_serving/main/main.c b/examples/protocols/http_server/file_serving/main/main.c index c91869c8b7..ea0de65e77 100644 --- a/examples/protocols/http_server/file_serving/main/main.c +++ b/examples/protocols/http_server/file_serving/main/main.c @@ -37,20 +37,22 @@ #define MOUNT_POINT "/sdcard" static const char *TAG="example"; -/* ESP32-S2 doesn't have an SD Host peripheral, always use SPI, +/* ESP32-S2/C3 doesn't have an SD Host peripheral, always use SPI, * ESP32 can choose SPI or SDMMC Host, SPI is used by default: */ #ifndef CONFIG_EXAMPLE_USE_SDMMC_HOST #define USE_SPI_MODE #endif -// on ESP32-S2, DMA channel must be the same as host id -#ifdef CONFIG_IDF_TARGET_ESP32S2 -#define SPI_DMA_CHAN host.slot -#endif //CONFIG_IDF_TARGET_ESP32S2 // DMA channel to be used by the SPI peripheral -#ifdef CONFIG_IDF_TARGET_ESP32 +#if CONFIG_IDF_TARGET_ESP32 #define SPI_DMA_CHAN 1 -#endif //SPI_DMA_CHAN +// on ESP32-S2, DMA channel must be the same as host id +#elif CONFIG_IDF_TARGET_ESP32S2 +#define SPI_DMA_CHAN host.slot +#elif CONFIG_IDF_TARGET_ESP32C3 +// on ESP32-C3, DMA channels are shared with all other peripherals +#define SPI_DMA_CHAN 1 +#endif //CONFIG_IDF_TARGET_ESP32 // When testing SD and SPI modes, keep in mind that once the card has been // initialized in SPI mode, it can not be reinitialized in SD mode without @@ -63,10 +65,17 @@ static char * mount_base_path = MOUNT_POINT; // Pin mapping when using SPI mode. // With this mapping, SD card can be used both in SPI and 1-line SD mode. // Note that a pull-up on CS line is required in SD mode. +#if CONFIG_IDF_TARGET_ESP32C3 +#define PIN_NUM_MISO 2 +#define PIN_NUM_MOSI 7 +#define PIN_NUM_CLK 6 +#define PIN_NUM_CS 10 +#else #define PIN_NUM_MISO 2 #define PIN_NUM_MOSI 15 #define PIN_NUM_CLK 14 #define PIN_NUM_CS 13 +#endif // CONFIG_IDF_TARGET_ESP32C3 #endif //USE_SPI_MODE /* Function to initialize SPIFFS */ @@ -186,7 +195,6 @@ void sdcard_mount(void) sdmmc_card_print_info(stdout, card); } -#endif static esp_err_t unmount_card(const char* base_path, sdmmc_card_t* card) { @@ -205,6 +213,8 @@ static esp_err_t unmount_card(const char* base_path, sdmmc_card_t* card) return err; } +#endif //CONFIG_EXAMPLE_MOUNT_SD_CARD + void app_main(void) { /*Mount the SDcard first if needed.*/ diff --git a/examples/protocols/https_server/wss_server/main/keep_alive.c b/examples/protocols/https_server/wss_server/main/keep_alive.c index 8f720d8e2f..92ae0f6126 100644 --- a/examples/protocols/https_server/wss_server/main/keep_alive.c +++ b/examples/protocols/https_server/wss_server/main/keep_alive.c @@ -13,6 +13,7 @@ #include "freertos/queue.h" #include "freertos/task.h" #include "keep_alive.h" +#include "esp_timer.h" typedef enum { NO_CLIENT = 0, diff --git a/examples/protocols/pppos_client/components/modem/src/esp_modem.c b/examples/protocols/pppos_client/components/modem/src/esp_modem.c index 602caf8f32..3aba38e6e5 100644 --- a/examples/protocols/pppos_client/components/modem/src/esp_modem.c +++ b/examples/protocols/pppos_client/components/modem/src/esp_modem.c @@ -475,7 +475,11 @@ modem_dte_t *esp_modem_dte_init(const esp_modem_dte_config_t *config) .data_bits = config->data_bits, .parity = config->parity, .stop_bits = config->stop_bits, +#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2 .source_clk = UART_SCLK_REF_TICK, +#else + .source_clk = UART_SCLK_XTAL, +#endif .flow_ctrl = (config->flow_control == MODEM_FLOW_CONTROL_HW) ? UART_HW_FLOWCTRL_CTS_RTS : UART_HW_FLOWCTRL_DISABLE }; MODEM_CHECK(uart_param_config(esp_dte->uart_port, &uart_config) == ESP_OK, "config uart parameter failed", err_uart_config); diff --git a/examples/protocols/sockets/tcp_server/main/tcp_server.c b/examples/protocols/sockets/tcp_server/main/tcp_server.c index 96385cdd12..434e46a228 100644 --- a/examples/protocols/sockets/tcp_server/main/tcp_server.c +++ b/examples/protocols/sockets/tcp_server/main/tcp_server.c @@ -112,7 +112,7 @@ static void tcp_server_task(void *pvParameters) ESP_LOGI(TAG, "Socket listening"); struct sockaddr_storage source_addr; // Large enough for both IPv4 or IPv6 - uint addr_len = sizeof(source_addr); + socklen_t addr_len = sizeof(source_addr); int sock = accept(listen_sock, (struct sockaddr *)&source_addr, &addr_len); if (sock < 0) { ESP_LOGE(TAG, "Unable to accept connection: errno %d", errno); diff --git a/examples/provisioning/wifi_prov_mgr/README.md b/examples/provisioning/wifi_prov_mgr/README.md index 2233ce23e7..cf67e01714 100644 --- a/examples/provisioning/wifi_prov_mgr/README.md +++ b/examples/provisioning/wifi_prov_mgr/README.md @@ -1,3 +1,5 @@ +| Supported Targets | ESP32 | ESP32-S2 | +| ----------------- | ----- | -------- | # Wi-Fi Provisioning Manager Example (See the README.md file in the upper level 'examples' directory for more information about examples.) diff --git a/examples/storage/sd_card/README.md b/examples/storage/sd_card/README.md index 127a80d3f5..3fc1a101e1 100644 --- a/examples/storage/sd_card/README.md +++ b/examples/storage/sd_card/README.md @@ -2,7 +2,7 @@ (See the README.md file in the upper level 'examples' directory for more information about examples.) -This example demonstrates how to use an SD card with ESP32 or ESP32-S2. Example does the following steps: +This example demonstrates how to use an SD card with an ESP device. Example does the following steps: 1. Use an "all-in-one" `esp_vfs_fat_sdmmc_mount` function to: - initialize SDMMC peripheral, @@ -37,7 +37,7 @@ N/C | WP | | optional, not used in the example This example doesn't utilize card detect (CD) and write protect (WP) signals from SD card slot. -With the given pinout for SPI mode, same connections between the SD card and ESP32 can be used to test both SD and SPI modes, provided that the appropriate pullups are in place. +With the given pinout for SPI mode, same connections between the SD card and ESP32 can be used to test both SD and SPI modes, provided that the appropriate pullups are in place. See [the document about pullup requirements](https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/peripherals/sd_pullup_requirements.html) for more details about pullup support and compatibility of modules and development boards. In SPI mode, pins can be customized. See the initialization of ``spi_bus_config_t`` and ``sdspi_slot_config_t`` structures in the example code. @@ -57,11 +57,26 @@ N/C | WP | | optional, not used in the example In SPI mode, pins can be customized. See the initialization of ``spi_bus_config_t`` and ``sdspi_slot_config_t`` structures in the example code. +### Connections for ESP32-C3 + +Note that ESP32-C3 doesn't include SD Host peripheral and only supports SD over SPI. Therefore only SCK, MOSI, MISO, CS and ground pins need to be connected. + +ESP32-C3 pin | SD card pin | SPI pin | Notes +--------------|-------------|---------|------------ +GPIO8 | CLK | SCK | 10k pullup +GPIO9 | CMD | MOSI | 10k pullup +GPIO18 | D0 | MISO | 10k pullup +GPIO19 | D3 | CS | 10k pullup +N/C | CD | | optional, not used in the example +N/C | WP | | optional, not used in the example + +In SPI mode, pins can be customized. See the initialization of ``spi_bus_config_t`` and ``sdspi_slot_config_t`` structures in the example code. + ### Note about GPIO2 (ESP32 only) GPIO2 pin is used as a bootstrapping pin, and should be low to enter UART download mode. One way to do this is to connect GPIO0 and GPIO2 using a jumper, and then the auto-reset circuit on most development boards will pull GPIO2 low along with GPIO0, when entering download mode. -- Some boards have pulldown and/or LED on GPIO2. LED is usually ok, but pulldown will interfere with D0 signals and must be removed. Check the schematic of your development board for anything connected to GPIO2. +- Some boards have pulldown and/or LED on GPIO2. LED is usually ok, but pulldown will interfere with D0 signals and must be removed. Check the schematic of your development board for anything connected to GPIO2. ### Note about GPIO12 (ESP32 only) @@ -125,7 +140,7 @@ Here is an example console output. In this case a 128MB SDSC card was connected, ``` I (336) example: Initializing SD card I (336) example: Using SDMMC peripheral -I (336) gpio: GPIO[13]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 +I (336) gpio: GPIO[13]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 W (596) vfs_fat_sdmmc: failed to mount card (13) W (596) vfs_fat_sdmmc: partitioning card W (596) vfs_fat_sdmmc: formatting card, allocation unit size=16384 diff --git a/examples/storage/sd_card/main/sd_card_example_main.c b/examples/storage/sd_card/main/sd_card_example_main.c index e3ff6639ed..7fa538bbd0 100644 --- a/examples/storage/sd_card/main/sd_card_example_main.c +++ b/examples/storage/sd_card/main/sd_card_example_main.c @@ -32,8 +32,8 @@ static const char *TAG = "example"; // #define USE_SPI_MODE -// ESP32-S2 doesn't have an SD Host peripheral, always use SPI: -#ifdef CONFIG_IDF_TARGET_ESP32S2 +// ESP32-S2 and ESP32-C3 doesn't have an SD Host peripheral, always use SPI: +#if CONFIG_IDF_TARGET_ESP32S2 ||CONFIG_IDF_TARGET_ESP32C3 #ifndef USE_SPI_MODE #define USE_SPI_MODE #endif // USE_SPI_MODE @@ -54,10 +54,19 @@ static const char *TAG = "example"; // Pin mapping when using SPI mode. // With this mapping, SD card can be used both in SPI and 1-line SD mode. // Note that a pull-up on CS line is required in SD mode. +#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2 #define PIN_NUM_MISO 2 #define PIN_NUM_MOSI 15 #define PIN_NUM_CLK 14 #define PIN_NUM_CS 13 + +#elif CONFIG_IDF_TARGET_ESP32C3 +#define PIN_NUM_MISO 18 +#define PIN_NUM_MOSI 9 +#define PIN_NUM_CLK 8 +#define PIN_NUM_CS 19 + +#endif //CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2 #endif //USE_SPI_MODE void app_main(void) diff --git a/examples/system/app_trace_to_host/README.md b/examples/system/app_trace_to_host/README.md index bb396f0c85..a461f3fd47 100644 --- a/examples/system/app_trace_to_host/README.md +++ b/examples/system/app_trace_to_host/README.md @@ -1,3 +1,6 @@ +| Supported Targets | ESP32 | ESP32-S2 | +| ----------------- | ----- | -------- | + # Application Level Tracing Example (Logging to Host) (See the README.md file in the upper level 'examples' directory for more information about examples.) diff --git a/examples/system/console/components/cmd_system/cmd_system.c b/examples/system/console/components/cmd_system/cmd_system.c index 6dbbedae61..5d5e9fd225 100644 --- a/examples/system/console/components/cmd_system/cmd_system.c +++ b/examples/system/console/components/cmd_system/cmd_system.c @@ -233,7 +233,11 @@ static int deep_sleep(int argc, char **argv) ESP_LOGE(TAG, "GPIO wakeup from deep sleep currently unsupported on ESP32-C3"); } #endif // SOC_PM_SUPPORT_EXT_WAKEUP + +#if CONFIG_IDF_TARGET_ESP32 rtc_gpio_isolate(GPIO_NUM_12); +#endif //CONFIG_IDF_TARGET_ESP32 + esp_deep_sleep_start(); } diff --git a/examples/system/console/main/console_example_main.c b/examples/system/console/main/console_example_main.c index 52e57f65c3..e9e69aa708 100644 --- a/examples/system/console/main/console_example_main.c +++ b/examples/system/console/main/console_example_main.c @@ -84,7 +84,11 @@ static void initialize_console(void) .data_bits = UART_DATA_8_BITS, .parity = UART_PARITY_DISABLE, .stop_bits = UART_STOP_BITS_1, - .source_clk = UART_SCLK_REF_TICK, +#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2 + .source_clk = UART_SCLK_REF_TICK, +#else + .source_clk = UART_SCLK_XTAL, +#endif }; /* Install UART driver for interrupt-driven reads and writes */ ESP_ERROR_CHECK( uart_driver_install(CONFIG_ESP_CONSOLE_UART_NUM, diff --git a/examples/system/light_sleep/main/light_sleep_example_main.c b/examples/system/light_sleep/main/light_sleep_example_main.c index 28f39de5a5..4fc9fe4b00 100644 --- a/examples/system/light_sleep/main/light_sleep_example_main.c +++ b/examples/system/light_sleep/main/light_sleep_example_main.c @@ -23,7 +23,11 @@ /* Most development boards have "boot" button attached to GPIO0. * You can also change this to another pin. */ +#if CONFIG_IDF_TARGET_ESP32C3 +#define BUTTON_GPIO_NUM_DEFAULT 9 +#else #define BUTTON_GPIO_NUM_DEFAULT 0 +#endif /* "Boot" button on GPIO0 is active low */ #define BUTTON_WAKEUP_LEVEL_DEFAULT 0 diff --git a/examples/system/perfmon/README.md b/examples/system/perfmon/README.md index 13fc39594a..f205097860 100644 --- a/examples/system/perfmon/README.md +++ b/examples/system/perfmon/README.md @@ -1,11 +1,14 @@ +| Supported Targets | ESP32 | ESP32-S2 | +| ----------------- | ----- | -------- | + # Performance Monitor (`perfmon`) example (See the README.md file in the upper level 'examples' directory for more information about examples.) ## Overview -This example illustrates usage of `perfmon` APIs to monitor and profile functions. +This example illustrates usage of `perfmon` APIs to monitor and profile functions. The example will calculate performance statistic for simple test function. -The simple test function could be exchanged to one from the user. +The simple test function could be exchanged to one from the user. The example contain test function that will be executed with perfmon component and collect CPU statistic. The test function will be executed 200 times in each test case. The first test case collect statistic from all available performance counters, and second test just from defined in the list. diff --git a/examples/system/sysview_tracing/README.md b/examples/system/sysview_tracing/README.md index 44aa31c35f..dc5a643a6d 100644 --- a/examples/system/sysview_tracing/README.md +++ b/examples/system/sysview_tracing/README.md @@ -1,3 +1,5 @@ +| Supported Targets | ESP32 | ESP32-S2 | +| ----------------- | ----- | -------- | # Example: Application Level Tracing - SystemView Tracing (sysview_tracing) This test code shows how to perform system-wide behavioral analysis of the program using [SEGGER SystemView tool](https://www.segger.com/products/development-tools/systemview/). diff --git a/examples/system/sysview_tracing_heap_log/README.md b/examples/system/sysview_tracing_heap_log/README.md index fdb1d5ab8c..6f31050ed1 100644 --- a/examples/system/sysview_tracing_heap_log/README.md +++ b/examples/system/sysview_tracing_heap_log/README.md @@ -1,3 +1,6 @@ +| Supported Targets | ESP32 | ESP32-S2 | +| ----------------- | ----- | -------- | + # SystemView Heap and Log Tracing Example Heap memory leaking is quite widespread software bug. IDF provides [heap tracing feature](https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/system/heap_debug.html#heap-tracing) which allows to collect information related to heap operations (allocations/deallocations) and detect potential memory leaks. This feature can be used in two modes: standalone and host-based. In standalone mode collected data are kept on-board, so this mode is limited by avaialable memory in the system. Host-based mode does not have such limitation because collected data are sent to the host and can be analysed there using special tools. One of such tool is SEGGER SystemView. For description of [SystemView tracing feature](https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/app_trace.html#system-behaviour-analysis-with-segger-systemview) please refer to **ESP32 Programming Guide**, section **Application Level Tracing library**. SystemView is also can be useful to show log message sent from the target. diff --git a/examples/wifi/power_save/README.md b/examples/wifi/power_save/README.md index eb4ec120bc..63b11576f5 100644 --- a/examples/wifi/power_save/README.md +++ b/examples/wifi/power_save/README.md @@ -8,7 +8,7 @@ Power save mode only works in station mode. If the modem sleep mode is enabled, * Minimum modem sleep: In minimum modem sleep mode, station wakes up every DTIM to receive beacon. Broadcast data will not be lost because it is transmitted after DTIM. However, it can not save much more power if DTIM is short for DTIM is determined by AP. -* Maximum modem sleep: In maximum modem sleep mode, station wakes up every listen interval to receive beacon. Broadcast data may be lost because station may be in sleep state at DTIM time. If listen interval is longer, more power is saved but broadcast data is more easy to lose. +* Maximum modem sleep: In maximum modem sleep mode, station wakes up every listen interval to receive beacon. Broadcast data may be lost because station may be in sleep state at DTIM time. If listen interval is longer, more power is saved but broadcast data is more easy to lose. * others: not supported yet. diff --git a/examples/wifi/simple_sniffer/README.md b/examples/wifi/simple_sniffer/README.md index 7c8ba2d4a9..241aec57fe 100644 --- a/examples/wifi/simple_sniffer/README.md +++ b/examples/wifi/simple_sniffer/README.md @@ -1,3 +1,6 @@ +| Supported Targets | ESP32 | ESP32-S2 | +| ----------------- | ----- | ------- | + # Simple Sniffer Example (See the README.md file in the upper level 'examples' directory for more information about examples.) @@ -14,7 +17,7 @@ This example is based on console component. For more information about console, ### Hardware Required -To run this example, you should have one ESP32 dev board integrated with a SD card slot (e.g [ESP-WROVER-KIT](https://docs.espressif.com/projects/esp-idf/en/latest/hw-reference/modules-and-boards.html#esp-wrover-kit-v4-1)) or just connect [ESP32-DevKitC](https://docs.espressif.com/projects/esp-idf/en/latest/hw-reference/modules-and-boards.html#esp32-devkitc-v4) to a SD card breakout board. +To run this example, you should have one ESP32 dev board integrated with a SD card slot (e.g [ESP-WROVER-KIT](https://docs.espressif.com/projects/esp-idf/en/latest/hw-reference/modules-and-boards.html#esp-wrover-kit-v4-1)) or just connect [ESP32-DevKitC](https://docs.espressif.com/projects/esp-idf/en/latest/hw-reference/modules-and-boards.html#esp32-devkitc-v4) to a SD card breakout board. If you want to send packets to host, make sure to connect ESP32 to some kind of [JTAG adapter](https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/jtag-debugging/index.html#jtag-debugging-selecting-jtag-adapter). ### Configure the project @@ -85,7 +88,7 @@ The `sniffer` command support some important options as follow: esp32> mount sd I (158912) example: Initializing SD card I (158912) example: Using SDMMC peripheral -I (158912) gpio: GPIO[13]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 +I (158912) gpio: GPIO[13]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 Name: SA16G Type: SDHC/SDXC Speed: 20 MHz diff --git a/tools/ci/config/build.yml b/tools/ci/config/build.yml index 59269d1265..c1b16a1849 100644 --- a/tools/ci/config/build.yml +++ b/tools/ci/config/build.yml @@ -221,6 +221,12 @@ build_examples_cmake_esp32s2: variables: IDF_TARGET: esp32s2 +build_examples_cmake_esp32c3: + extends: .build_examples_cmake + parallel: 8 + variables: + IDF_TARGET: esp32c3 + .build_test_apps: extends: - .build_examples_cmake diff --git a/tools/test_apps/protocols/esp_netif/build_config/README.md b/tools/test_apps/protocols/esp_netif/build_config/README.md index 443d8c2207..6b63b76f1d 100644 --- a/tools/test_apps/protocols/esp_netif/build_config/README.md +++ b/tools/test_apps/protocols/esp_netif/build_config/README.md @@ -1,5 +1,5 @@ -| Supported Targets | ESP32 | ESP32-S2 | -| ----------------- | ----- | -------- | +| Supported Targets | ESP32 | ESP32-S2 | ESP32-C3 | +| ----------------- | ----- | -------- | -------- | # Build only test for C++/C configuration diff --git a/tools/test_apps/protocols/mqtt/build_test/README.md b/tools/test_apps/protocols/mqtt/build_test/README.md index d4a84228e6..70fb3324f7 100644 --- a/tools/test_apps/protocols/mqtt/build_test/README.md +++ b/tools/test_apps/protocols/mqtt/build_test/README.md @@ -1,6 +1,3 @@ -| Supported Targets | ESP32 | ESP32-S2 | -| ----------------- | ----- | -------- | - # Build only test for C++ -This test app ensures that calling all mqtt-client API could be called from C++ +This test app ensures that calling all mqtt-client API could be called from C++ diff --git a/tools/test_apps/protocols/mqtt/publish_connect_test/README.md b/tools/test_apps/protocols/mqtt/publish_connect_test/README.md index b52d36eac5..2d926b2a83 100644 --- a/tools/test_apps/protocols/mqtt/publish_connect_test/README.md +++ b/tools/test_apps/protocols/mqtt/publish_connect_test/README.md @@ -1,9 +1,6 @@ -| Supported Targets | ESP32 | ESP32-S2 | -| ----------------- | ----- | -------- | - # ESP-MQTT advanced publish and connect test project -Main purpose of this application is to test the MQTT library to correctly publish and receive messages (of different size and sequences) over different transports. +Main purpose of this application is to test the MQTT library to correctly publish and receive messages (of different size and sequences) over different transports. It is possible to run this example manually without any test to exercise how the MQTT library deals with - reception of fragmented messages