Skip to main content

Read/write i2c & spi memory chipsets (Flash & EEPROM)

Project description

Python Flash Reader

Flash Reader allows to read and/or write any EEPROM or Flash memory via SPI or I2C. This library is particularly useful in case of reverse engineering or prototyping for embedded systems (RPI, etc..).

from flashreader.memory import spiflash, m95, mx25, w25q, _24lc, _25lc, _25aa
from flashreader.platform import ft232h, raspberrypi

with ft232h.Platform() as platform: #Open FT232H adapter
    with spiflash.Memory(platform) as memory: #Open generic SPI flash
        print(f"Writing hello world @0x0000...")
        memory.write(0x0000, b'Hello World')

        buf = bytearray(memory.read(0x00000000, 11))
        print(f"Read @0x0000: {buf}")

Supported platform

Support memory

  • Various spi serial flash
  • Macronix mx25R..., mx25L...
  • Microchip 25aa..., 25lc...
  • Winbond w25q...
  • Microchip 24lc...
  • ST m95...

Quick start (Raspberry pi 4)

Setup Raspbian

apt-get install python3 python3-pip python3-spidev python3-monotonic
sudo raspi-config
  • Go to "Interfacing Options" > "SPI" > "Enable"
  • Reboot the RPI

Wiring

  • SPI: PIN19(MOSI), PIN21(MISO), PIN23(SCK), PIN11(CS)
  • I2C: PIN3(SDA), PIN5(SCL)

Quick start (Windows)

Setup Windows

  • Plug FT232H
  • Use Zadig (https://zadig.akeo.ie/), select the USB device in the list, select libusb-win32 and replace the driver (DO NOT USE WINUSB or any other driver).

Wiring

  • SPI: D0(SCK), D1(MOSI), D2(MISO), D3(CS)
  • I2C: D0(SCL), D1(SDA)

Run

Read spi flash (By using generic driver: spiflash)

python -m flashreader --platform raspberrypi --memory spiflash --read ./dump.bin --offset 0

Write spi flash (By using generic driver: spiflash)

python -m flashreader --platform raspberrypi --memory spiflash --write ./dump.bin --offset 0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flashreader-1.1.0.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flashreader-1.1.0-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file flashreader-1.1.0.tar.gz.

File metadata

  • Download URL: flashreader-1.1.0.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.1

File hashes

Hashes for flashreader-1.1.0.tar.gz
Algorithm Hash digest
SHA256 f7c1676f78ed53badc6fd819f9d6f1d271373ff3c7720d65b183eb1d0edc6890
MD5 3206f3acfb0fd208c1fa0d30448553ad
BLAKE2b-256 03464635a7f212068b59d90302e5ce16068ba7e99b906aadde4c6e2cc2fd0d54

See more details on using hashes here.

File details

Details for the file flashreader-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: flashreader-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.1

File hashes

Hashes for flashreader-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 22f32a0d442a2471cc5f6a6d34a593ce3b6d8c1fc48b787be7feea22bdeb5995
MD5 f879a08b1ee359f1db632cbd7d3b9eb1
BLAKE2b-256 a639fe1db13a8e3364c7c98823ac3eca734cd5ea2ee6008287fa3bb1ab999c0b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page