Memory (Part 3)

Part 1234567

chips

“Flock of eeprom chips ”

As mentioned before, EEPROM (Electrically Erasable Programmable Read Only Memory) is one type of memory which is very suitable for storing data on some occasion which would be read back as much as we like. As we deal with rather limited micro-controllers, we will skip the families of EEPROM chips which data are addressed in parallel mode. In this mode, 8 bits arranged memories require 8 pins from the micro-controller which is too much pins consuming even though the gain in speed is noticeable. Instead, we will look after chips which data is addressed in serial mode. Mainly two types of serial communication protocols are available: SPI and I2C. Both have there advantages and draw backs. My preference goes to SPI in spite of the highest number of pin required. In absolute, SPI is faster and I use this protocol a lot in my applications. So let’s go for the 25LC series of SPI EEPROM. Coming next after the 25LC chips are the 25AA chips. They differ from their supply voltages:

  • 25LCxxx: 2.5-5.5V
  • 25AAxxx: 1.8-5.5V

Within the 25LC family, some references are getting obsolete and Microchip suggests to use the A versions instead. In most cases, the A version (e.g. 25LC640A) operate at higher speeds. Care shall be taken at the B versions which have a different meaning! B versions have something to do with the way data are arranged internally. In other words, you may read carefully the chip data sheets before trying to tweak the proposed code.

As usual I am proposing a fully featured library which will allow to run any from the 25LC080, 25LC080A, 25LC080B, 25LC160, 25LC160A, 25LC160B, 25LC320, 25LC320A, 25LC640, 25LC640A, 25LC128, 25LC256, 25LC512 and 25LC1024 chips. plainEEPROM_SPI will do all the fine tuning for you, provided you can read the name on the chip and pick the correct constant name from the list as explained in the user manual file. Each chip has its own properties in terms of: Full memory size, page size, address bytes and maximum clock frequency and PlainEEPROM_SPI will care about them. Next is a short recap of the chip properties

ReferenceMax. ClockTotal sizePagesPage sizeAddress bytes
25LC102420MHz1024Kb5122563
25LC51220MHz512Kb5121282
25LC25610MHz256Kb512642
25LC12810MHz128Kb256642
25LC640A10MHz64Kb256322
25LC6402MHz64Kb256322
25LC320A10MHz32Kb128322
25LC3202MHz32Kb128322
25LC160B10MHz16Kb64322
25LC160A10MHz16Kb128162
25LC1602MHz16Kb128162
25LC080B10MHz8Kb32322
25LC080A10MHz8Kb64162
25LC08010MHz8Kb64162

Alike the most recent version of PlainSDC, PlainEEPROM_SPI is offering a set of easy to use functions which will allow to access any data at any address within the memory without the burden of memory pages.

ReadUInt8(address)
ReadUInt16(address)
ReadInt16(address)
ReadUInt32(address)
ReadInt32(address)
ReadFlt32(address)
ReadUInt8()
ReadUInt16()
ReadInt16()
ReadUInt32()
ReadInt32()
ReadFlt32()
WriteUInt8(data, address)
WriteUInt16(data, address)
WriteInt16(data, address)
WriteUInt32(data, address)
WriteInt32(data, address)
WriteFlt32(data, address)
WriteUInt8(data)
WriteUInt16(data)
WriteInt16(data)
WriteUInt32(data)
WriteInt32(data)
WriteFlt32(data)

Write and read functions are available with and without address setting. When the address argument is not set, the write or read functions are executed at the actual memory location. The value of this internally managed variable can be read or set using the ActualAddress() function form the next list.

ActualAddress()
ActualAddress(address)

Advanced user are welcome to use page oriented functions for some specific advanced programming.

ActualPage()
ActualPage(page)
Pages()
PageSize()
BufferPointer()
ClearBuffer()
ErasePage()
ErasePage(page)
EraseAll()
ReadPage()
ReadPage( page)
WritePage()
WritePage(page)

Next post on same subject

 

Leave a Reply

You must be logged in to post a comment.