Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
12 years ago

Accessing EEPROM on I2C Bus 0 - Altera Arrow SoC kit

Hi experts,

On detecting the I2C devices on I2C Bus 0 for Altera SoCkit by using i2cdetect command in linaro filesystem,

$ i2cdetect -y 0

Error: Can't use SMBus Quick Write command on this bus

But i was then able to detect EEPROM and LCD on I2C Bus 0 using the command as follows,

$ i2cdetect -r 0

WARNING! This program can confuse your I2C bus, cause data loss and worse!

I will probe file /dev/i2c-0 using read byte commands.

I will probe address range 0x03-0x77.

Continue? [Y/n] y

0 1 2 3 4 5 6 7 8 9 a b c d e f

00: -- -- -- -- -- -- -- -- -- -- -- -- --

10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

20: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- --

30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

50: -- UU -- -- -- -- -- -- -- -- -- -- -- -- -- --

60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

But when i try to read/write to EEPROM on I2C0 using I2C SMBUS read in code / using i2cget, im getting error: read failed.

So on trying to access using /sys/bus/i2c/devices/0-0051, i face a time out issue as follows,

cat: /sys/bus/i2c/devices/0-0051/eeprom: Connection timed out

And its I2C debug messages are,

i2c i2c-0: master_xfer[0] W, addr=0x51, len=2

i2c i2c-0: master_xfer[1] R, addr=0x51, len=128

i2c_designware ffc04000.i2c: i2c_dw_xfer: msgs: 2

i2c_designware ffc04000.i2c: i2c_dw_isr: Synopsys DesignWare I2C adapter enabled= 0x1 stat=0x10

i2c_designware ffc04000.i2c: i2c_dw_isr: Synopsys DesignWare I2C adapter enabled= 0x1 stat=0x110

i2c_designware ffc04000.i2c: i2c_dw_isr: Synopsys DesignWare I2C adapter enabled= 0x1 stat=0x150

i2c_designware ffc04000.i2c: i2c_dw_handle_tx_abort: slave address not acknowledged (7bit mode)

Any idea/help on accessing the EEPROM on I2C0 will be much more appreciated.

Thanks,

Dhiv

1 Reply

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hello,

    there is no EEPROM on the Arrow SocKit kit. There is, however, an EEPROM at address 0x51 on the Cyclone V SOC Development Board.

    Because all the standard Device Tree Blobs seem to directly support the Cyclone V SOC board, the I2C slaves in your device tree are probably the ones for that board and not the SocKit.

    if you run the command:
    dtc -I dtb socfpga_cyclone5.dtb -O dts
    

    (renaming socfpga_cyclone5.dtb to whatever dtb you are using...)

    you will probably see this:

    i2c@ffc04000 {
               # address-cells = <0x1>;
               # size-cells = <0x0>;
                compatible = "snps,designware-i2c";
                reg = <0xffc04000 0x1000>;
                interrupts = <0x0 0x9e 0x4>;
                clocks = <0xb>;
                status = "okay";
                speed-mode = <0x0>;
                eeprom@51 {
                    compatible = "atmel,24c32";
                    reg = <0x51>;
                    pagesize = <0x20>;
                };
                rtc@68 {
                    compatible = "dallas,ds1339";
                    reg = <0x68>;
                };
      };

    That is for the Cyclone V board and not for the SocKit. You would need to get rid of those and add entries for the components that are on the SocKit. The SocKit has the G-Sensor (ADXL345 at address 0xA6) and a connection on the LTC 2x7 for connecting whatever you want.

    --- Quote Start ---

    Hi experts,

    On detecting the I2C devices on I2C Bus 0 for Altera SoCkit by using i2cdetect command in linaro filesystem,

    $ i2cdetect -y 0

    Error: Can't use SMBus Quick Write command on this bus

    But i was then able to detect EEPROM and LCD on I2C Bus 0 using the command as follows,

    $ i2cdetect -r 0

    WARNING! This program can confuse your I2C bus, cause data loss and worse!

    I will probe file /dev/i2c-0 using read byte commands.

    I will probe address range 0x03-0x77.

    Continue? [Y/n] y

    0 1 2 3 4 5 6 7 8 9 a b c d e f

    00: -- -- -- -- -- -- -- -- -- -- -- -- --

    10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

    20: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- --

    30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

    40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

    50: -- UU -- -- -- -- -- -- -- -- -- -- -- -- -- --

    60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

    But when i try to read/write to EEPROM on I2C0 using I2C SMBUS read in code / using i2cget, im getting error: read failed.

    So on trying to access using /sys/bus/i2c/devices/0-0051, i face a time out issue as follows,

    cat: /sys/bus/i2c/devices/0-0051/eeprom: Connection timed out

    And its I2C debug messages are,

    i2c i2c-0: master_xfer[0] W, addr=0x51, len=2

    i2c i2c-0: master_xfer[1] R, addr=0x51, len=128

    i2c_designware ffc04000.i2c: i2c_dw_xfer: msgs: 2

    i2c_designware ffc04000.i2c: i2c_dw_isr: Synopsys DesignWare I2C adapter enabled= 0x1 stat=0x10

    i2c_designware ffc04000.i2c: i2c_dw_isr: Synopsys DesignWare I2C adapter enabled= 0x1 stat=0x110

    i2c_designware ffc04000.i2c: i2c_dw_isr: Synopsys DesignWare I2C adapter enabled= 0x1 stat=0x150

    i2c_designware ffc04000.i2c: i2c_dw_handle_tx_abort: slave address not acknowledged (7bit mode)

    Any idea/help on accessing the EEPROM on I2C0 will be much more appreciated.

    Thanks,

    Dhiv

    --- Quote End ---