Page 1 of 2

Drivers for EEPROM, FRAM and Flash chips

Posted: Wed Jan 15, 2020 7:38 am
by pythoncoder
I have written this set of drivers for various chips which use I2C or SPI interfaces. The drivers use common base classes to provide the following features:
  • Support for single or multiple chips on the same bus. Multiple chips are automatically configured as a single array.
  • This can be accessed as an array of bytes, using Python slice syntax or via a readwrite method.
  • Alternatively the array can be formatted and mounted as a filesystem using methods in the uos module. Any filesystem supported by the MicroPython build may be employed: FAT and littlefs have been tested. The latter is recommended.
  • Drivers are portable: buses and pins should be instantiated using the machine module.
  • Buses may be shared with other hardware.

Re: Drivers for EEPROM, FRAM and Flash chips

Posted: Fri Feb 14, 2020 8:53 am
by pythoncoder
Thanks to a patch from Daniel Thompson the Flash driver now supports a wider range of NOR Flash chips.

Re: Drivers for EEPROM, FRAM and Flash chips

Posted: Mon Feb 17, 2020 6:19 am
by mcauser
I have a bunch of old chips to test against:

EEPROM
AT24C01A 1K I2C DIP8
AT24C02N 2K I2C DIP8
AT24C04A 4K I2C DIP8
AT24C08 8K I2C DIP8
AT24C16 16K I2C DIP8
AT24C32A 32K I2C DIP8
AT24C64N 64K I2C DIP8
AT24C128 128K I2C DIP8
AT24C256 256K I2C DIP8
ST24C16CB1 16K I2C DIP8
24LC512 512K I2C DIP8
P24C256 256K I2C DIP8
SLA24C04D 4K I2C DIP8
93C46 1K SPI DIP8

Flash
W25Q32 32M SPI module
W25Q64 64M SPI module
W25Q128 128M SPI module

Re: Drivers for EEPROM, FRAM and Flash chips

Posted: Tue Feb 18, 2020 1:50 pm
by pythoncoder
Re EEPROMs I don't know how much interface commonality exists between the chips on your list and those I tested. The EEPROM driver currently assumes a block size of 128 bytes which would rule out some, although I could make block size configurable. Assessing compatibility would need a trawl through datasheets.

Flash chips are a different matter.

Evidently many devices have a high degree of standardisation so it would be interesting to try the flash chips. The W25Q32 has already been tested, but the other two have not. If you fancy giving them a try I'll put the results into the docs. On the face of it there's a good chance they will be compatible; the equivalent sized Cypress chips are fine.

Re: Drivers for EEPROM, FRAM and Flash chips

Posted: Wed Aug 26, 2020 3:33 am
by rcolistete
New FRAM boards from Adafruit :
- Adafruit SPI Non-Volatile FRAM Breakout - 4 Mbit / 512 KBytes - MB85RS4MT, PRODUCT ID: 4719, US$17.95 :
https://www.adafruit.com/product/4719
- Adafruit SPI Non-Volatile FRAM Breakout - 2 Mbit / 256 KBytes - MB85RS2MTA, PRODUCT ID: 4718, US$12.95 :
https://www.adafruit.com/product/4718

Re: Drivers for EEPROM, FRAM and Flash chips

Posted: Wed Aug 26, 2020 4:39 am
by mcauser
One thing to watch out for when comparing FRAM with SPI Flash is that with FRAM, reads are destructive, and with Flash there's almost unlimited reads but write/erase cycles are limited. The limits may be well beyond the lifetime of your app, but worth a quick investigation.

New FRAM boards

Posted: Wed Aug 26, 2020 5:21 am
by pythoncoder
@mcauser Fair point, but endurance is 10**13 cycles per byte. About 80 years of reading the same location at 10KHz.

@rcolistete Thanks for pointing that out: a properly useful size at last. I'll get those when they become available here and update my driver which should be easy.

Re: Drivers for EEPROM, FRAM and Flash chips

Posted: Mon Aug 31, 2020 7:35 am
by pythoncoder
mcauser wrote:
Wed Aug 26, 2020 4:39 am
One thing to watch out for when comparing FRAM with SPI Flash is that with FRAM, reads are destructive, and with Flash there's almost unlimited reads but write/erase cycles are limited. The limits may be well beyond the lifetime of your app, but worth a quick investigation.
On the other hand Flash works by storing a charge in a capacitor, which gradually leaks away. Hence Flash storage time is finite - although again, probably longer than the lifetime of the app. From the W25Q32JV datasheet: "More than 20-year data retention". That said, I have an application in daily use that I wrote 30 years ago...

Drivers for new Adafruit FRAM boards

Posted: Fri Sep 04, 2020 5:51 pm
by pythoncoder
This repo now includes an SPI FRAM driver for the Adafruit 512KiB and 256KiB FRAM boards. As per the other drivers, one or more boards can be configured as a single array. This may then be accessed as a large array of bytes. Alternatively a littlefs filesystem can be created on the array.

Re: Drivers for EEPROM, FRAM and Flash chips

Posted: Sat Sep 05, 2020 1:41 am
by rcolistete
Thanks !

How many Adafruit 256/512KiB SPI FRAM can be used as an array ?