mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
feat(spi_slave_hd): p4 update examples and document
This commit is contained in:
parent
daeb71d7e4
commit
2e115ec98c
@ -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:
|
||||
|
@ -1,2 +1,2 @@
|
||||
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-S2 | ESP32-S3 |
|
||||
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- |
|
||||
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C6 | ESP32-H2 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
|
||||
| ----------------- | ----- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
|
@ -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));
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
------------
|
||||
|
@ -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:
|
||||
|
@ -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.)
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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 |
|
||||
| ----------------- | -------- | -------- | -------- | -------- | -------- | -------- | -------- |
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user