UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Adventurer
Adventurer
4,527 Views
Registered: ‎01-10-2014

Still more questions on Linux I2C driver

Jump to solution

Hello all!

 

I'm facing a strange problem while trying to communicate with EEPROM via PS I2C on Zedboard. I have ATC24C04 EEROM microscheme connecter to JE2 and JE3 pins of my Zedboard. 

I have enabled I2C0 in Vivado, done all the procedures for building Linux. I'm using kernel from Analog Devices git.

I have added a I2C entry to .dts:

 

ps7_i2c_0: ps7-i2c@e0004000 {
compatible = "xlnx,ps7-i2c-1.00.a";
bus-id = <1>;
input-clk = <111111111>;
i2c-clk = <100000>;
interrupt-parent = <&gic>;
interrupts = <0 25 0>;
reg = <0x1000 0xe0004000>;
#address-cells = <1>;
#size-cells = <0>;
};

 

The design I'm using already has I2C in PL for working with soundcard and it works well. So when Linux boots I see i2c-0 and i2c-1 in /dev folder but when i do i2cdetect -l (from i2c-tools packet) this is the output I see:

 

i2c-0 i2c xiic-i2c I2C adapter

 

It not PS I2C if I understand it right. I have already looked to .config and even configured and recompiled the kernel myself but it still doesn't work. What is wrong? Do I have to write something about my EEPROM microscheme in .dts? And if yes then what do I have to write? I'm some kind of desperate.

0 Kudos
1 Solution

Accepted Solutions
Scholar milosoftware
Scholar
6,564 Views
Registered: ‎10-26-2012

Re: Still more questions on Linux I2C driver

Jump to solution

 

You're missing an entry for the EEPROM, it should look like this:

 

 

        ps7_i2c_0: ps7-i2c@e0004000 {
            bus-id = <0>;
            clocks = <&clkc 38>;
            compatible = "cdns,i2c-r1p10";
            clock-frequency = <400000>;
            interrupt-parent = <&gic>;
            interrupts = <0 25 4>;
            reg = <0xe0004000 0x1000>;
            xlnx,has-interrupt = <0x0>;
            #address-cells = <1>;
            #size-cells = <0>;
            /* EEPROM */
            eeprom: eeprom@50 {
                compatible = "at24,24c04";
                reg = <0x50>;
            };
};

 

"0x50" is the default address (all "a" pins grounded) for the chip.

 

 

The syntax to scan the I2C bus is:

 

i2cdetect 0

 

This will show you what's on bus i2c-0.

 

You'll need to enable the EEPROM driver in the kernel, then you get a file called:

 

You're missing an entry for the EEPROM, it should look like this:

 

 

        ps7_i2c_0: ps7-i2c@e0004000 {
            bus-id = <0>;
            clocks = <&clkc 38>;
            compatible = "cdns,i2c-r1p10";
            clock-frequency = <400000>;
            interrupt-parent = <&gic>;
            interrupts = <0 25 4>;
            reg = <0xe0004000 0x1000>;
            xlnx,has-interrupt = <0x0>;
            #address-cells = <1>;
            #size-cells = <0>;
            /* EEPROM */
            eeprom: eeprom@50 {
                compatible = "at24,24c04";
                reg = <0x50>;
            };
};

 

"0x50" is the default address (all "a" pins grounded) for the chip.

 

 

The syntax to scan the I2C bus is:

 

i2cdetect 0

 

This will show you what's on bus i2c-0.

 

You'll need to enable the EEPROM driver in the kernel, then you get a file called:

/sys/bus/i2c/devices/0-0050/eeprom

 

You can read/write this file as if it were a local file, and the kernel will transfer it via I2C to the chip and vice versa for you.

0 Kudos
2 Replies
Scholar milosoftware
Scholar
6,565 Views
Registered: ‎10-26-2012

Re: Still more questions on Linux I2C driver

Jump to solution

 

You're missing an entry for the EEPROM, it should look like this:

 

 

        ps7_i2c_0: ps7-i2c@e0004000 {
            bus-id = <0>;
            clocks = <&clkc 38>;
            compatible = "cdns,i2c-r1p10";
            clock-frequency = <400000>;
            interrupt-parent = <&gic>;
            interrupts = <0 25 4>;
            reg = <0xe0004000 0x1000>;
            xlnx,has-interrupt = <0x0>;
            #address-cells = <1>;
            #size-cells = <0>;
            /* EEPROM */
            eeprom: eeprom@50 {
                compatible = "at24,24c04";
                reg = <0x50>;
            };
};

 

"0x50" is the default address (all "a" pins grounded) for the chip.

 

 

The syntax to scan the I2C bus is:

 

i2cdetect 0

 

This will show you what's on bus i2c-0.

 

You'll need to enable the EEPROM driver in the kernel, then you get a file called:

 

You're missing an entry for the EEPROM, it should look like this:

 

 

        ps7_i2c_0: ps7-i2c@e0004000 {
            bus-id = <0>;
            clocks = <&clkc 38>;
            compatible = "cdns,i2c-r1p10";
            clock-frequency = <400000>;
            interrupt-parent = <&gic>;
            interrupts = <0 25 4>;
            reg = <0xe0004000 0x1000>;
            xlnx,has-interrupt = <0x0>;
            #address-cells = <1>;
            #size-cells = <0>;
            /* EEPROM */
            eeprom: eeprom@50 {
                compatible = "at24,24c04";
                reg = <0x50>;
            };
};

 

"0x50" is the default address (all "a" pins grounded) for the chip.

 

 

The syntax to scan the I2C bus is:

 

i2cdetect 0

 

This will show you what's on bus i2c-0.

 

You'll need to enable the EEPROM driver in the kernel, then you get a file called:

/sys/bus/i2c/devices/0-0050/eeprom

 

You can read/write this file as if it were a local file, and the kernel will transfer it via I2C to the chip and vice versa for you.

0 Kudos
Adventurer
Adventurer
4,509 Views
Registered: ‎01-10-2014

Re: Still more questions on Linux I2C driver

Jump to solution
Yes, finally that works!!!
Thank you very much!!
0 Kudos