Giter VIP home page Giter VIP logo

pyi2cflash's Introduction

pyi2cflash

Python package build status

I2C eeprom device drivers (pure Python)

I2C flash devices, also known as DataFlash are commonly found in embedded products, to store firmware, microcode or configuration parameters.

PyI2CFlash comes with several pure Python drivers for those flash devices, that demonstrate use of I2C devices with PyFtdi. It could also be useful to dump flash contents or recover from a bricked devices.

Supported I2C flash devices

Vendor Microchip Microchip Microchip Microchip Microchip Microchip Microchip Microchip Microchip Microchip
EEPROM

24AA01

24AA02

24AA04

24AA08

24AA16

24AA32A

24AA64

24AA128

24AA256

24AA512

============== ========== ========== ========== ========== ========== ========== ========== ========== ========== ==========
Status

?

?

No

No

No

Ok

?

?

?

?

-------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----------
Size

128

256

512

1Ki

2Ki

4Ki

8Ki

16Ki

32Ki

64Ki

Notes about performances

  • Read operation is synchronous with I2C bus clock: it therefore only depends on the achievable frequency on the I2C bus, which is bound to the highest supported frequency of the flash device.
  • Write operation depends mostly on the flash device performance, whose upper limit comes mostly from the maximum write packet size of the device, as the device needs to be polled for completion after each packet: the shorter the packet, the higher traffic on the I2C and associated overhead.

Notes about 24AA32

This device is declared obsolete by the manufacturer and is not supported.

Only 24AA32A revision is supported.

Supported I2C flash commands

Read

Read byte sequences of any size, starting at any location from the I2C flash device

Write

Write arbitrary byte sequences of any size, starting at any location to the I2C flash device

Dependencies

  • Python 3.5 or above is required.
  • PyFtdi 0.42 or above is required.

pyi2cflash's People

Contributors

eblot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

epid thomskrtich

pyi2cflash's Issues

Regression - pyftdi package dependency fails

Hi,

I use py2cflash and pyspiflash for my project https://gitlab.com/expliot_framework/expliot
The installation is breaking now. I checked both pyi2cflash and pyspiflash. pyftdi version in setup.py INSTALL_REQUIRES recently changed and seems to be causing pyftdi installation failure. Tried in a fresh installation (new machine/first install). Can you please let me know if its something else?

Pipeline failure link here for gitlab jobs - https://gitlab.com/expliot_framework/expliot/-/jobs/361227107

Local machine Error here -
Error:
Installed /usr/local/lib/python3.7/dist-packages/expliot-0.6.0-py3.7.egg
Processing dependencies for expliot==0.6.0
Searching for pyftdi<0.50,>=0.42
Reading https://pypi.org/simple/pyftdi/
No local packages or working download links found for pyftdi<0.50,>=0.42
error: Could not find suitable distribution for Requirement.parse('pyftdi<0.50,>=0.42')

Kali OS details:
root@kali:~/workspace_expliot/expliot# uname -a
Linux kali 4.19.0-kali4-amd64 #1 SMP Debian 4.19.28-2kali1 (2019-03-18) x86_64 GNU/Linux

root@kali: ~/workspace_expliot/expliot# uname -srm
Linux 4.19.0-kali4-amd64 x86_64

root@kali: ~/workspace_expliot/expliot# lsb_release -a
No LSB modules are available.
Distributor ID: Kali
Description: Kali GNU/Linux Rolling
Release: 2019.4
Codename: kali-rolling
root@kali: ~/workspace_expliot/expliot# lsb_release -d
Description: Kali GNU/Linux Rolling

root@kali: ~/workspace_expliot/expliot# cat /etc/os-release
PRETTY_NAME="Kali GNU/Linux Rolling"
NAME="Kali GNU/Linux"
ID=kali
VERSION="2019.4"
VERSION_ID="2019.4"
VERSION_CODENAME="kali-rolling"
ID_LIKE=debian
ANSI_COLOR="1;31"
HOME_URL="https://www.kali.org/"
SUPPORT_URL="https://forums.kali.org/"
BUG_REPORT_URL="https://bugs.kali.org/"

