Python library with high-level functions to interact with specific ICs using Bus Pirate
Project description
hackPyrateBus
hackPyrateBus
is a Python library that provides high-level functions to interact with specific integrated circuits using the Bus Pirate.
This library takes into account the particularities of the integrated circuits it interacts with.
This project is built on top of pyBusPirateLite, and we would like to give credit to the original authors and contributors of pyBusPirateLite and pyBusPirate.
NOTE: the pyBusPirateLite dependency is vendored from https://github.com/julianvilas/pyBusPirateLite/tree/new for convenience, as the original project does not seem to be maintained and it is not available in PyPI neither.
The new
branch in that fork contains commits not available in the original upstream, while master
matches exactly the upstream (as of today).
Installation
From the root of the cloned repo you can install hackPyrateBus
running:
# from the root of the cloned repo
virtualenv venv
source venv/bin/activate
pip install .
Directly From GitHub Releases:
# from anywhere
virtualenv venv
source venv/bin/activate
# latest release
url=$(curl --silent "https://api.github.com/repos/julianvilas/hackPyrateBus/releases/latest" | jq -r .assets[0].browser_download_url)
pip install --upgrade $url
Usage
AT24C128/256
Device particularities:
- 16,384/32,768 bytes capacity (
AT24C128
/AT24C256
respectively) organized as 256/512 64-bytes pages - Device address range [
0x50
:0x54
] (default0x50
), plus a LSB R/W bit (0 write, 1 read) - Page write mode rolls over when more than 64 bytes are written
- Sequential read with data address auto-increment
- Reading from a concrete data address requires a previous dummy-write
Initialize with default values
from hackPyrateBus.AT24CXXX import AT24CXXX
at24c = AT24CXXX()
at24c.speed = '50kHz'
at24c.configure(power=True, pullup=True) # do not enable pullup when using external pullup resistors
Default values:
- Auto-detect and auto-connect to Bus Pirate port
- 115200 bps serial communication speed with Bus Pirate
- 1s timeout to ensure full EEPROM can be read/written in a single call
256
model0x50
device address
Read the first 15 bytes from the EEPROM
at24c.load(0x0000, 15)
- Performs dummy-write + sequential read using Bus Pirate Write then read I2C method
- Auto-handles reads of more than 4096 bytes (Bus Pirate buffer size)
Store data from the 100 position of the EEPROM
at24c.store(100, b'\x00Hello, world!\xff')
- Performs page write using Bus Pirate Write then read I2C method
- Auto-handles writes of more than 64 bytes (page size) to avoid roll-over
Reset Bus Pirate
at24c.hw_reset()
Dependencies
This project uses the following open source packages:
- pyBusPirateLite (GPLv3)
License
hackPyrateBus
is licensed under the GNU General Public License v3 (GPLv3). The full text of the license can be found in the LICENSE file.
The pyBusPirateLite project, from which this project is derived, is also licensed under the GPLv3. We would like to thank the authors and contributors of pyBusPirateLite for their work.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file hackpyratebus-0.0.6.tar.gz
.
File metadata
- Download URL: hackpyratebus-0.0.6.tar.gz
- Upload date:
- Size: 32.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 432234b3202e14b1f96665adc7502b7bf63940d0cb5f8e185906a2f6337678a1 |
|
MD5 | 188c671f9436ff75118f459e0fff1ca4 |
|
BLAKE2b-256 | 42bc175ab5045c59079384f5500975b5a642a8ccba375046de1c31b5cf3cf8fe |
File details
Details for the file hackPyrateBus-0.0.6-py3-none-any.whl
.
File metadata
- Download URL: hackPyrateBus-0.0.6-py3-none-any.whl
- Upload date:
- Size: 43.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd7a97139684c086297044af4bf165d1b496f6a3acc34601ff01952e9b6029ff |
|
MD5 | 1587e9db6dd4a638fb0bf898e6ceca39 |
|
BLAKE2b-256 | 0e707dd44e7d434180c8483c124f78f561c52ce81646764db37f47b910cde4ea |