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
I Need to Program 129 Bytes to an I2C EEPROM – How Should I Use Your Example Programs for My Chip?
Rena Ayeras

Question from the Customer:

I’m working on automating the programming of a Microchip 24LC128 I2C EEPROM. I’m using the Aardvark I2C/SPI Host Adapter with the Aardvark Software API, specifically Python. Looking at aai2c_eeprom.py, how do I specify the start location for writing? The slave address is 0x50.

What would be the correct syntax for the command? I think it would look like this:

aai2c_eeprom.py 0 400 write 0x50 2 4

But so far, I haven’t been able to get the program to work with my chip. Any suggestions?

Response from Technical Support:

Thanks for you question! The functional examples that Total Phase provides with the API software package are to read, program, and erase two specific devices: AT25080A SPI EEPROM and AT24C02 I2C EEPROM, which are installed on our I2C/SPI Activity Board.

Our API examples can be used as a baseline for building the code that you need for your chipsets. As specifications vary per chip design, these example programs may not work for other devices, but the programs can be modified as needed.

Overview of EEPROM Code

aai2c_eeprom.py is used to read, write, and erase an EEPROM. Here are the usages:

  • Write: aai2c_eeprom PORT BITRATE write SLAVE_ADDR OFFSET LENGTH
  • Erase: aai2c_eeprom PORT BITRATE zero SLAVE_ADDR OFFSET LENGTH

    In this case, erasing data is implemented by writing “0” in the specified length of bytes.

Adapting the Example to Your Chipset

Looking at the datasheets, the memory of the 24LC128 EEPROM is larger than the memory of the AT24C02 EEPROM, which affects the memory address range. To work with your device, the parameters related to the address range should be modified in the example code.

How to Specify the Start Location

The start location can be specified in the OFFSET argument of the command line function. To read only a single memory location, specify the LENGTH as 1.

For more information about API commands, please refer to the API Documentation chapter of the Aardvark I2C/SPI Host Adapter User Manual.

Alternate Method - Batch Scripts

In addition to API programs, you can use XML batch files with the Control Center Serial Software. We regularly update batch scripts for production devices. As you know, new products are constantly released and prototypes are tested before release – we may not have exactly what is needed. However, like the API files, the XML files can be easily modified, and then run with the Control Center Serial Software. For an example of using batch files, take a look at this video:



Additional resources that you may find helpful include the following:

We hope this answers your question. Need more information? You can contact us and request a demo that applies to your application, as well as ask about our Total Phase products.