diff --git a/components/driver/test_apps/.build-test-rules.yml b/components/driver/test_apps/.build-test-rules.yml index 23f308bc54..25649b7e40 100644 --- a/components/driver/test_apps/.build-test-rules.yml +++ b/components/driver/test_apps/.build-test-rules.yml @@ -142,9 +142,6 @@ components/driver/test_apps/spi/master: components/driver/test_apps/spi/param: disable: - if: SOC_GPSPI_SUPPORTED != 1 - - if: IDF_TARGET in ["esp32p4"] - temporary: true - reason: target(s) is not supported yet # TODO: IDF-7505 components/driver/test_apps/spi/slave: disable: diff --git a/components/driver/test_apps/spi/param/README.md b/components/driver/test_apps/spi/param/README.md index 07b81b7c84..5b39ff9653 100644 --- a/components/driver/test_apps/spi/param/README.md +++ b/components/driver/test_apps/spi/param/README.md @@ -1,2 +1,2 @@ -| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-S2 | ESP32-S3 | -| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | \ No newline at end of file +| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 | +| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | \ No newline at end of file diff --git a/components/driver/test_apps/spi/param/main/test_spi_param.c b/components/driver/test_apps/spi/param/main/test_spi_param.c index 8bafdb54ac..3ffee20b24 100644 --- a/components/driver/test_apps/spi/param/main/test_spi_param.c +++ b/components/driver/test_apps/spi/param/main/test_spi_param.c @@ -1374,6 +1374,7 @@ static void test_slave_fd_dma(void) .tx_buffer = slave_send, .rx_buffer = slave_recive, .length = test_trans_len * 8, + .flags = SPI_SLAVE_TRANS_DMA_BUFFER_ALIGN_AUTO, }; unity_send_signal("Slave ready"); TEST_ESP_OK(spi_slave_transmit(TEST_SPI_HOST, &trans_cfg, portMAX_DELAY)); @@ -1589,6 +1590,7 @@ static void test_slave_hd_dma(void) spi_slave_hd_data_t *ret_trans, slave_trans = { .data = slave_send, .len = test_trans_len, + .flags = SPI_SLAVE_HD_TRANS_DMA_BUFFER_ALIGN_AUTO, }; unity_send_signal("Slave ready"); TEST_ESP_OK(spi_slave_hd_queue_trans(TEST_SPI_HOST, SPI_SLAVE_CHAN_TX, &slave_trans, portMAX_DELAY)); @@ -1690,6 +1692,7 @@ static void test_slave_hd_no_dma(void) spi_slave_hd_data_t *ret_trans, slave_trans = { .data = slave_send, .len = test_trans_len, + .flags = SPI_SLAVE_HD_TRANS_DMA_BUFFER_ALIGN_AUTO, }; unity_send_signal("Slave ready"); TEST_ESP_OK(spi_slave_hd_queue_trans(TEST_SPI_HOST, SPI_SLAVE_CHAN_TX, &slave_trans, portMAX_DELAY)); @@ -1826,6 +1829,7 @@ static void test_slave_sio_dma(void) .length = TEST_STEP_LEN * 8, .tx_buffer = slave_send, .rx_buffer = slave_recive, + .flags = SPI_SLAVE_TRANS_DMA_BUFFER_ALIGN_AUTO, }; unity_send_signal("Slave ready"); TEST_ESP_OK(spi_slave_transmit(TEST_SPI_HOST, &trans, portMAX_DELAY)); diff --git a/docs/docs_not_updated/esp32p4.txt b/docs/docs_not_updated/esp32p4.txt index 1423e81b2a..5a4bec2047 100644 --- a/docs/docs_not_updated/esp32p4.txt +++ b/docs/docs_not_updated/esp32p4.txt @@ -106,7 +106,6 @@ api-reference/peripherals/spi_flash/auto_suspend.inc api-reference/peripherals/sdm.rst api-reference/peripherals/touch_pad.rst api-reference/peripherals/adc_calibration.rst -api-reference/peripherals/spi_slave_hd.rst api-reference/peripherals/parlio.rst api-reference/peripherals/i2c.rst api-reference/peripherals/dedic_gpio.rst @@ -168,7 +167,6 @@ api-reference/protocols/esp_local_ctrl.rst api-reference/protocols/esp_crt_bundle.rst api-reference/protocols/esp_http_client.rst api-reference/protocols/esp_https_server.rst -api-reference/protocols/esp_spi_slave_protocol.rst api-reference/protocols/modbus.rst api-reference/protocols/esp_tls.rst api-reference/protocols/mdns.rst diff --git a/docs/en/api-reference/protocols/esp_spi_slave_protocol.rst b/docs/en/api-reference/protocols/esp_spi_slave_protocol.rst index f269567401..5455314809 100644 --- a/docs/en/api-reference/protocols/esp_spi_slave_protocol.rst +++ b/docs/en/api-reference/protocols/esp_spi_slave_protocol.rst @@ -14,21 +14,21 @@ ESP SPI Slave HD (Half Duplex) Mode Protocol SPI Slave Capabilities of Espressif Chips ----------------------------------------- -+------------------+-------+----------+----------+----------+----------+----------+----------+ -| | ESP32 | ESP32-S2 | ESP32-C3 | ESP32-S3 | ESP32-C2 | ESP32-C6 | ESP32-H2 | -+------------------+-------+----------+----------+----------+----------+----------+----------+ -| SPI Slave HD | N | Y (v2) | Y (v2) | Y (v2) | Y (v2) | Y (v2) | Y (v2) | -+------------------+-------+----------+----------+----------+----------+----------+----------+ -| Tohost intr | | N | N | N | N | N | N | -+------------------+-------+----------+----------+----------+----------+----------+----------+ -| Frhost intr | | 2 \* | 2 \* | 2 \* | 2 \* | 2 \* | 2 \* | -+------------------+-------+----------+----------+----------+----------+----------+----------+ -| TX DMA | | Y | Y | Y | Y | Y | Y | -+------------------+-------+----------+----------+----------+----------+----------+----------+ -| RX DMA | | Y | Y | Y | Y | Y | Y | -+------------------+-------+----------+----------+----------+----------+----------+----------+ -| Shared registers | | 72 | 64 | 64 | 64 | 64 | 64 | -+------------------+-------+----------+----------+----------+----------+----------+----------+ ++------------------+-------+----------+----------+----------+----------+----------+----------+----------+ +| | ESP32 | ESP32-S2 | ESP32-C3 | ESP32-S3 | ESP32-C2 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ++------------------+-------+----------+----------+----------+----------+----------+----------+----------+ +| SPI Slave HD | N | Y (v2) | Y (v2) | Y (v2) | Y (v2) | Y (v2) | Y (v2) | Y (v2) | ++------------------+-------+----------+----------+----------+----------+----------+----------+----------+ +| Tohost intr | | N | N | N | N | N | N | N | ++------------------+-------+----------+----------+----------+----------+----------+----------+----------+ +| Frhost intr | | 2 \* | 2 \* | 2 \* | 2 \* | 2 \* | 2 \* | 2 \* | ++------------------+-------+----------+----------+----------+----------+----------+----------+----------+ +| TX DMA | | Y | Y | Y | Y | Y | Y | Y | ++------------------+-------+----------+----------+----------+----------+----------+----------+----------+ +| RX DMA | | Y | Y | Y | Y | Y | Y | Y | ++------------------+-------+----------+----------+----------+----------+----------+----------+----------+ +| Shared registers | | 72 | 64 | 64 | 64 | 64 | 64 | 64 | ++------------------+-------+----------+----------+----------+----------+----------+----------+----------+ Introduction ------------ diff --git a/examples/peripherals/.build-test-rules.yml b/examples/peripherals/.build-test-rules.yml index e8c40bd359..66134a8dcf 100644 --- a/examples/peripherals/.build-test-rules.yml +++ b/examples/peripherals/.build-test-rules.yml @@ -263,29 +263,19 @@ examples/peripherals/spi_slave: examples/peripherals/spi_slave_hd/append_mode/master: disable: - - if: IDF_TARGET in ["esp32c6", "esp32p4"] - temporary: true - reason: target(s) not supported yet # TODO: IDF-7505 + - if: SOC_GPSPI_SUPPORTED != 1 or SOC_SPI_SUPPORT_SLAVE_HD_VER2 != 1 examples/peripherals/spi_slave_hd/append_mode/slave: - enable: - - if: IDF_TARGET == "esp32s2" - temporary: true - reason: the other targets are not tested yet + disable: + - if: SOC_GPSPI_SUPPORTED != 1 or SOC_SPI_SUPPORT_SLAVE_HD_VER2 != 1 examples/peripherals/spi_slave_hd/segment_mode/seg_master: disable: - - if: SOC_GPSPI_SUPPORTED != 1 - - if: IDF_TARGET in ["esp32p4"] - temporary: true - reason: target(s) is not supported yet # TODO: IDF-7505 slave hd support + - if: SOC_GPSPI_SUPPORTED != 1 or SOC_SPI_SUPPORT_SLAVE_HD_VER2 != 1 examples/peripherals/spi_slave_hd/segment_mode/seg_slave: disable: - - if: IDF_TARGET == "esp32" or SOC_GPSPI_SUPPORTED != 1 - - if: IDF_TARGET in ["esp32p4"] - temporary: true - reason: target(s) is not supported yet # TODO: IDF-7505 slave hd support + - if: SOC_GPSPI_SUPPORTED != 1 or SOC_SPI_SUPPORT_SLAVE_HD_VER2 != 1 examples/peripherals/temperature_sensor/temp_sensor: disable: diff --git a/examples/peripherals/spi_slave_hd/append_mode/README.md b/examples/peripherals/spi_slave_hd/append_mode/README.md index d28b9f27aa..acd6216d26 100644 --- a/examples/peripherals/spi_slave_hd/append_mode/README.md +++ b/examples/peripherals/spi_slave_hd/append_mode/README.md @@ -1,4 +1,4 @@ -# SPI Halfduplex Slave Append Mode Example +# SPI Slave Halfduplex: Append Mode Example (See the README.md file in the upper level 'examples' directory for more information about examples.) diff --git a/examples/peripherals/spi_slave_hd/append_mode/master/README.md b/examples/peripherals/spi_slave_hd/append_mode/master/README.md index 04e471ea05..93478a0c73 100644 --- a/examples/peripherals/spi_slave_hd/append_mode/master/README.md +++ b/examples/peripherals/spi_slave_hd/append_mode/master/README.md @@ -1,4 +1,4 @@ -| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-H2 | ESP32-S2 | ESP32-S3 | -| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | +| Supported Targets | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 | +| ----------------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | See README.md in the parent directory diff --git a/examples/peripherals/spi_slave_hd/append_mode/master/main/app_main.c b/examples/peripherals/spi_slave_hd/append_mode/master/main/app_main.c index d34696ca4b..b16711641a 100644 --- a/examples/peripherals/spi_slave_hd/append_mode/master/main/app_main.c +++ b/examples/peripherals/spi_slave_hd/append_mode/master/main/app_main.c @@ -15,18 +15,13 @@ #include "esp_serial_slave_link/essl.h" #include "esp_serial_slave_link/essl_spi.h" -#ifdef CONFIG_IDF_TARGET_ESP32H2 -#define GPIO_MOSI 5 -#define GPIO_MISO 0 -#define GPIO_SCLK 4 -#define GPIO_CS 1 - -#else +////////////////////////////////////////////////////////////////////////////////////////////////////////// +////////////// Please update the following configuration according to your Hardware spec ///////////////// +////////////////////////////////////////////////////////////////////////////////////////////////////////// #define GPIO_MOSI 11 #define GPIO_MISO 13 #define GPIO_SCLK 12 #define GPIO_CS 10 -#endif #define HOST_ID SPI2_HOST #define TRANSACTION_LEN 16 diff --git a/examples/peripherals/spi_slave_hd/append_mode/slave/README.md b/examples/peripherals/spi_slave_hd/append_mode/slave/README.md index 25a3dadfd1..93478a0c73 100644 --- a/examples/peripherals/spi_slave_hd/append_mode/slave/README.md +++ b/examples/peripherals/spi_slave_hd/append_mode/slave/README.md @@ -1,4 +1,4 @@ -| Supported Targets | ESP32-S2 | -| ----------------- | -------- | +| Supported Targets | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 | +| ----------------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | See README.md in the parent directory diff --git a/examples/peripherals/spi_slave_hd/append_mode/slave/main/app_main.c b/examples/peripherals/spi_slave_hd/append_mode/slave/main/app_main.c index 8b7160abe1..49676693b3 100644 --- a/examples/peripherals/spi_slave_hd/append_mode/slave/main/app_main.c +++ b/examples/peripherals/spi_slave_hd/append_mode/slave/main/app_main.c @@ -15,11 +15,15 @@ #include "freertos/semphr.h" #include "driver/spi_slave_hd.h" +////////////////////////////////////////////////////////////////////////////////////////////////////////// +////////////// Please update the following configuration according to your Hardware spec ///////////////// +////////////////////////////////////////////////////////////////////////////////////////////////////////// #define GPIO_MOSI 11 #define GPIO_MISO 13 #define GPIO_SCLK 12 #define GPIO_CS 10 -#define HOST_ID 1 + +#define HOST_ID SPI2_HOST #define QUEUE_SIZE 6 #define TRANSACTION_LEN 16 #define SYNC_REG_FROM_HOST (14 * 4) diff --git a/examples/peripherals/spi_slave_hd/segment_mode/README.md b/examples/peripherals/spi_slave_hd/segment_mode/README.md index 0618904a37..23cba9fc6d 100644 --- a/examples/peripherals/spi_slave_hd/segment_mode/README.md +++ b/examples/peripherals/spi_slave_hd/segment_mode/README.md @@ -10,7 +10,7 @@ These two projects illustrate the SPI Slave Halfduplex Segment Mode. ### Hardware Required -These two projects are supposed to be flashed onto two seperate boards and jumped together via correctly connected SPI pins defined in both of the ``app_main.c`` files. For the ``seg_master`` project, it could be flashed onto all the ESP Chips. Whereas the ``seg_slave`` currently could be flashed onto ESP32-S2. Once they are connected and flashed, they will use the SPI Master and SPI Slave Halfduplex drivers to communicate with each other. +These two projects are supposed to be flashed onto two seperate boards and jumped together via correctly connected SPI pins defined in both of the ``app_main.c`` files. Once they are connected and flashed, they will use the SPI Master and SPI Slave Halfduplex drivers to communicate with each other. Following is the connection between 2 ESP32S2 boards: @@ -21,8 +21,7 @@ Following is the connection between 2 ESP32S2 boards: | SCLK | GPIO12 | GPIO12 | | CS | GPIO10 | GPIO10 | -Plase refer to the macro definations at the top of ``app_main.c`` files, to know the connection on different chips. -Feel free to change the GPIO settings by editing the macro definations. +Feel free to change the GPIO settings by editing the macro definations on the top of the ``app_main.c`` ### Build and Flash diff --git a/examples/peripherals/spi_slave_hd/segment_mode/seg_master/README.md b/examples/peripherals/spi_slave_hd/segment_mode/seg_master/README.md index a170437d6b..93478a0c73 100644 --- a/examples/peripherals/spi_slave_hd/segment_mode/seg_master/README.md +++ b/examples/peripherals/spi_slave_hd/segment_mode/seg_master/README.md @@ -1,4 +1,4 @@ -| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-S2 | ESP32-S3 | -| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | +| Supported Targets | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 | +| ----------------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | See README.md in the parent directory diff --git a/examples/peripherals/spi_slave_hd/segment_mode/seg_master/main/app_main.c b/examples/peripherals/spi_slave_hd/segment_mode/seg_master/main/app_main.c index f5571b09e2..e7a1690c48 100644 --- a/examples/peripherals/spi_slave_hd/segment_mode/seg_master/main/app_main.c +++ b/examples/peripherals/spi_slave_hd/segment_mode/seg_master/main/app_main.c @@ -14,34 +14,15 @@ #include "driver/spi_master.h" #include "esp_serial_slave_link/essl_spi.h" -//Pin setting -#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 +////////////////////////////////////////////////////////////////////////////////////////////////////////// +////////////// Please update the following configuration according to your Hardware spec ///////////////// +////////////////////////////////////////////////////////////////////////////////////////////////////////// #define GPIO_MOSI 11 #define GPIO_MISO 13 #define GPIO_SCLK 12 #define GPIO_CS 10 -#elif CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C2 -#define GPIO_MOSI 7 -#define GPIO_MISO 2 -#define GPIO_SCLK 6 -#define GPIO_CS 10 - -#elif CONFIG_IDF_TARGET_ESP32C6 -#define GPIO_MOSI 19 -#define GPIO_MISO 20 -#define GPIO_SCLK 18 -#define GPIO_CS 9 - -#elif CONFIG_IDF_TARGET_ESP32H2 -#define GPIO_HANDSHAKE 2 -#define GPIO_MOSI 5 -#define GPIO_MISO 0 -#define GPIO_SCLK 4 -#define GPIO_CS 1 -#endif - -#define MASTER_HOST SPI2_HOST +#define MASTER_HOST SPI2_HOST #define DMA_CHAN SPI_DMA_CH_AUTO #define TX_SIZE_MIN 40 diff --git a/examples/peripherals/spi_slave_hd/segment_mode/seg_slave/README.md b/examples/peripherals/spi_slave_hd/segment_mode/seg_slave/README.md index d2553ff6db..4fc69c16b6 100644 --- a/examples/peripherals/spi_slave_hd/segment_mode/seg_slave/README.md +++ b/examples/peripherals/spi_slave_hd/segment_mode/seg_slave/README.md @@ -1,2 +1,2 @@ -| Supported Targets | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-S2 | ESP32-S3 | -| ----------------- | -------- | -------- | -------- | -------- | -------- | -------- | +| Supported Targets | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 | +| ----------------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- | diff --git a/examples/peripherals/spi_slave_hd/segment_mode/seg_slave/main/app_main.c b/examples/peripherals/spi_slave_hd/segment_mode/seg_slave/main/app_main.c index 18f61b6c0d..ad59703d6b 100644 --- a/examples/peripherals/spi_slave_hd/segment_mode/seg_slave/main/app_main.c +++ b/examples/peripherals/spi_slave_hd/segment_mode/seg_slave/main/app_main.c @@ -15,33 +15,14 @@ #define TIME_IS_OUT(start, end, timeout) (timeout) > ((end)-(start)) ? 0 : 1 -//Pin setting -#if CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3 +////////////////////////////////////////////////////////////////////////////////////////////////////////// +////////////// Please update the following configuration according to your Hardware spec ///////////////// +////////////////////////////////////////////////////////////////////////////////////////////////////////// #define GPIO_MOSI 11 #define GPIO_MISO 13 #define GPIO_SCLK 12 #define GPIO_CS 10 -#elif CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32C2 -#define GPIO_MOSI 7 -#define GPIO_MISO 2 -#define GPIO_SCLK 6 -#define GPIO_CS 10 - -#elif CONFIG_IDF_TARGET_ESP32C6 -#define GPIO_MOSI 19 -#define GPIO_MISO 20 -#define GPIO_SCLK 18 -#define GPIO_CS 9 - -#elif CONFIG_IDF_TARGET_ESP32H2 -#define GPIO_HANDSHAKE 2 -#define GPIO_MOSI 5 -#define GPIO_MISO 0 -#define GPIO_SCLK 4 -#define GPIO_CS 1 -#endif - #define SLAVE_HOST SPI2_HOST #define DMA_CHAN SPI_DMA_CH_AUTO #define QUEUE_SIZE 4