Skip to main content

SPI data flash device drivers (pure Python)

Project description

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

DataFlash

AT45

AT25

MX25L

SST25

W25Q

N25Q

Status

Tested

Tested

Tested

Tested

Tested

Tested

Sizes (MiB)

2,4

2,4,8

2,4,8,16

2,4

2,4

8

Read (KiB/s)

1278

1279

1329

642

1252

1315

Write (KiB/s)

56

64

71

2

63

107

Erase (KiB/s)

60

63

31

500

60

84

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.5 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+

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

pyspiflash-0.6.3.tar.gz (16.0 kB view details)

Uploaded Source

Built Distribution

pyspiflash-0.6.3-py35-none-any.whl (16.3 kB view details)

Uploaded Python 3.5

File details

Details for the file pyspiflash-0.6.3.tar.gz.

File metadata

  • Download URL: pyspiflash-0.6.3.tar.gz
  • Upload date:
  • Size: 16.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/46.0.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.7.7

File hashes

Hashes for pyspiflash-0.6.3.tar.gz
Algorithm Hash digest
SHA256 ec56867d4ef50e02484d5c472898af592475b7e17824a706585a5b5271e0d645
MD5 5bf232970c2dcbea9272f82484edde50
BLAKE2b-256 04cd4a2d4985bf38a434f571e8947410bf0a284da5bb117e54cec1d7e45989c0

See more details on using hashes here.

File details

Details for the file pyspiflash-0.6.3-py35-none-any.whl.

File metadata

  • Download URL: pyspiflash-0.6.3-py35-none-any.whl
  • Upload date:
  • Size: 16.3 kB
  • Tags: Python 3.5
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/46.0.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.7.7

File hashes

Hashes for pyspiflash-0.6.3-py35-none-any.whl
Algorithm Hash digest
SHA256 09ada942036084eb534c70f56f1e24f29de5a13c2954bce7a368e123f2988ab4
MD5 97add62f5ab39f815893a9bfe3fb6eab
BLAKE2b-256 ff7467ed99f2f50256b6fc9990a98fc00c7225a0b8569733c960ce2443bb6278

See more details on using hashes here.

Supported by

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