Most of our QuikEval supported demo boards have an on-board EEPROM which is used to store a string of characters. The string holds information about the part number, demo board number and other characteristics of the board. For example, here is the string stored in the EEPROM on demo board DC956: “LTC2485,Cls,D2484,01,01,DC,DC956,---------------“
This string shows that the part number is LTC2485, the demo board number is DC956, the GUI class number is D2484 (“Cls, D2484”), and the board versions (“01, 01”). For the QuikEval software, the string is read out by the processor (on Linduino) to identify the board connected. The use of EEPROM however, can be extended to more than merely storing a string. In the case of a DAC or ADC, it can be used to store calibration data on power-up whereas, for a temperature sensor, it can be used to store sensor specific data. The EEPROM used is 24LC025 (http://ww1.microchip.com/downloads/en/DeviceDoc/21210N.pdf).
About the EEPROM…
Memory organization:
The EEPROM 24LC025 is a 2 Kbit memory organized as 256×8-bit memory. It has page write capability for 16 bytes of data at time. Since the EEPROM id string for each demo board takes about 50 characters, it is important to make sure that, that section is not over-written and so, we start only on page 4 (64th byte).
Schematic:
The EEPROM uses I2C to communicate to the microcontroller. The figure below shows the connections to the EEPROM on a QuikEval supported demo board. EESDA and EESCL are the I2C lines from the controller to EEPROM. The Write Protected (WP) pin on 24LC025 is inactive. Hence, there is no write protection available for this EEPROM and this pin is pulled to VCC. The I2C address of the EEPROM is set to 0×50 (7-bit addressing).
Code library:
QuikEval_EEPROM library in our LTSketchbook defines functions that can be used to talk to the EEPROM. The best way is to store all data to be written into EEPROM is as a structure. Create a union of the structure and a string of the same size. This helps you to write all data into the EEPROM as a string.
Consider a system that needs a calibration key, the initial alert settings, and maximum and minimum power thresholds to be stored in the EEPROM. The following piece of code defines a structure with these values and uses a union to wrap the structure and a string:
To talk I2C to the EEPROM, the first byte is the control byte that holds 4 bits of control code (binary ‘1010’), 3 bits of I2C address determined by A2, A1 and A0 pins on the EEPROM and the R/W bit. Since these pins are grounded, the 3 bits will be binary ‘000’. So the 7-bit I2C address of the part is 0×50.
After receiving the acknowledge for the first byte, the second byte is transferred by the master, which is the address location to be written into. The third byte is the data to be written into that location.
Code Example to write into EEPROM:
Code Example to read from EEPROM:
These functions have been defined in the QuikEval_EEPROM library. If it is a page write, then instead of sending a stop byte, the master sends up to 15 more data bytes. The address increment happens only to the last 4 bits. If more than 16 bytes are written, the address rolls over and re-writes from the top of the page.
If you accidentally overwrote the ID string…
Contact us! If you already know what the string stored in the EEPROM was, then you can write it back yourself.