OSL I2C With Aardvark Board

This information is assuming the user has read the information on the page OSL 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.

IIC-Bus: i2c@81600000 {
    compatible = "xlnx,xps-iic-2.00.a";
    interrupt-parent = <&xps_intc_0>;
    interrupts = < 6 2 >;
    reg = < 0x81600000 0x10000 >;
    xlnx,clk-freq = <0x5f5e100>;
    xlnx,family = "virtex5";
    xlnx,gpo-width = <0x1>;
    xlnx,iic-freq = <0x186a0>;
    xlnx,scl-inertial-delay = <0x0>;
    xlnx,sda-inertial-delay = <0x0>;
    xlnx,ten-bit-adr = <0x0>;
    #address-cells = <1>;
    #size-cells = <0>;

    m24c08@50 {
        compatible = "at,24c08";
        reg = <0x50>;
    };        
    m24c02@57 {
        compatible = "at,24c02";
        reg = <0x57>;
    };        
} ;

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.

root@172.16.40.12:/sys/bus/i2c/devices/0-0057# more eeprom | od -x

0000000 0001 0203 0405 0607 0809 0a0b 0c0d 0e0f
0000020 1011 1213 1415 1617 1819 1a1b 1c1d 1e1f
0000040 2021 2223 2425 2627 2829 2a2b 2c2d 2e2f
0000060 3031 3233 3435 3637 3839 3a3b 3c3d 3e3f
0000100 4041 4243 4445 4647 4849 4a4b 4c4d 4e4f
0000120 5051 5253 5455 5657 5859 5a5b 5c5d 5e5f
0000140 6061 6263 6465 6667 6869 6a6b 6c6d 6e6f
0000160 7071 7273 7475 7677 7879 7a7b 7c7d 7e7f
0000200 8081 8283 8485 8687 8889 8a8b 8c8d 8e8f
0000220 9091 9293 9495 9697 9899 9a9b 9c9d 9e9f
0000240 a0a1 a2a3 a4a5 a6a7 a8a9 aaab acad aeaf
0000260 b0b1 b2b3 b4b5 b6b7 b8b9 babb bcbd bebf
0000300 c0c1 c2c3 c4c5 c6c7 c8c9 cacb cccd cecf
0000320 d0d1 d2d3 d4d5 d6d7 d8d9 dadb dcdd dedf
0000340 e0e1 e2e3 e4e5 e6e7 e8e9 eaeb eced eeef
0000360 f0f1 f2f3 f4f5 f6f7 f8f9 fafb fcfd feff
0000400

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).

root@172.16.40.12:/sys/bus/i2c/devices/0-0057# cat /home/02*inverted > eeprom

root@172.16.40.12:/sys/bus/i2c/devices/0-0057# more eeprom | od -x

0000000 fffe fdfc fbfa f9f8 f7f6 f5f4 f3f2 f1f0
0000020 efee edec ebea e9e8 e7e6 e5e4 e3e2 e1e0
0000040 dfde dddc dbda d9d8 d7d6 d5d4 d3d2 d1d0
0000060 cfce cdcc cbca c9c8 c7c6 c5c4 c3c2 c1c0
0000100 bfbe bdbc bbba b9b8 b7b6 b5b4 b3b2 b1b0
0000120 afae adac abaa a9a8 a7a6 a5a4 a3a2 a1a0
0000140 9f9e 9d9c 9b9a 9998 9796 9594 9392 9190
0000160 8f8e 8d8c 8b8a 8988 8786 8584 8382 8180
0000200 7f7e 7d7c 7b7a 7978 7776 7574 7372 7170
0000220 6f6e 6d6c 6b6a 6968 6766 6564 6362 6160
0000240 5f5e 5d5c 5b5a 5958 5756 5554 5352 5150
0000260 4f4e 4d4c 4b4a 4948 4746 4544 4342 4140
0000300 3f3e 3d3c 3b3a 3938 3736 3534 3332 3130
0000320 2f2e 2d2c 2b2a 2928 2726 2524 2322 2120
0000340 1f1e 1d1c 1b1a 1918 1716 1514 1312 1110
0000360 0f0e 0d0c 0b0a 0908 0706 0504 0302 0100

Writing The EEPROM Simpler

root@172.16.40.12:/sys/bus/i2c/devices/0-0057# echo 0123456789 > eeprom

root@172.16.40.12:/sys/bus/i2c/devices/0-0057# more eeprom | od -x

0000000 3031 3233 3435 3637 3839 0af4 f3f2 f1f0
0000020 efee edec ebea e9e8 e7e6 e5e4 e3e2 e1e0
0000040 dfde dddc dbda d9d8 d7d6 d5d4 d3d2 d1d0
0000060 cfce cdcc cbca c9c8 c7c6 c5c4 c3c2 c1c0
0000100 bfbe bdbc bbba b9b8 b7b6 b5b4 b3b2 b1b0
0000120 afae adac abaa a9a8 a7a6 a5a4 a3a2 a1a0
0000140 9f9e 9d9c 9b9a 9998 9796 9594 9392 9190
0000160 8f8e 8d8c 8b8a 8988 8786 8584 8382 8180
0000200 7f7e 7d7c 7b7a 7978 7776 7574 7372 7170
0000220 6f6e 6d6c 6b6a 6968 6766 6564 6362 6160
0000240 5f5e 5d5c 5b5a 5958 5756 5554 5352 5150
0000260 4f4e 4d4c 4b4a 4948 4746 4544 4342 4140
0000300 3f3e 3d3c 3b3a 3938 3736 3534 3332 3130
0000320 2f2e 2d2c 2b2a 2928 2726 2524 2322 2120
0000340 1f1e 1d1c 1b1a 1918 1716 1514 1312 1110
0000360 0f0e 0d0c 0b0a 0908 0706 0504 0302 0100
0000400
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License