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
How to Read and Write to an I2C EEPROM Using the Aardvark Adapter and Control Center

Introduction

Programming and reading I2C memory devices is a common use case for the Aardvark I2C/SPI Host Adapter. There are several ways to do this with the Aardvark adapter, including using Control Center, Flash Center, or the Aardvark API. This article focuses on how to take the information in an EEPROM datasheet and execute the commands in Control Center. Although the following describes the AT24C02 I2C EEPROM found on the I2C/SPI Activity Board, similar steps can be used for other devices. The goal of this article is to demonstrate how to write several bytes to a specific address and then read back those bytes.

Overview

In this article 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.

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 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

AT24C02 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 Addre

ss Read

AT24C02 Current Address Read

In this article 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.

Writing and Reading Guidelines

  1. Download and run the latest version of the Total Phase USB Drivers Installer.
  2. Download and unzip the latest version of Control Center. (?)
  3. Connect the Aardvark adapter to the PC via the USB connector.
  4. Connect the Aardvark adapter to the I2C/SPI activity board via the I2C/SPI connector. (?)
  5. Launch Control Center. (?)
  6. Connect to the Aardvark adapter. (?)
    1. Click Configure Aardvark Adapter.
    2. Select the Aardvark Adapter.
    3. Click OK to connect to the adapter.
  7. Click Aardvark, and choose I2C+SPI.
  8. Click Aardvark, and enable I2C Pulls-Ups and Target Power. (This configuration is required for the activity board, but may not be required for all target systems.)
  9. Configure the adapter as an I2C Master using the I2C Control panel. (?)
      1. Click on the Master tab.
      2. Enter 100 in Bitrate rectangular, and click Set.
      3. Enter 0x50 in Slave Address field.(?)
      4. Disable 10 Bit Addr and No Stop.
      5. Enter 3 in Number of Bytes field.
      6. Enter 08 0A 0B 0C in the Message field, and click Master Write.

    Figure 3: Aardvark Adapter Writes 08 0A 0B 0C To AT24C02

    Control Center Write 08 0A 0B 0C To AT24C02

      1. Enter 08 in the Message rectangular, and click Master Write. (By only sending the word address without any data, the internal data word address counter is set to 0x08).

    Figure 4: Aardvark Adapter Writes 08 To AT24C02

    Control Center Write 08 To AT24C02

    1. Click Master Read, and verify that the read data is 0A 0B 0C.

Figure 5: Aardvark Adapter Reads 0A 0B 0C From AT24C02

Control Center Read From AT24C02

Notes

For additional information, take a look at the Aardvark I2C/SPI Host Adapter User Manual, I2C/SPI Activity Board User Manual and Control Center Serial Software User Manual.