- 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.
Drivers for EEPROM, FRAM and Flash chips
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Drivers for EEPROM, FRAM and Flash chips
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:
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: Drivers for EEPROM, FRAM and Flash chips
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.
Index to my micropython libraries.
Re: Drivers for EEPROM, FRAM and Flash chips
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
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
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: Drivers for EEPROM, FRAM and Flash chips
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.
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.
Index to my micropython libraries.
- rcolistete
- Posts: 352
- Joined: Thu Dec 31, 2015 3:12 pm
- Location: Brazil
- Contact:
Re: Drivers for EEPROM, FRAM and Flash chips
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
- 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).
Re: Drivers for EEPROM, FRAM and Flash chips
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.
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
New FRAM boards
@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.
@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.
Index to my micropython libraries.
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: Drivers for EEPROM, FRAM and Flash chips
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...mcauser wrote: ↑Wed Aug 26, 2020 4:39 amOne 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.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Drivers for new Adafruit FRAM boards
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.
Index to my micropython libraries.
- rcolistete
- Posts: 352
- Joined: Thu Dec 31, 2015 3:12 pm
- Location: Brazil
- Contact:
Re: Drivers for EEPROM, FRAM and Flash chips
Thanks !
How many Adafruit 256/512KiB SPI FRAM can be used as an array ?
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).