Linux I2C Aardvark


Linux I2C Aardvark


This information is assuming the user has read the information on the page Linux I2C Driver and understands how to use the sysfs and EEPROM drivers in Linux.

Connecting the Aardvark I2C/SPI Activity Board To The ML507


The ML507 reference design used for OSL from xilinx.com brings out the I2C bus on connector J3 (and also on the larger expansion header). The J3 connections come straight off the I2C bus from the FPGA such that reference design bit stream works.

Connect pins on J3 of the ML507 to J5 of the Aardvark board, using fly wires.

J3 Pin 2 –> J5 SDA Pin
J3 Pin 4 –> J5 SCL Pin
J3 Pin 5 –> J5 GND Pin
J3 Pin 6 –> J5 +5V Pin

Pin 6 on the ML507 is 3.3 volts while the board expects 5 volts but it seems to run fine as the LEDs maybe the only issue.

If you connect the Aardvark to other reference designs/boards, make sure that there’s pull ups on the I2C signals in the design. The ML507 incorporates them.

Add jumpers to the I2C EEPROM address (A2-A0) on the Aardvark board to make the address 0x57 so that it doesn’t conflict with any other device on the I2C bus.

Kernel Configuration


Refer to the paragraphs on the page, OSL I2C Driver, to use the I2C EEPROM Driver with the Linux kernel. The examples below assume you are using it.

Adding The EEPROM To The Device Tree


In order for the Linux kernel to find the driver for the I2C EEPROM on the board the device tree needs to reflect the additional EEPROM on the I2C bus.

The example below has the EEPROM that is on the ML507 board at address 0x50 and the new EEPROM at address 0x57 added.

Kernel Console Output


The following console output shows the I2C driver being found followed by two instances of the EEPROM driver.

Device Tree Probing 'i2c'
81600000.i2c #0 at 0x81600000 mapped to 0xD1020000, irq=20
at24 0-0050: 1024 byte 24c08 EEPROM (writable)
at24 0-0057: 256 byte 24c02 EEPROM (writable)

Reading the EEPROM


The following command shows reading the EEPROM contents and display them in hex. This assumes you have sysfs setup correctly also as documented on the page, OSL I2C Driver.

Writing The EEPROM


The file 02eeprom_inverted contains a copy of the contents of the eeprom read above and then all the data was inverted so it reverses the order of the data to show that writing to the EEPROM works (after a power cycle).

Writing The EEPROM Simpler