I2C SPI USB CAN eSPI Cable Testing View All Quick Start Guides User Manuals Software Downloads Knowledge Base Videos Case Studies App Notes White Papers Sales Support About Us
Products Blog Sales Support Contact Search
How Do I Talk to an I2C Translating Switch with an 8-bit Address?
Rena Ayeras

Question from the Customer:

I am working with the Aardvark I2C/SPI Host Adapter and the Aardvark Software API (Python). I am using the command aaspi_eeprom.py 0 100 read 0 0 4096. The I2C device I am working with is a PCA9546 translating switch: the address is 0xE0 and the EEPROM I am talking to connects to port 1 of the switch.

What changes do I need to make?

Response from Technical Support:

Thanks for your question! Many functional examples are included with our API packages. However, the programs provided are to read, program, and erase AT25080A SPI EEPROM and AT24C02 I2C EEPROM devices, which are used on our accessory board, the I2C/SPI Activity Board.

Our API can be modified for your devices. Looking at the PCA9546 data sheet, here are guidelines to help you get started.

Getting Started with the Device Data Sheet

For the device PCA9546 with address 0xE0, we recommend looking at our aai2c_eeprom example file, and then modify that program to perform the required read and write commands for your setup.

Looking at the data sheet, here is some key information:

The PCA9546 device address, 0xE0, is an 8-bit address. All Total Phase I2C products follow the standard 7-bit addressing and 10-bit addressing conventions.

How to Communicate with 8-bit Addresses

The slave address used should only be the top seven bits. For your requirement, the device address E0 (8 bit address) can be represented as 70 H(7 bit address). For more information on addressing schemes, please refer this knowledge base article, 7-bit, 8-bit, and 10-bit I2C Slave Addressing.

API Example Script

aai2c_eeprom.py is an example API script is used to program, erase, and read AT24C02 I2C EEPROM. Here is an overview of the commands to use.
aai2c_eeprom PORT BITRATE read SLAVE_ADDR OFFSET LENGTH

aai2c_eeprom PORT BITRATE write SLAVE_ADDR OFFSET LENGTH

aai2c_eeprom PORT BITRATE zero SLAVE_ADDR OFFSET LENGTH

    • The read, write, and erase operations are performed based on the command.
    • The "zero" indicates erase operation, where the EEPROM is programmed with all 0s in specified length of bytes.

Here is an example of using the commands for reading from your device:

Setting the bitrate 400 kHz:

aai2c_eeprom 0 400 read 0x50 0 32

Reading from the device:

0000: 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f 10

0010: 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f 00

Please let us know if you have additional questions.

Additional resources that you may find helpful include the following:

We hope this answers your questions. If you have other questions about our software, host adapters or other Total Phase products, feel free to email us at sales@totalphase.com. You can also request a demo specific for your application.

Request a Demo