pyftdi-bitbang
Bit-bang protocol support for PyFtdi.
This package adds SPI protocol support for FT232 devices without MPSSE (e.g. FT232RL) by using the bit-bang mode based on asynchronous or synchronous GPIO driver.
Usage
Refer to tests/ for code examples.
The library supports the following baud rates:
- in async mode: 57600..921600; only standard baud rates can be used (115200, 230400, etc.)
- in sync mode: 500..2000000; try to stick with "even" rates (aligned to thousands)
SPI
The library provides a subclass of SpiController called BitBangSpiController
which can be used as a drop-in replacement. It doesn't support features like CPOL/CPHA
but should be enough for most applications.
Creating the object requires a GPIO controller: GpioAsyncController for fully software-driven
bit writing, or GpioSyncController to use a (much faster) transaction-based GPIO control.
Example of reading SPI flash ID:
from pyftdi.gpio import GpioSyncController
from pyftdibb.spi import BitBangSpiController
gpio = GpioSyncController()
spi = BitBangSpiController(gpio=gpio)
spi.configure("ftdi:///1", frequency=1_000_000)
port = spi.get_port(cs=0)
# half-duplex mode
flash_id = port.exchange(b"\x9F", readlen=3, duplex=False)
# full-duplex mode (no benefit here, just an example)
flash_id = port.exchange(b"\x9F", readlen=4, duplex=True)
flash_id = flash_id[1:]
Example usage with PySpiFlash:
from pyftdi.gpio import GpioSyncController
from pyftdibb.spi import BitBangSpiController
from spiflash.serialflash import SerialFlashManager
gpio = GpioSyncController()
spi = BitBangSpiController(gpio=gpio)
spi.configure("ftdi:///1", frequency=1_000_000)
flash = SerialFlashManager.get_from_controller(spi)
data = flash.read(0, 0x1000)
License
MIT
Metadata
Release files for pyftdi-bitbang 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pyftdi_bitbang-1.0.0.tar.gz | 5.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyftdi_bitbang-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.3 kB
Release files / pyftdi_bitbang-1.0.0.tar.gz
| Download URL | pyftdi_bitbang-1.0.0.tar.gz |
|---|---|
| Size | 5.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4473124d934009160a803636f326615e5b8a6f45ef25d989ccd12db39fd56ab3
|
|
BLAKE2b-256 checksum How to use checksums |
871b3716ac9b0c8103cf40034ad9ce0afe98e3eeaf79fdba9a7fe06b9503d166
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.10.13 Linux/6.2.0-1016-azure
|
Release files / pyftdi_bitbang-1.0.0-py3-none-any.whl
| Download URL | pyftdi_bitbang-1.0.0-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f25f8b8c0105f9e754e25a3781afaab4f59e76b665a15556b9593bb24e6a0044
|
|
BLAKE2b-256 checksum How to use checksums |
65c22c5958470a13bd45dd502f2c92883494af92882f5cef9a86cedd655046eb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.10.13 Linux/6.2.0-1016-azure
|
Security for pyftdi-bitbang 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.