Skip to content

Python library that provides high-level functions to interact with specific integrated circuits using the Bus Pirate

License

Notifications You must be signed in to change notification settings

julianvilas/hackPyrateBus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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). How to use the module directly.

Installation

From PyPI:

virtualenv venv
source venv/bin/activate

pip install hackPyrateBus

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

Datasheet

Device particularities:

  • 16,384/32,768 bytes capacity (AT24C128/AT24C256 respectively) organized as 256/512 64-bytes pages
  • Device address range [0x50:0x54] (default 0x50), 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 model
  • 0x50 device address

Read the first 15 bytes from the EEPROM

at24c.load(0x0000, 15)

Store data from the 100 position of the EEPROM

at24c.store(100, b'\x00Hello, world!\xff')

Reset Bus Pirate

at24c.hw_reset()

pyBusPirateLite users

As previously mentioned pyBusPirateLite is vendored in this repo. To directly use that module, just import vendor.pyBusPirateLite.

Usage example:

from vendor.pyBusPirateLite.I2C import I2C

Dependencies

This project uses the following open source packages:

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.

About

Python library that provides high-level functions to interact with specific integrated circuits using the Bus Pirate

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages