TotalPhase-Blog-Erlebniswelten

Programming an I2C EEPROM Using Promira Serial Platform

Programming I2C memory devices is a common use case for the Promira™ Serial Platform with I2C Active Level 1-2 Applications. There are several ways to do this with the Promira™ Serial Platform, including using Control Center Serial, Flash Center, or the Promira  API. This article focuses on how to how to take the information from an EEPROM datasheet and execute the commands in Control Center Serial Software Command Line mode by using the batch commands and example file. Although the following describes the Atmel I2C EEPROM AT24C02 found on the I2C/SPI Activity Board, similar steps can be used for other devices.

In this article, the Promira platform writes and reads multiple bytes from AT24C02. Here the Promira platform is the I2C master and the AT24C02 in the I2C/SPI Activity Board is the I2C slave. The Promira platform is connected to the AT24C02 in the I2C/SPI Activity Board through the 34-10 I2C/SPI cable. The Promira platform supplies 3.3V I2C signals and 5V VDD signal to the I2C/SPI Activity Board. For additional information take a look at I2C/SPI I2C/SPI activity board users manual and the AT24C02 datasheet.

AT24C02_Pin_Configuration_2014-10-04

AT24C02 Detailed

In this article, the AT24C02 SCL (Serial Clock Input) and SDA (Serial Data) signals are connected to the Promira platform SCL and SDA signals accordingly. The AT24C02 A0 - A2 (Address Input), WP (Write Protect) and GND (Ground) signals are connected to ground. The AT24C02 VCC (Power Supply) signal is connected 3.3V.

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 AT24C02 on the I2C/SPI activity board receives the I2C pulls-ups and power from the Promira platform. In order to supply the I2C pull-ups and target power to the Activity board, the Promira platform and Control Center Serial are configured with the batch command "configure" to I2C/SPI mode (i2c="1" spi="1" gpio="0"), I2C pull-ups enabled (pullups="1"), and target power enabled (tpower="1"). For additional information take a look at the I2C/SPI activity board user's manual.

The AT24C02 write operation used here is Page Write. The Page Write operation to the AT24C02 requires 7 bit device address, one byte memory address, and two or more bytes of memory data. Performing a memory write operation with the Promira platform requires a single command from the adapter and Control Center Serial. In this case, Control Center Serial batch mode example "i2c-eeprom-write" is used in order to perform 256 "i2c_write" commands of data 0x00 - 0xFF to memory addresses 0x00 to 0xFF with I2C device address 0x50. For example, take a look at the first and last i2c_write commands.

 

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

 


The first command includes the device address (addr="0x50"), number of data bytes (count="2"), data format (radix="16"), memory address (0x00), and memory data (0x00). While the last "i2c_write" command includes the I2C device address (addr="0x50"), number of data bytes (count="2"), data format (radix="16"), memory address (0xFF), and memory data (0xFF).

AT24C02_Page_Write_

The AT240C read operation used here is the Sequential Read. The AT240C Sequential Read operation first performs I2C write with 7 bit device address, one byte memory address and no stop. Then the AT240C Sequential Read operation performs I2C read with 7 bit device address, two or more bytes of memory data, and stop. Performing a memory read operation with the Promira platform requires two commands from the adapter and Control Center Serial batch mode. In this case, Control Center Serial batch mode example "i2c-eeprom-read" is used in order to perform read of 256 bytes from address 00 with I2C device address 0x50. In this article the memory read operation includes the following two Aardvark adapter and Control Center Serial batch mode commands:

 

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

 

The first command is "i2c_write" including the I2C device address (addr="0x50"), number of data bytes (count="1"), data format (radix="16"), memory address (0x00), with no stop (nostop="1"). This write command is for configuring the internal data word address counter to a specific address (0x00).
The second command is "i2c_read" including the I2C device address (addr="0x50") and the number of the data bytes (count="256"). This read command is to read the data starting from address 0x00.
For additional information take a look at the AT24C02 datasheet.

AT24C02_Sequential_Read

Writing and Reading Guidelines

1. Connect the Promira platform USB connector to the PC USB connector.
2. Download and unzip the latest version of Promira USB Drivers Linux.
3. Follow the instructions in Section 5.2 - Connectivity of the Promira platform system user manual to configure the Ethernet over USB interface.

Promira_Write_and_Read_AT24C02

4. Download and unzip the latest version of Promira FW Utility for Linux. If the Promira FW is not the latest FW, then update the Promira to the latest FW with the latest Promira FW Utility for Linux.

5. Download and unzip the latest version of Control Center Serial. 

6. Connect the Promira platform I2C/SPI connector to the I2C/SPI Activity Board through 34-10 cable.
7. Launch Control Center Serial. 
8. Connect Control Center Serial to the Promira platform. 

  1. Click Adapter, and choose Connect.
  2. Select the Promira platform.
  3. Click OK to connect to the Promira platform.
Promira_Control_Center_Serial_Configure_Adapter_Window

9. Write and read from I2C EEPROM on the Total Phase I2C/SPI activity board with Promira platform and Control Center Serial Command Line Mode. 

  1. Launch terminal instance on the computer
  2. Go to Control Center Serial package folder with the file controlctr
  3. Type: "controlctr -c"
  4. Type "connect 2416-606091" (Modify the 2416-606091 to your Promira SN)
  5. Type "batch ./examples/i2c-eeprom-read.xml"
  6. Type "disconnect 2416-606091" (Modify the 2416-606091 to your Promira SN)
  7. Type "quit"
Promira_Control_Center_Serial_Terminal_I2C_Write_and_Read_AT24C02

I2C Development Tools

Aardvark I2C/SPI Host AdapterAardvark I2C/SPI Host Adapter
Aardvark I2C/SPI Host Adapter
TP240141
Erase, program, verify Memory Devices - The Aardvark I2C/SPI Host Adapter is a fast and powerful I2C bus and SPI bus host adapter through USB.

€309.00*
Beagle I2C/SPI Protokoll Analyzer - Total Phase
Beagle I2C/SPI Protocol Analyzer
TP320121
The versatile Beagle I2C/SPI Protocol Analyzer is the ideal tool for the embedded engineer who is developing an I2C, SPI, or MDIO based product.

€369.00*
Promira I2C/ SPI/ eSPI Platform
TP500110-S
Promira is a universal hardware platform usable for a variety of applications, like I2C, SPI and eSPI.

Variants from €900.00*
€1,060.00*