Python resolver unable to resolve pyftdi version for pyi2cflash

Hi Emmnuel!
I'm a part of the EXPLIoT framework team - https://gitlab.com/expliot_framework/expliot
EXPLIoT depends on Pyspiflash and Pyi2cflash (and pyftdi)
After your latest release for both (Pyspiflash and Pyi2cflash), the installation of EXPLIoT (latest code) has started to fail because of pyftdi version conflict. The reason we figured out is that the python resolver is not able to resolve pyftdi version for pyi2cflash, given that it installs the latest version of pyftdi during the installation of pyspiflash (which happens before pyi2cflash)

  1. pyi2cflash v0.2.1 dependecy - 'pyftdi >= 0.42, < 0.50'
  2. pyspiflash v0.6.2 dependency - 'pyftdi >= 0.42, < 0.51'

Please note that manual installation of both the packages works fine

  1. First pyspiflash and then pyi2cflash
    Pip in this case resolves correctly to pyftdi version that satisfies both (Pyspiflash and Pyi2cflash) requirements

My OS: Ubuntu-18.04.4 (64 bit)

Solutions:

  1. It would be best if you can update both with the same pftdi version range dependencies until python/pip resolvers fix the issue.
  2. Temporary solution for us would be to use <0.6.2 pyspiflash dependency as we update our dependency versions in our setup.

We would prefer to have the latest version for both. Request you to kindly us know what you think

Please find below the error during EXPLIoT installation (latest code):

