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:
Marius Vikhammer
2020-12-15 11:00:02 +08:00
parent 1de3f00012
commit 04df1f3a42
47 changed files with 245 additions and 94 deletions

View File

@@ -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.)

View File

@@ -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:

View File

@@ -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);

View File

@@ -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

View File

@@ -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";

View File

@@ -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
}

View File

@@ -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,

View File

@@ -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.

View File

@@ -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

View File

@@ -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;

View File

@@ -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.

View File

@@ -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.

View File

@@ -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

View File

@@ -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