eren-terzioglu opened a new pull request, #16223: URL: https://github.com/apache/nuttx/pull/16223
## Summary Add dedicated gpio support to control pins with faster response time and control multiple pins at the same time to applications requires faster response time (.e.g SPI bitbang) * arch/xtensa: Update common layer version for esp32s3 * Documentation/xtensa: Add dedicated GPIO docs for esp32[-s2|-s3] * Documentation/risc-v: Add dedicated GPIO documentation for esp32[-c3|-c6|-h2] * boards/xtensa: Add dedicated GPIO board level support for esp32[-s2|-s3] * arch/xtensa: Add dedicated GPIO support for esp32[-s2|-s3] * boards/risc-v: Add dedicated GPIO board level support for esp32[-c3|-c6|-h2] * arch/risc-v: Add Dedicated GPIO support for esp32[c3|c6|h2] * drivers/gpio: Add bundle ioctl commands ## Impact Impact on user: No, new feature added Impact on build: No, old defconfigs can be used without any issue Impact on hardware: Yes, dedicated GPIO feature added Impact on documentation: Impact on security: No Impact on compatibility: No, it is compatible with old defconfigs ## Testing `esp32c6-devkitc:gpio`, `esp32s3-devkit:gpio` and `esp32s2-saola-1:gpio` config used with `CONFIG_ESPRESSIF_DEDICATED_GPIO` option enabled. ### Building <!-- Provide how to build the test for each SoC being tested --> Commands used for building: #### esp32c6 ``` make distclean && ./tools/configure.sh esp32c6-devkitc:gpio && kconfig-tweak -d NDEBUG; kconfig-tweak -e CONFIG_ESPRESSIF_DEDICATED_GPIO && make olddefconfig && make -j && make download ESPTOOL_PORT=/dev/ttyUSB0 ESPTOOL_BAUD=115200 ESPTOOL_BINDIR=../esp-bins ``` #### esp32s2 ``` make distclean && ./tools/configure.sh esp32s2-saola-1:gpio && kconfig-tweak -d NDEBUG; kconfig-tweak -e CONFIG_ESPRESSIF_DEDICATED_GPIO && make olddefconfig && make -j && make download ESPTOOL_PORT=/dev/ttyUSB0 ESPTOOL_BAUD=115200 ESPTOOL_BINDIR=../esp-bins ``` #### esp32s3 ``` make distclean && ./tools/configure.sh esp32s3-devkit:gpio && kconfig-tweak -d NDEBUG; kconfig-tweak -e CONFIG_ESPRESSIF_DEDICATED_GPIO && make olddefconfig && make -j && make download ESPTOOL_PORT=/dev/ttyUSB0 ESPTOOL_BAUD=115200 ESPTOOL_BINDIR=../esp-bins ``` Sample app I used: ``` #include <nuttx/config.h> #include <inttypes.h> #include <stdio.h> #include <fcntl.h> #include <unistd.h> #include <syslog.h> #include <sys/types.h> #include <sys/ioctl.h> #include <nuttx/ioexpander/gpio.h> #include <stdlib.h> #include <string.h> #include <errno.h> #include <debug.h> #define ESP_DEDIC_GPIO_PATH "/dev/gpio3" #define COUNT_LIMIT 5 int main(int argc, char *argv[]) { int fd; int count = 0; int rd_val = 0; struct gpio_bundle_wr_arg_s wr_arg = { 0 }; fd = open(ESP_DEDIC_GPIO_PATH, O_RDWR); wr_arg.mask = 0xffff; wr_arg.value = 1; while (count < COUNT_LIMIT) { ioctl(fd, GPIOC_BUNDLE_WR, &wr_arg); ioctl(fd, GPIOC_BUNDLE_RD, &rd_val); printf("Read value: %d\n", rd_val); wr_arg.value = !wr_arg.value; count++; usleep(1000000); } close(fd); return OK; } ``` ### Results <!-- Provide tests' results and runtime logs --> Output should look like this: ``` esp_dedic_gpio_bundle_write: Writing 1 with mask: 65535 esp_dedic_gpio_bundle_read: Reading int pin... Read value: 1 esp_dedic_gpio_bundle_write: Writing 0 with mask: 65535 esp_dedic_gpio_bundle_read: Reading int pin... Read value: 0 esp_dedic_gpio_bundle_write: Writing 1 with mask: 65535 esp_dedic_gpio_bundle_read: Reading int pin... Read value: 1 esp_dedic_gpio_bundle_write: Writing 0 with mask: 65535 esp_dedic_gpio_bundle_read: Reading int pin... Read value: 0 esp_dedic_gpio_bundle_write: Writing 1 with mask: 65535 esp_dedic_gpio_bundle_read: Reading int pin... Read value: 1 nsh> ``` I tested blink test without any delay and these are the results #### C6 results with using POSIX calls | Freq\Number of GPIO's | 1 | 2 | |--------------------------------|-----------|-----------| | Dedicated GPIO Blink Freq(khz) | 285 - 290 | 285 | | Normal GPIO Blink Freq(khz) | 240 | 120 - 123 | #### S3 results with using POSIX calls | Freq\Number of GPIO's | 1 | 2 | |--------------------------------|-----------|-----------| | Dedicated GPIO Blink Freq(khz) | 475 | 475 | | Normal GPIO Blink Freq(khz) | 421 | 210 | #### S3 results with using arch calls (esp32s3_gpiowrite, ...) | Freq\Number of GPIO's | 1 | 2 | |--------------------------------|-----------|-----------| | Dedicated GPIO Blink Freq(khz) | 5300 | 5300 | | Normal GPIO Blink Freq(khz) | 4000 | 2000 | -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org