Main Site Documentation

Memory limit on USBizi144 for SPI or I2C FLASH ICs


May sound as a dumb question, but is the SPI or I2C FLASH ICs interaction with microcontroller limited by the amount of RAM available for reading / writing the EEPROM page blocks? Since the EEPROMs are divided into 8 page blocks I guess I have to read the full block into microprocessor’s memory, then change the data and write it back if I need. Do I think right?

If the EEPROM is 1Mbit divided into 128 Kbit blocks I can R/W it since 128 Kb is 16KB, but if the EEPROM IS 8 Mb with 1Mb blocks (128KB) I will get memory runout exception. Right?

Orrrr, the amount of EEPROM is not limited and I can access it by register address and manipulate as little as 8 bit at a time?


I think I understand what you mean.

You want to know if you MUST manipulate the entire eeprom at once or if you can manipulate it in smaller chunks.

Given that SPI and I2C are usually byte-based transfers, you can break the entire eeprom into chunks and deal with each one individually.

If you check your datasheet you might find you get benefit from doing it in page-size chunks.


This it sort of a compound question.

Your question relates to Erase Block Size. Most EE have an erase block size of 1 byte, but some, especially SPI, has bigger erase block sizes. If the erase block size is bigger than one byte then you must read the whole block, modify it, and write it back.

The Pages you are referring to is generally only related to “multi-byte” writes. If you start writing at the beginning of the page then you can just keep sending bytes, up to the page size, and they will be written as expected. If you start writing in the middle of a page and you try to cross a page boundary, into another page, then the writing will roll over to the start of the current page. Thus writing 64 bytes to an EE with 16 byte pages will write the first 16 bytes then roll over to the start of the page and overwrite those 16 bytes with the next 16 bytes etc…

Looking at the spec of an 24AA1025:
It says that 128 bytes(one page) are written at a time. But if you write only one byte then, internally, it will do the ReadPage/Modify/ErasePage/WritePage. Thus it is better to arrange your data as to write as much as possible at one time.


[quote]If the master should
transmit more than 128 bytes prior to generating the
Stop condition, the address counter will roll over and
the previously received data will be overwritten[/quote]


Thank you guys. It is not that as I assumed. So, as I understand, I can use even 16 Mbit EEPROM with any .NETMF mictocontroller. Nice.


of course, the limit is how much data you can generate within your app. If for instance you have static data that you want to write to the eeprom, then you’re more likely to be limited by program space; but if it’s sensor data for instance, then yep you have a LOT of room :slight_smile: