From c7702894fe85cf99505d792ffa15bd7f16964701 Mon Sep 17 00:00:00 2001 From: Eren Terzioglu Date: Wed, 26 Feb 2025 09:16:52 +0100 Subject: [PATCH] documentation/esp32[s2|s3]: Add I2C slave support Add I2C Slave support into docs for xtensa based Espressif devices Signed-off-by: Eren Terzioglu --- Documentation/platforms/xtensa/esp32/index.rst | 2 +- .../esp32s2/boards/esp32s2-kaluga-1/index.rst | 17 +++++++++++++++++ .../esp32s2/boards/esp32s2-saola-1/index.rst | 17 +++++++++++++++++ .../platforms/xtensa/esp32s2/index.rst | 2 +- .../esp32s3/boards/esp32s3-devkit/index.rst | 18 ++++++++++++++++++ .../platforms/xtensa/esp32s3/index.rst | 2 +- 6 files changed, 55 insertions(+), 3 deletions(-) diff --git a/Documentation/platforms/xtensa/esp32/index.rst b/Documentation/platforms/xtensa/esp32/index.rst index fb4e9020e8e..523c1967d24 100644 --- a/Documentation/platforms/xtensa/esp32/index.rst +++ b/Documentation/platforms/xtensa/esp32/index.rst @@ -336,7 +336,7 @@ DAC Yes One-shot eFuse Yes Ethernet Yes GPIO Yes -I2C Yes +I2C Yes Master and Slave mode supported I2S Yes LED_PWM Yes MCPWM Yes diff --git a/Documentation/platforms/xtensa/esp32s2/boards/esp32s2-kaluga-1/index.rst b/Documentation/platforms/xtensa/esp32s2/boards/esp32s2-kaluga-1/index.rst index 5e1abc2d5f8..a475a0ba7cf 100644 --- a/Documentation/platforms/xtensa/esp32s2/boards/esp32s2-kaluga-1/index.rst +++ b/Documentation/platforms/xtensa/esp32s2/boards/esp32s2-kaluga-1/index.rst @@ -248,6 +248,23 @@ You can scan for all I2C devices using the following command:: nsh> i2c dev 0x00 0x7f +To use slave mode, you can enable `ESP32S2_I2S_ROLE_SLAVE` option. +To use slave mode driver following snippet demonstrates how write to i2c bus +using slave driver: + +.. code-block:: C + + #define ESP_I2C_SLAVE_PATH "/dev/i2cslv0" + int main(int argc, char *argv[]) + { + int i2c_slave_fd; + int ret; + uint8_t buffer[5] = {0xAA}; + i2c_slave_fd = open(ESP_I2C_SLAVE_PATH, O_RDWR); + ret = write(i2c_slave_fd, buffer, 5); + close(i2c_slave_fd); + } + lvgl_ili9341 ------------ diff --git a/Documentation/platforms/xtensa/esp32s2/boards/esp32s2-saola-1/index.rst b/Documentation/platforms/xtensa/esp32s2/boards/esp32s2-saola-1/index.rst index edebe5a8820..2929fc3e329 100644 --- a/Documentation/platforms/xtensa/esp32s2/boards/esp32s2-saola-1/index.rst +++ b/Documentation/platforms/xtensa/esp32s2/boards/esp32s2-saola-1/index.rst @@ -209,6 +209,23 @@ You can scan for all I2C devices using the following command:: nsh> i2c dev 0x00 0x7f +To use slave mode, you can enable `ESP32S2_I2S_ROLE_SLAVE` option. +To use slave mode driver following snippet demonstrates how write to i2c bus +using slave driver: + +.. code-block:: C + + #define ESP_I2C_SLAVE_PATH "/dev/i2cslv0" + int main(int argc, char *argv[]) + { + int i2c_slave_fd; + int ret; + uint8_t buffer[5] = {0xAA}; + i2c_slave_fd = open(ESP_I2C_SLAVE_PATH, O_RDWR); + ret = write(i2c_slave_fd, buffer, 5); + close(i2c_slave_fd); + } + i2schar ------- diff --git a/Documentation/platforms/xtensa/esp32s2/index.rst b/Documentation/platforms/xtensa/esp32s2/index.rst index 2745550d153..3c07f039389 100644 --- a/Documentation/platforms/xtensa/esp32s2/index.rst +++ b/Documentation/platforms/xtensa/esp32s2/index.rst @@ -323,7 +323,7 @@ DMA Yes eFuse No Ethernet No GPIO Yes -I2C Yes +I2C Yes Master and Slave mode supported I2S Yes LED_PWM No Pulse_CNT Yes diff --git a/Documentation/platforms/xtensa/esp32s3/boards/esp32s3-devkit/index.rst b/Documentation/platforms/xtensa/esp32s3/boards/esp32s3-devkit/index.rst index a26d244dd28..a0e3c6080d2 100644 --- a/Documentation/platforms/xtensa/esp32s3/boards/esp32s3-devkit/index.rst +++ b/Documentation/platforms/xtensa/esp32s3/boards/esp32s3-devkit/index.rst @@ -242,6 +242,24 @@ You can scan for all I2C devices using the following command:: nsh> i2c dev 0x00 0x7f +To use slave mode, you can enable `ESP32S3_I2S0_ROLE_SLAVE` or +`ESP32S3_I2S1_ROLE_SLAVE` option. +To use slave mode driver following snippet demonstrates how write to i2c bus +using slave driver: + +.. code-block:: C + + #define ESP_I2C_SLAVE_PATH "/dev/i2cslv0" + int main(int argc, char *argv[]) + { + int i2c_slave_fd; + int ret; + uint8_t buffer[5] = {0xAA}; + i2c_slave_fd = open(ESP_I2C_SLAVE_PATH, O_RDWR); + ret = write(i2c_slave_fd, buffer, 5); + close(i2c_slave_fd); + } + knsh ---- diff --git a/Documentation/platforms/xtensa/esp32s3/index.rst b/Documentation/platforms/xtensa/esp32s3/index.rst index 605e1d9afa3..cc79ddf2155 100644 --- a/Documentation/platforms/xtensa/esp32s3/index.rst +++ b/Documentation/platforms/xtensa/esp32s3/index.rst @@ -356,7 +356,7 @@ CAN/TWAI Yes DMA Yes eFuse No GPIO Yes -I2C No +I2C Yes Master and Slave mode supported I2S Yes LCD No LED_PWM No