acassis commented on code in PR #18951:
URL: https://github.com/apache/nuttx/pull/18951#discussion_r3295253768
##########
Documentation/platforms/sim/sim_ft2232h_gpio.rst:
##########
@@ -0,0 +1,218 @@
+=======================================
+Sim FT2232 GPIO Driver (Using libftdi1)
+=======================================
+
+Overview
+========
+
+The NuttX simulation (sim) already has a GPIO Chip driver that provides a
mechanism use GPIO to control external devices. However that solution depends
on having a driver to Linux side and that adds more overhead.
+
+This FT2232H driver allows a direct use of libftdi1 to control up to 8 GPIOs.
+
+This driver is particularly useful for:
+
+- Testing GPIO-based applications in a simulated environment with real hardware
+- Interfacing with USB-to-GPIO adapters from NuttX simulation
+- Developing and debugging GPIO drivers without dedicated embedded hardware
+
+Host Prepare
+============
+
+Preparation required on the host side:
+
+- Hardware module required: FT2232H module like the CJMCU-2232HL module
+- A udev rule on Linux side to avoid using the FT2232H as USB/Serial:
+
+.. code-block:: console
+
+ $ cat /etc/udev/rules.d/99-ft2232h-d2xx.rules
+ ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6010", ATTRS{product}=="FTDI
Device", MODE="0666"
+
+- The libftdi1-dev installed on your system.
+
+Architecture
+============
+
+The driver consists of two layers:
+
+1. **NuttX Layer** (``sim_ft2232h_ioexpander.c``): Implements the NuttX
``ioexpander_dev_s``
+ interface, providing standard GPIO operations to upper-layer NuttX drivers.
+
+2. **Host Layer** (``sim_ft2232h.c``): Interfaces directly with libftdio1 to
initialize and to provide the functions to control the GPIOs.
+
+::
+
+ +---------------------+
+ | NuttX Application |
+ +---------------------+
+ |
+ v
+ +---------------------+
+ | GPIO Lower Half |
+ | (gpio_lower_half) |
+ +---------------------+
+ |
+ v
+ +---------------------+
+ | sim_ft2232h_ioex...c| <-- NuttX ioexpander interface
+ | (ioexpander_dev_s) |
+ +---------------------+
+ |
+ v
+ +---------------------+
+ | sim_ft2232h.c | <-- Linux host GPIO interface
+ | (host interface) |
+ +---------------------+
+ |
+ v
+ +---------------------+
+ | libftdi1 | <-- Linux library to control FT2232H
+ +---------------------+
Review Comment:
Good suggestion! Done!
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]