Support Question of the Week: Did You Know You Can Batch Program I2C Memory Devices With the Aardvark I2C/SPI Host Adapter and Total Phase Software?

You can batch program devices using the Aardvark I2C/SPI Host Adapter and any of the following applications: the Control Center Software, the Flash Center Software or the Aardvark Software API. Following is a summary of the example provided in our latest knowledge base article, Programming I2C EEPROM using Aardvark Adapter and Control Center Batch Mode. With some modification, this example be used for programming other devices.

This setup of this example:

  • The Aardvark adapter as the I2C master
  •  The AT24C02 I2C EEPROM as the slave device. In this setup, the EEPROM is part of the I2C/SPI Activity Board.
  • The Control Center Software installed on a computer
  • Writing data to the slave device will be followed by reading the data

Initial Configuration
The Aardvark provides the I2C pull-ups and target power to the memory device on the Activity board. The batch command for this configuration will be as follows:

<configure i2c="1" spi="1" gpio="0" tpower="1" pullups="1">

  • I2C mode: i2c="1" spi="1" gpio="0"
  • Enable target power: tpower="1"
  • Enable I2C pullups: pullups="1"

Writing and Reading to the Device
For the AT24C02 memory device, the write operation will be Page Write and the read operation will be Sequential read.

Write
The default I2C target address is 0x50. For Page Write, AT24C02 requires a 7-bit device address, one byte memory address, and two or more bytes of memory data. For information about programming a 7-bit device, please refer to the knowledge base article 7-bit, 8-bit, and 10-bit I2C Slave Addressing.

In this example, the commands for writing 256 bites will be as shown below. Note - this example represents the first and last i2c_write commands used for writing 256 bytes of data.

<i2c_write addr="0x50" count="2" radix="16">00 00</i2c_write>
<i2c_write addr="0x50" count="2" radix="16">FF FF</i2c_write>

Read
The AT240C Sequential Read operation uses two commands: i2c_write following by i2c_read. In this example, the read commands will be as follows:

<i2c_write addr="0x50" count="1" radix="16" nostop="1">00</i2c_write>
<i2c_read addr="0x50" count="256"/>

About the write command parameters:

  • Device address: addr="0x50"
  • Number of data bytes: count="1"
  • Data format: radix="16"
  • Memory address: 0x00
  • No stop: nostop="1"

About the read command parameters:

  • Device address: addr="0x50"
  • Number of data bytes: count="256"

Writing to the Device Using Batch Mode:

  1. Connect the Aardvark adapter to the computers via the USB connector.
  2. Connect the Aardvark adapter to the I2C/SPI activity board via the I2C/SPI connector.
  3. Launch the Control Center and connect to the Aardvark adapter:
    1. Click Configure Aardvark Adapter.
    2. Select the Aardvark Adapter.
    3. Click OK to connect to the adapter.
  4. Click Aardvark  and then choose Batch Mode.
  5. Write to the memory
    1. Click Load and then choose i2c-eeprom-write.
    2. Click Open and then Execute.
Aardvark Adapter Reads 256 Bytes From AT24C02 Figure 2: Aardvark Adapter Reads 256 Bytes From AT24C02

Reading from the Device Using Batch Mode:

  1. Click Load and then select i2c-eeprom-read.
  2. Click Open, and then Execute.
Aardvark Adapter Reads 256 Bytes From AT24C02 Figure 2: Aardvark Adapter Reads 256 Bytes From AT24C02

For more information, please refer to the following documents:

If you have questions about our host adapters or other Total Phase products, feel free to email us at sales@totalphase.com or submit a request for technical support.

Leave a Reply