Drivers for EEPROM, FRAM and Flash chips

Discuss development of drivers for external hardware and components, such as LCD screens, sensors, motor drivers, etc.
Target audience: Users and developers of drivers.
User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Drivers for EEPROM, FRAM and Flash chips

Post by pythoncoder » Wed Jan 15, 2020 7:38 am

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.
Peter Hinch
Index to my micropython libraries.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Drivers for EEPROM, FRAM and Flash chips

Post by pythoncoder » Fri Feb 14, 2020 8:53 am

Thanks to a patch from Daniel Thompson the Flash driver now supports a wider range of NOR Flash chips.
Peter Hinch
Index to my micropython libraries.

User avatar
mcauser
Posts: 507
Joined: Mon Jun 15, 2015 8:03 am

Re: Drivers for EEPROM, FRAM and Flash chips

Post by mcauser » Mon Feb 17, 2020 6:19 am

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

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Drivers for EEPROM, FRAM and Flash chips

Post by pythoncoder » Tue Feb 18, 2020 1:50 pm

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.
Peter Hinch
Index to my micropython libraries.

User avatar
rcolistete
Posts: 352
Joined: Thu Dec 31, 2015 3:12 pm
Location: Brazil
Contact:

Re: Drivers for EEPROM, FRAM and Flash chips

Post by rcolistete » Wed Aug 26, 2020 3:33 am

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
My "MicroPython Samples". My "MicroPython Firmwares" with many options (double precision, ulab, etc).

User avatar
mcauser
Posts: 507
Joined: Mon Jun 15, 2015 8:03 am

Re: Drivers for EEPROM, FRAM and Flash chips

Post by mcauser » 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.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

New FRAM boards

Post by pythoncoder » Wed Aug 26, 2020 5:21 am

@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.
Peter Hinch
Index to my micropython libraries.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Drivers for EEPROM, FRAM and Flash chips

Post by pythoncoder » Mon Aug 31, 2020 7:35 am

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...
Peter Hinch
Index to my micropython libraries.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Drivers for new Adafruit FRAM boards

Post by pythoncoder » Fri Sep 04, 2020 5:51 pm

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.
Peter Hinch
Index to my micropython libraries.

User avatar
rcolistete
Posts: 352
Joined: Thu Dec 31, 2015 3:12 pm
Location: Brazil
Contact:

Re: Drivers for EEPROM, FRAM and Flash chips

Post by rcolistete » Sat Sep 05, 2020 1:41 am

Thanks !

How many Adafruit 256/512KiB SPI FRAM can be used as an array ?
My "MicroPython Samples". My "MicroPython Firmwares" with many options (double precision, ulab, etc).

Post Reply