From 295a10396508de0bb1e0cf67327bea2e2a7eeea9 Mon Sep 17 00:00:00 2001 From: Peter Hinch Date: Sat, 19 Feb 2022 09:56:47 +0000 Subject: [PATCH] Add 25LC512 support, make eep_spi.py more self-explanatory. --- README.md | 6 ++++++ eeprom/spi/eep_spi.py | 10 +++++++++- eeprom/spi/eeprom_spi.py | 8 ++++---- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 5ea69f2..ca3e1c7 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,7 @@ In the table below the Interface column includes page size in bytes. | Various | Various | SPI 4096 | <=32MiB | Flash | [FLASH.md](./flash/FLASH.md) | | STM | M95M02-DR | SPI 256 | 256KiB | EEPROM | [SPI.md](./eeprom/spi/SPI.md) | | Microchip | 25xx1024 | SPI 256 | 128KiB | EEPROM | [SPI.md](./eeprom/spi/SPI.md) | +| Microchip | 25xx512* | SPI 256 | 64KiB | EEPROM | [SPI.md](./eeprom/spi/SPI.md) | | Microchip | 24xx512 | I2C 128 | 64KiB | EEPROM | [I2C.md](./eeprom/i2c/I2C.md) | | Microchip | 24xx256 | I2C 128 | 32KiB | EEPROM | [I2C.md](./eeprom/i2c/I2C.md) | | Microchip | 24xx128 | I2C 128 | 16KiB | EEPROM | [I2C.md](./eeprom/i2c/I2C.md) | @@ -76,6 +77,7 @@ In the table below the Interface column includes page size in bytes. | Adafruit | 1895 | I2C n/a | 32KiB | FRAM | [FRAM.md](./fram/FRAM.md) | | Adafruit | 4677 | SPI n/a | 8MiB | SPIRAM | [SPIRAM.md](./spiram/SPIRAM.md) | +Parts marked * have been tested by users (see below). The SPIRAM chip is equivalent to Espressif ESP-PSRAM64H. The flash driver now has the capability to support a variety of chips. The @@ -88,6 +90,7 @@ following have been tested to date: | Cypress S25FL064L | 8 | | Winbond W25Q32JV | 4 | + It is likely that other chips with 4096 byte blocks will work but I am unlikely to be able to support hardware I don't possess. Users should check datasheets for compatibility. @@ -106,6 +109,9 @@ Winbond W25Q128JV Flash 128MiB tested by [mweber-bg](https://github.com/peterhinch/micropython_eeprom/issues/8#issuecomment-917603913). This requires setting `cmd5=False`. +Microchip 25LC512 SPI EEPROM 64KiB tested by +[ph1lj-6321](https://github.com/peterhinch/micropython_eeprom/issues/10). + ## 1.5 Performance FRAM and SPIRAM are truly byte-addressable: speed is limited only by the speed diff --git a/eeprom/spi/eep_spi.py b/eeprom/spi/eep_spi.py index f553b09..8bdb56b 100644 --- a/eeprom/spi/eep_spi.py +++ b/eeprom/spi/eep_spi.py @@ -1,7 +1,7 @@ # eep_spi.py MicroPython test program for Microchip SPI EEPROM devices. # Released under the MIT License (MIT). See LICENSE. -# Copyright (c) 2019 Peter Hinch +# Copyright (c) 2019-2022 Peter Hinch import uos import time @@ -149,3 +149,11 @@ def full_test(stm=False): print('Page {} readback failed.'.format(page)) break page += 1 + +test_str = """Available tests (see SPI.md): +test(stm=False) Basic hardware test. +full_test(stm=False) Thorough hardware test. +fstest(format=False, stm=False) Filesystem test (see doc). +cptest(stm=False) Copy files to filesystem (see doc). +""" +print(test_str) diff --git a/eeprom/spi/eeprom_spi.py b/eeprom/spi/eeprom_spi.py index 2675ec3..05198a9 100644 --- a/eeprom/spi/eeprom_spi.py +++ b/eeprom/spi/eeprom_spi.py @@ -1,8 +1,8 @@ -# eeprom_spi.py MicroPython driver for Microchip 128KiB SPI EEPROM device, -# also STM 256KiB chip. +# eeprom_spi.py MicroPython driver for EEPROM chips (see README.md for +# tested devices). # Released under the MIT License (MIT). See LICENSE. -# Copyright (c) 2019 Peter Hinch +# Copyright (c) 2019-2022 Peter Hinch import time from micropython import const @@ -29,7 +29,7 @@ class EEPROM(BlockDevice): def __init__(self, spi, cspins, size=128, verbose=True, block_size=9): # args: virtual block size in bits, no. of chips, bytes in each chip - if size not in (128, 256): + if size not in (64, 128, 256): print('Warning: possible unsupported chip. Size:', size) super().__init__(block_size, len(cspins), size * 1024) self._stm = size == 256