I2C SPI USB CAN eSPI Cable Testing View All Videos Quick Start Guides Software Downloads App Notes White Papers User Manuals Knowledge Base Sales Support About Us
Products Blog Sales Support Contact Search
How to Read and Write to an I2C EEPROM Using the Aardvark adapter and Control Center - Part 1
kelly

One of the most popular uses for the Aardvark I2C/SPI Host Adapter is to read and write to an I2C memory device. In this special two-part Support Question of the Week feature, we will focus on how to take information in an EEPROM datasheet and execute commands with the Control Center Software. Engineers can also accomplish reading and writing to an I2C EEPROM by using the Flash Center Software or the API. For this example, we will demonstrate how to read and write several bytes to a specific address to the I2C EEPROM found on the I2C/SPI Activity Board.

This feature is hot off the press from our Total Phase Knowledge Base. The Knowledge Base consists of popular FAQ's and technical articles provided by our very own support team.

Overview

In this feature, the Aardvark adapter is the I2C master and the I2C EEPROM on the I2C/SPI activity board is the I2C slave.

The AT24C02 I2C EEPROM on the activity board has a hardware configurable I2C target address. The default I2C target address is 1010000b, which is 0x50. This article uses the default I2C target address 0x50. For additional information take a look at Knowledge Base Article: 7-bit, 8-bit, and 10-bit I2C Slave Addressing

.

The I2C/SPI activity board receives the I2C pulls-ups and power from the Aardvark adapter. In order to supply the I2C pull-ups and target power to the Activity board, the Aardvark adapter should be configured to I2C pull-ups enabled and target power enabled. For additional information take a look at the I2C/SPI activity board user's manual.

The write operation used here to the AT24C02 is Byte Write. The Byte Write operation to the AT24C02 requires 7 bit device address, one byte memory address, and one or more bytes of memory data. Performing a memory write operation with the Aardvark adapter requires a single command from the adapter. In this case, the single Aardvark adapter write command includes the device address (0x50), the memory address (0x00), and the memory data (0x0A 0x0B 0x0C).

Figure 1: AT240C Byte Write

 

The read operation used here is the Current Address Read. In the Current Address Read operation, the internal data word address counter maintains the last address accessed during the last read or write operation, incremented by one. Once the device address with the read/write select bit set to one (which denotes a read transaction) is clocked in and acknowledged by the EEPROM, the current address data word is serially clocked out. For additional information take a look at the AT24C02 datasheet.

Figure 2: AT240C Current Address Read

 

In this set up the memory read operation includes two Aardvark adapters commands:

  1. The first command is a write for configuring the internal data word address counter to a specific address (0x08).
  2. The second command is a read to actually read the data starting from address 0x08.

Stay tuned for Part 2 of this special feature! In the second installment, we will focus on how to write and read back several bytes of data to the I2C EEPROM.

If you have any questions, feel free to contact us at sales@totalphase.com or support@totalphase.com.