WebbotLib AVR library
WebbotLib It just does it
  C++ documentation  C documentation


Provides generic support for EEPROM devices accessed over an SPI bus.
Note that these device are often advertised showing the capacity as the number of 'bits' they provide. Such as 512k bits. Since we are dealing in 8 bit bytes then you need to divide this figure by 8. So 512k bits => 64k bytes. Not sure why they are sold that way - maybe its because of 32 bit vs 16 bit vs 8 bit processors?
So why would you need one?
Generic SPI EEPROM.png
These devices are quite cheap (a dollar or two) and typically come in an 8 pin format and are therefore physically quite small but can store a reasonably large amount of data - so they are good for storing 'work in progress'. Your processor may come with some 'on board' EEPROM space but typically it will be quite small. So if you need more capacity then here is your solution.
The diagram shows a typical pin out for such a device but you may want to check the data sheet for the device you have purchased.
Besides a Ground and Supply voltage (typically 1.8v to 5.5v) you will also see the MISO, MOSI and SCLK pins which are the heart of the SPI bus (the MISO and MOSI pins may be labelled Data Out, or DO, and Data In, or DI, respectively). You will also see a chip select, or CS, pin that is used to select the device. So that accounts for 6 of the pins on the device, There are two others: HOLD and WP. HOLD can be connected to its neighbouring supply pin and WP can be connected to its neighbouring Ground pin.
There are a few other things you need to check from the datasheet before you can use the device:
The address size may be 1, 2, 3 or 4 bytes (ie 8, 16, 24 or 32 bits) and is normally dictated by the number of bytes of storage:
The page size is always a power of 2 and is normally 128, 256 or 512 bytes - it chops the device up into a number of similar sized pages. A single write to the device must all be in the same page. This value is passed to WebbotLib when creating the device so that your code doesn't have to worry about the restriction - WebbotLib 'just does it'.
In Project Designer you must must add the EEPROM to an existing SPI Bus.
Function Summary

Valid XHTML 1.0 Transitional