expliot@expliot-VirtualBox:~/expliot$` python3 setup.py install --user
/usr/lib/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'long_description_content_type'
warnings.warn(msg)
running install
running bdist_egg
running egg_info
creating expliot.egg-info
writing expliot.egg-info/PKG-INFO
writing dependency_links to expliot.egg-info/dependency_links.txt
writing entry points to expliot.egg-info/entry_points.txt
writing requirements to expliot.egg-info/requires.txt
...
...
creating build/lib/expliot/plugins
copying expliot/plugins/sample.py -> build/lib/expliot/plugins
copying expliot/plugins/init.py -> build/lib/expliot/plugins
creating build/lib/expliot/core
copying expliot/core/init.py -> build/lib/expliot/core
creating build/lib/expliot/plugins/modbus
...
...
...
Searching for pyspiflash>=0.5.2
Reading https://pypi.python.org/simple/pyspiflash/
Downloading https://files.pythonhosted.org/packages/68/ac/984b742c0f801e33f4217d5fc10bca157a3449e0e81274abe7ce42803925/pyspiflash-0.6.2-py35-none-any.whl#sha256=69424180089b09e0b7f93f3ee72dfa4b530d59e8269a0b79b5d74ff41df40d58
Best match: pyspiflash 0.6.2
Processing pyspiflash-0.6.2-py35-none-any.whl
Installing pyspiflash-0.6.2-py35-none-any.whl to /home/expliot/.local/lib/python3.6/site-packages
writing requirements to /home/expliot/.local/lib/python3.6/site-packages/pyspiflash-0.6.2-py3.6.egg/EGG-INFO/requires.txt
Adding pyspiflash 0.6.2 to easy-install.pth file

Installed /home/expliot/.local/lib/python3.6/site-packages/pyspiflash-0.6.2-py3.6.egg
...
...
...
...
Searching for pyi2cflash>=0.1.1
Reading https://pypi.python.org/simple/pyi2cflash/
Downloading https://files.pythonhosted.org/packages/02/1c/f3341501185853f09c2f111f4404a6b0d369e72fbd4aa05efb59f2757d01/pyi2cflash-0.2.1.tar.gz#sha256=d3ceffe100e14c07ca9f96e3c587c2d646b92f4d9196b42009e3486e6e6233c8
Best match: pyi2cflash 0.2.1
Processing pyi2cflash-0.2.1.tar.gz
Writing /tmp/easy_install-0mukflvg/pyi2cflash-0.2.1/setup.cfg
Running pyi2cflash-0.2.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-0mukflvg/pyi2cflash-0.2.1/egg-dist-tmp-svydql0t
zip_safe flag not set; analyzing archive contents...
Moving pyi2cflash-0.2.1-py3.6.egg to /home/expliot/.local/lib/python3.6/site-packages
Adding pyi2cflash 0.2.1 to easy-install.pth file

Installed /home/expliot/.local/lib/python3.6/site-packages/pyi2cflash-0.2.1-py3.6.egg
...
...
...
...

Searching for pyftdi<0.51,>=0.42
Reading https://pypi.python.org/simple/pyftdi/
Downloading https://files.pythonhosted.org/packages/df/d0/6907d46ef02d31a780956bc97a7516df0e8c624d8be68e92286f713b6059/pyftdi-0.50.2-py3-none-any.whl#sha256=b5fed2348db2b342218d1d6f789c692732ba7570fccafe0b56de0a31a2efb526
Best match: pyftdi 0.50.2
Processing pyftdi-0.50.2-py3-none-any.whl
Installing pyftdi-0.50.2-py3-none-any.whl to /home/expliot/.local/lib/python3.6/site-packages
writing requirements to /home/expliot/.local/lib/python3.6/site-packages/pyftdi-0.50.2-py3.6.egg/EGG-INFO/requires.txt
Adding pyftdi 0.50.2 to easy-install.pth file
Installing pyterm.py script to /home/expliot/.local/bin
Installing ftdi_urls.py script to /home/expliot/.local/bin
Installing i2cscan.py script to /home/expliot/.local/bin
Installing ftconf.py script to /home/expliot/.local/bin

Installed /home/expliot/.local/lib/python3.6/site-packages/pyftdi-0.50.2-py3.6.egg
Searching for pydicom>=1.2.1
Reading https://pypi.python.org/simple/pydicom/
Downloading https://files.pythonhosted.org/packages/53/e6/4cae2b4b2fdbea5e2ddd188361139606d8f10f710ba1abecd6600da099c3/pydicom-1.4.2-py2.py3-none-any.whl#sha256=f315ba2296346f4f9913c269618201e170b9326362e2ada6041ca91b7cb2117b
Best match: pydicom 1.4.2
Processing pydicom-1.4.2-py2.py3-none-any.whl
Installing pydicom-1.4.2-py2.py3-none-any.whl to /home/expliot/.local/lib/python3.6/site-packages
Adding pydicom 1.4.2 to easy-install.pth file

Installed /home/expliot/.local/lib/python3.6/site-packages/pydicom-1.4.2-py3.6.egg
error: pyftdi 0.50.2 is installed but pyftdi<0.50,>=0.42 is required by {'pyi2cflash'}

pip satisfies the requirement of pyftdi for both pyspiflash and pyi2cflash
Manual pip installation of pyspiflash and pyi2cflash see below:

expliot@expliot-VirtualBox:~$ sudo pip3 install pyspiflash
Collecting pyspiflash
Downloading https://files.pythonhosted.org/packages/68/ac/984b742c0f801e33f4217d5fc10bca157a3449e0e81274abe7ce42803925/pyspiflash-0.6.2-py35-none-any.whl
Collecting pyftdi<0.51,>=0.42 (from pyspiflash)
Downloading https://files.pythonhosted.org/packages/df/d0
...
Installing collected packages: pyusb, pyserial, pyftdi, pyspiflash
Running setup.py install for pyusb ... done
Successfully installed pyftdi-0.50.2 pyserial-3.4 pyspiflash-0.6.2 pyusb-1.0.2

expliot@expliot-VirtualBox:~$ sudo pip3 install pyi2cflash
Collecting pyi2cflash
Downloading https://files.pythonhosted.org/packages/02/1c/f3341501185853f09c2f111f4404a6b0d369e72fbd4aa05efb59f2757d01/pyi2cflash-0.2.1.tar.gz
Collecting pyftdi<0.50,>=0.42 (from pyi2cflash)
...
Installing collected packages: pyftdi, pyi2cflash
Found existing installation: pyftdi 0.50.2
Uninstalling pyftdi-0.50.2:
Successfully uninstalled pyftdi-0.50.2

Running setup.py install for pyi2cflash ... done
Successfully installed pyftdi-0.48.3 pyi2cflash-0.2.1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.