mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-30 10:47:19 +02:00
CI: enable example builds for C3
Enables building C3 examples in CI. Fixes related warnings/errors and disables examples that cannot run.
This commit is contained in:
@ -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();
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
||||
|
@ -38,6 +38,7 @@ extern "C" {
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
#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 );
|
||||
|
@ -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 );
|
||||
|
@ -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 */
|
||||
|
@ -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 $<LINK_ONLY:${target_lib}>)
|
||||
# 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
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
@ -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);
|
||||
|
@ -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) {
|
||||
|
@ -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");
|
||||
|
@ -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.)
|
||||
|
@ -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.)
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
||||
|
@ -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";
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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.
|
||||
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.
|
@ -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
|
||||
|
||||
|
||||
|
@ -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;
|
||||
|
@ -1,3 +1,6 @@
|
||||
| Supported Targets | ESP32 | ESP32-S2 |
|
||||
| ----------------- | ----- | -------- |
|
||||
|
||||
# Touch Pad Interrupt Example
|
||||
|
||||
## ESP32 platform
|
||||
|
@ -1,3 +1,6 @@
|
||||
| Supported Targets | ESP32 | ESP32-S2 |
|
||||
| ----------------- | ----- | -------- |
|
||||
|
||||
# Touch Pad Read Example
|
||||
|
||||
## ESP32 plaform
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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.*/
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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.)
|
||||
|
@ -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,
|
||||
@ -57,6 +57,21 @@ 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.
|
||||
|
@ -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)
|
||||
|
@ -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.)
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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,
|
||||
#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,
|
||||
|
@ -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
|
||||
|
@ -1,3 +1,6 @@
|
||||
| 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.)
|
||||
|
@ -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/).
|
||||
|
@ -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.
|
||||
|
@ -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.)
|
||||
|
@ -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
|
||||
|
@ -1,5 +1,5 @@
|
||||
| Supported Targets | ESP32 | ESP32-S2 |
|
||||
| ----------------- | ----- | -------- |
|
||||
| Supported Targets | ESP32 | ESP32-S2 | ESP32-C3 |
|
||||
| ----------------- | ----- | -------- | -------- |
|
||||
|
||||
# Build only test for C++/C configuration
|
||||
|
||||
|
@ -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++
|
||||
|
@ -1,6 +1,3 @@
|
||||
| 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.
|
||||
|
Reference in New Issue
Block a user