This is an automated email from the ASF dual-hosted git repository. raiden00 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 59e13b449105e2c7d6cf859a3edbf937cffe680c Author: Eren Terzioglu <eren.terzio...@espressif.com> AuthorDate: Wed Apr 9 14:52:15 2025 +0200 Documentation/xtensa: Add dedicated GPIO docs for esp32[-s2|-s3] Add dedicated GPIO documentations for Xtensa based Espressif devices Signed-off-by: Eren Terzioglu <eren.terzio...@espressif.com> --- .../esp32s2/boards/esp32s2-saola-1/index.rst | 35 ++++++++++++++++++++++ Documentation/platforms/xtensa/esp32s2/index.rst | 2 +- .../xtensa/esp32s3/boards/esp32s3-devkit/index.rst | 35 ++++++++++++++++++++++ Documentation/platforms/xtensa/esp32s3/index.rst | 2 +- 4 files changed, 72 insertions(+), 2 deletions(-) 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 d6e84fee29..880f4116b1 100644 --- a/Documentation/platforms/xtensa/esp32s2/boards/esp32s2-saola-1/index.rst +++ b/Documentation/platforms/xtensa/esp32s2/boards/esp32s2-saola-1/index.rst @@ -224,6 +224,41 @@ At the nsh, we can turn the GPIO output on and off with the following:: nsh> gpio -o 1 /dev/gpio0 nsh> gpio -o 0 /dev/gpio0 +To use dedicated gpio for controlling multiple gpio pin at the same time +or having better response time, you need to enable +`CONFIG_ESPRESSIF_DEDICATED_GPIO` option. Dedicated GPIO is suitable +for faster response times required applications like simulate serial/parallel +interfaces in a bit-banging way. +After this option enabled GPIO6 and GPIO5 pins are ready to used as dedicated GPIO pins +as input/output mode. These pins are for example, you can use any pin up to 8 pins for +input and 8 pins for output for dedicated gpio. +To write and read data from dedicated gpio, you need to use +`write` and `read` calls. + +The following snippet demonstrates how to read/write to dedicated GPIO pins: + +.. code-block:: C + + int fd; = open("/dev/dedic_gpio0", O_RDWR); + int rd_val = 0; + int wr_mask = 0xffff; + int wr_val = 3; + + while(1) + { + write(fd, &wr_val, wr_mask); + if (wr_val == 0) + { + wr_val = 3; + } + else + { + wr_val = 0; + } + read(fd, &rd_val, sizeof(uint32_t)); + printf("rd_val: %d", rd_val); + } + i2c --- diff --git a/Documentation/platforms/xtensa/esp32s2/index.rst b/Documentation/platforms/xtensa/esp32s2/index.rst index 48023168dd..e8b65c110a 100644 --- a/Documentation/platforms/xtensa/esp32s2/index.rst +++ b/Documentation/platforms/xtensa/esp32s2/index.rst @@ -388,7 +388,7 @@ CAN/TWAI Yes DAC No DMA Yes eFuse Yes -GPIO Yes +GPIO Yes Dedicated GPIO supported I2C Yes Master and Slave mode supported I2S Yes LED/PWM Yes diff --git a/Documentation/platforms/xtensa/esp32s3/boards/esp32s3-devkit/index.rst b/Documentation/platforms/xtensa/esp32s3/boards/esp32s3-devkit/index.rst index c4459b7d9d..2db6dc4953 100644 --- a/Documentation/platforms/xtensa/esp32s3/boards/esp32s3-devkit/index.rst +++ b/Documentation/platforms/xtensa/esp32s3/boards/esp32s3-devkit/index.rst @@ -257,6 +257,41 @@ interrupt fires:: The pin is configured to trigger an interrupt on the rising edge, so after issuing the above command, connect it to 3.3V. +To use dedicated gpio for controlling multiple gpio pin at the same time +or having better response time, you need to enable +`CONFIG_ESPRESSIF_DEDICATED_GPIO` option. Dedicated GPIO is suitable +for faster response times required applications like simulate serial/parallel +interfaces in a bit-banging way. +After this option enabled GPIO4 and GPIO5 pins are ready to used as dedicated GPIO pins +as input/output mode. These pins are for example, you can use any pin up to 8 pins for +input and 8 pins for output for dedicated gpio. +To write and read data from dedicated gpio, you need to use +`write` and `read` calls. + +The following snippet demonstrates how to read/write to dedicated GPIO pins: + +.. code-block:: C + + int fd; = open("/dev/dedic_gpio0", O_RDWR); + int rd_val = 0; + int wr_mask = 0xffff; + int wr_val = 3; + + while(1) + { + write(fd, &wr_val, wr_mask); + if (wr_val == 0) + { + wr_val = 3; + } + else + { + wr_val = 0; + } + read(fd, &rd_val, sizeof(uint32_t)); + printf("rd_val: %d", rd_val); + } + i2c --- diff --git a/Documentation/platforms/xtensa/esp32s3/index.rst b/Documentation/platforms/xtensa/esp32s3/index.rst index cf397a261a..ca71cf5044 100644 --- a/Documentation/platforms/xtensa/esp32s3/index.rst +++ b/Documentation/platforms/xtensa/esp32s3/index.rst @@ -421,7 +421,7 @@ Camera No CAN/TWAI Yes DMA Yes eFuse Yes -GPIO Yes +GPIO Yes Dedicated GPIO supported I2C Yes Master and Slave mode supported I2S Yes LCD No