Skip to main content
Python package build status

SPI data flash device drivers (pure Python)

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

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

Supported SPI flash devices

Vendor

Atmel

Atmel

Macronix

SST

Winbond

Micron

Adesto

DataFlash

AT45

AT25

MX25L

SST25

W25Q

N25Q

AT25XE041B

Status

Tested

Tested

Tested

Tested

Tested

Tested

Tested

Sizes (MiB)

2,4

2,4,8

2,4,8,16

2,4

2,4

8

0.5

Read (KiB/s)

1278

1279

1329

642

1252

1315

1695

Write (KiB/s)

56

64

71

2

63

107

32

Erase (KiB/s)

60

63

31

500

60

84

28

Other supported SPI flash devices

Support for the following devices have also been added, but have not been tested by the maintainer:

  • Boya BY25QxxB

  • GigaDevice GD25QxxB

  • Spansion S25FL, S25FS

Notes about performances

  • Read operation is synchronous with SPI bus clock: it therefore only depends on the achievable frequency on the SPI 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 SPI and associated overhead.

  • Erase operation depends mostly on the flash device performance, whose fully depends on the flash device internal technology, as very few and short packets are exchanged over the SPI bus.

Supporting new flash devices of series ‘25’

Many flash devices support a common subset to for read/write/erase operations. Critical differences appear with lock and protection features, and with security features. An NDA is often required to obtain details about the advanced security features of these devices.

It should be nevertheless quite easy to add support for new flash device variants:

  • match method in the PyFtdi flash device API should be the first to look at to detect more compatible flash devices.

Supported SPI flash commands

Identification

The SPI device driver is automatically selected based on the detected SPI flash device

Read

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

Write

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

Erase

Erase SPI flash device blocks, whose size depend on the capabilities of the flash device, typically 4KiB and/or 64KiB.

Unlock

Unlock any protected flash device sectors

Dependencies

  • Python 3.9 or above is required.

  • PyFTDI 0.42 or above is required.

Note about previous releases

If you have no choice but using previous releases of Python (including Python 2.x) or PyFTDI , please checkout the latest PySpiFlash 0.4.1 which provides support for these deprecated environmement, but is no longer actively maintained.

PySpiFlash heavily relies on PyFtdi module to access the SPI flash device. The PyFtdi API has been changed several times, see the compatibility matrix below.

The setup.py script should take care of those dependencies.

PySpiFlash version

PyFtdi version

0.2.*

0.9 .. 0.10

0.3.*

0.11+

0.4.*

0.13.2+

0.5.*

0.20.0+

0.6.*

0.42.0+

Release files for pyspiflash 0.6.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for pyspiflash 0.6.5
File Interpreter ABI Platform
pyspiflash-0.6.5-py39-none-any.whl Python 3.9 none any Details

Release files / pyspiflash-0.6.5-py39-none-any.whl

Download URL pyspiflash-0.6.5-py39-none-any.whl
Size 17.3 kB
Tags Python 3.9
SHA-256 checksum
How to use checksums
4de2c5992e589f16fd7cd0822205ecb86c4113ef0c751e8d05f3679a17d8ec1d
BLAKE2b-256 checksum
How to use checksums
11ca3b31af82c49350f1cc66e81464a7027d3697c004cccbdaed8718245c1270
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 25, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.6.5 This release

1 release file

0.6.3

2 release files

0.6.2

2 release files

0.6.1

1 release file

0.6.0

1 release file

0.5.2

1 release file

0.4.0

1 release file

0.3.0

0.2.0

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page