Comments (6)
That's a pretty cool board!
I've been using this library for a while now, specifically to toggle GPIOs, program SPI flash chips and send data to and from my FPGA using the synchronous FIFOs. I would like to help you out but unfortunately I don't have the time to read through all the documentation for that board.
If any of your needs are related to anything above I can help out with an example or two.
from pyftdi.
I'm not sure what is a "generic FTDI device" here?
Could you provide the kind of FTDI device you use, and how they are reported on the USB bus? (vendor ID, product ID, ...)
from pyftdi.
@cospan, As you stated, that you use this lib for GPIO, may you be so kind to share a basic example about how to:
- Configure the CBUS0&1 to be output and CBUS2&3 to be input (as GPIO)
- demo program to write CBUS0 to 'zero', CBUS1 to 'one'.
- demo program to read CBUS2&3.
This would be very helpful for me!
Thanks in advance,
Karel.
from pyftdi.
Here's a simple python module and command line tool I wrote to control GPIOs for a FT2232H on one of my boards.
https://github.com/CospanDesign/python/tree/master/ftdi/gpio
There are two files:
gpio_controller.py: Python module that controls GPIOs
ftdi-gpio: Command Line Interface to test things out.
Currently the default setting is for my board, it has a custom product ID of 8350, I don't remember what the default product ID is bu it would be good to change the default settings to it (I think it's 0603??)
The 'interface' value specifies the 'bank', since the FT2232H has two 'banks' and the GPIOs for my device is on the 2nd bank then I put the default interface value as 2
The CLI looks like this:
usage: ftdi-gpio [-h] [--vendor VENDOR] [--product PRODUCT]
[--interface INTERFACE] [-b WRBIT] [-m WRMASK] [-t RDBIT]
[-s DIRMASK] [-v VALUE] [-d]
Read and Write GPIOs with FTDI chip
Default Behavior is to read the GPIOs from the specified interface
usage: ftdi-gpio [options]
optional arguments:
-h, --help show this help message and exit
--vendor VENDOR Specify USB Vendor ID (Default: 0403)
--product PRODUCT Specify USB Product ID (Default: 8530)
--interface INTERFACE
Specify USB Interface (Default: 2)
-b WRBIT, --wrbit WRBIT
Specify the bit to set (Example: 6)
-m WRMASK, --wrmask WRMASK
Specify a bitmask value to write (Example: 0x40)
-t RDBIT, --rdbit RDBIT
Read back the mask and compare it with index (Example:
40)
-s DIRMASK, --dirmask DIRMASK
Configure bit mask of the chip, will be default the
values associated with output
-v VALUE, --value VALUE
For write set this to 1 or 0 for high or low
-d, --debug Enable Debug Messages
Examples:
Something
Examples
Example: Reading all the GPIO for the lower section of the second bank:
$ ./ftdi-gpio
Pins: 0xFF
Example: Reading the value of one pin (bit 6), specifically a bit attached to a button:
Not Pressed (Button is high when not pressed)
$ ./ftdi-gpio --rdbit 6
Pins 6: True
Pins: 0xFF
Pressed
$ ./ftdi-gpio --rdbit 6
Pins 6: False
Pins: 0xBF
Example: Writing a one to another pin (bit 4), specifically the signal to reprogram my FPGA
Set GPIO 4 to an output and set that value high
$ ./ftdi-gpio --wrbit 4 --value 1
Pins: 0xFF
Set GPIO 4 to an output and set that output low
$ ./ftdi-gpio --wrbit 4 --value 0
Pins: 0xEF
Example: Explicitly declaring vendor id, product id and interface and then reading all the GPIOs
$ ./ftdi-gpio --vendor 0403 --product 8530 --interface 2
Pins: 0xFF
from pyftdi.
Sorry, I had no HW to test GPIO for a while (and provide examples) but I should definitely work on this long-lasting issue.
from pyftdi.
The latest version of PyFtdi (0.13.2) comes with GPIO examples. Hope this help.
from pyftdi.
Related Issues (20)
- LSB first with MPSSE SPI? HOT 2
- Retry issue with SPI reads HOT 5
- 0.54.0: Deprecated setuptools functionality in use, will break on 2023-10-30 HOT 3
- 0.55 Operation not supported or unimplemented on this platform (FT4232HA) Windows HOT 1
- 0.54.0 FT230x EEPROM API inaccuracies HOT 2
- 0.55.0 not on pypi.org HOT 3
- Low baudrates doesn't work with bit-banging.
- How to enable TXDEN on FT4232H?
- Intermittent errors when accessing FTDI HOT 5
- Specification issue in I2cController.exchange(self, out, readlen, relax, start)
- Timeout behaviour of read method not compatible with pyserial HOT 1
- clearing eeprom
- Unable to configure EEPROM: EEPROM does not support mirroring HOT 1
- UART lock up with FT4232H HOT 1
- GPIO state reset when opening device
- Error in class I2CBusScanner logic - if read success, skips write test HOT 1
- "Error: No backend available" during Mac OS instllation. HOT 1
- in_waiting and out_waiting in pyftdi/serialext/protocol_ftdi.py not implemented but return always 0 HOT 2
- Incorrect results when reading i2c with clock stretching
- No such device / 4 USB devices match URL 'ftdi:///2' HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyftdi.