Skip to content

Add FTDI bit-bang GPIO output support#1931

Open
ozan956 wants to merge 5 commits into
labgrid-project:masterfrom
ozan956:driver/ftdi-bit-bang
Open

Add FTDI bit-bang GPIO output support#1931
ozan956 wants to merge 5 commits into
labgrid-project:masterfrom
ozan956:driver/ftdi-bit-bang

Conversation

@ozan956

@ozan956 ozan956 commented Jul 13, 2026

Copy link
Copy Markdown

This adds FTDIGPIO resource, an FTDIGPIODriver, and a small USB agent. The feature is intended for boards where FTDI data-bus pins are used as simple digital outputs, for example to control straps, enables, reset-like signals, or other board control lines during tests.

This targets FTDI asynchronous bit-bang GPIO on the data bus pins. It does not target CBUS GPIO, EEPROM-configured ACBUS functions, or generic MPSSE GPIO.

Supported devices are:

  • FT2232-style devices, 0403:6010, interfaces 1..2
  • FT4232H, 0403:6011, interfaces 1..4
  • FT232H, 0403:6014, interface 1

Each interface exposes an independent 8-bit data bus. index selects bit 0..7 on that interface.

For writes, the agent first reads the current pin byte, modifies only the requested bit, and writes the byte back. This avoids unintentionally changing other bits on the same FTDI interface. get() reads the current level of the configured output line.

I also would like to support input pins with direction feature of those chips in future, so #1458 would be very helpful.

I tested the driver with a FT232H device (0403:6014).

Checklist

  • Documentation for the feature
  • Tests for the feature
  • The arguments and description in doc/configuration.rst have been updated
  • Add a section on how to use the feature to doc/usage.rst
  • Add a section on how to use the feature to doc/development.rst
  • PR has been tested
  • Man pages have been regenerated

@codecov

codecov Bot commented Jul 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.49239% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 61.7%. Comparing base (64723a5) to head (5ba2f44).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
labgrid/driver/ftdigpiodriver.py 98.4% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           master   #1931     +/-   ##
========================================
+ Coverage    61.0%   61.7%   +0.6%     
========================================
  Files         182     184      +2     
  Lines       14881   15077    +196     
========================================
+ Hits         9083    9308    +225     
+ Misses       5798    5769     -29     
Flag Coverage Δ
3.10 61.6% <99.4%> (+0.6%) ⬆️
3.11 61.7% <99.4%> (+0.6%) ⬆️
3.12 61.6% <99.4%> (+0.6%) ⬆️
3.13 61.6% <99.4%> (+0.6%) ⬆️
3.14 61.6% <99.4%> (+0.6%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

Add local and remote resources for FTDI data-bus GPIO lines exposed
through asynchronous bit-bang mode.

The resource models one output-capable bit on a selected FTDI
interface and exports the USB identity, interface, index, and inversion
metadata needed by the driver.

Signed-off-by: Ozan Durgut <ozan.durgut@analog.com>
@ozan956
ozan956 force-pushed the driver/ftdi-bit-bang branch from 7399617 to b99030c Compare July 13, 2026 11:30
ozan956 added 4 commits July 14, 2026 12:46
Add FTDIGPIODriver and a labgrid agent for FTDI asynchronous bit-bang
GPIO outputs. The agent opens the selected USB interface per operation,
sets async bit-bang mode with the data bus configured as output, reads
the current pin byte, and writes back only the requested bit change.

Signed-off-by: Ozan Durgut <ozan.durgut@analog.com>
Allow labgrid-client io to create an FTDIGPIODriver for acquired
NetworkFTDIGPIO resources.

Signed-off-by: Ozan Durgut <ozan.durgut@analog.com>
Cover FTDI GPIO resource validation, supported USB IDs, driver set/get
behavior, agent read-modify-write output handling, exporter parameters,
and labgrid-client io integration.

Signed-off-by: Ozan Durgut <ozan.durgut@analog.com>
Document FTDIGPIO and NetworkFTDIGPIO resources for FTDI asynchronous
bit-bang data-bus outputs.

Signed-off-by: Ozan Durgut <ozan.durgut@analog.com>
@ozan956
ozan956 force-pushed the driver/ftdi-bit-bang branch from b99030c to 5ba2f44 Compare July 14, 2026 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant