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: 
Explorer
Explorer
9,607 Views
Registered: ‎02-16-2014

Xilinx PL AXI-I2C + Linux. Work or not?

Spent a few days already...

 

Can anybody say if driver for Linux for Xilinx AXI-I2C works? If so, could you please post the correct device tree node?

 

 

I got Petalinux 2014.2 with default kernel 3.14.2 and I have no problem talking to my I2C devices using PS I2C (Cadence driver). But I got no communication using AXI IIC.

I can see SCL of correct speed (400kHz), some data over SDA line, but after some number of clocks both SCL and SCL got pulled low and stay in this until reset.

I did search forum and found multiple reports of so called "repeated start" problem, but it seems to be solved by kernel 3.8?

 

Any help, please?

 

 

6 Replies
Scholar milosoftware
Scholar
9,591 Views
Registered: ‎10-26-2012

Re: Xilinx PL AXI-I2C + Linux. Work or not?

Working I2C PL example using the Xilinx driver:

 

https://github.com/analogdevicesinc/linux/blob/xcomm_zynq/arch/arm/boot/dts/zynq-zed-adv7511.dts

 

 

Note that you can also just use the PS I2C and route it through logic to the pins you want them to be on. There are two controllers, so you could use one for MIO and one for EMIO.

 

 

0 Kudos
Scholar trenz-al
Scholar
9,587 Views
Registered: ‎11-09-2013

Re: Xilinx PL AXI-I2C + Linux. Work or not?

if you KNOW that all your devices on the i2c bus do not use clock stretching, then one option to prevent lookup is to change the SCL line to push-pull driver (or O and T signals!) and loop back O to I, so the I2C Core would see its own SCL output as readback.

 

We are also seeing some weird stuff with Xilinx AXI IIC, on one of our Artix modules, i2c scan in linux or u-boot returns random "phantoms", seeing addresses responding where no device is responding. with probabality of 0.3% or so, an empty address returns an ACK.

 

We tried to change the "inertial delays" but it made no difference, so this problem is also a mystery as of this moment.

0 Kudos
Xilinx Employee
Xilinx Employee
9,575 Views
Registered: ‎01-21-2014

Re: Xilinx PL AXI-I2C + Linux. Work or not?

It will work.  Check your interrupt connection, you may have the wrong interrupt specified in the .dts. Here is an example .dts entry for an interrupt connected to IRQ_F2P[0]: 

 

 

    axi_iic: i2c@41800000 {
    compatible = "xlnx,axi-iic-1.02.a", "xlnx,xps-iic-2.00.a";
    interrupt-parent = <&ps7_scugic_0>;
    interrupts = < 0 59 4 >;
    reg = < 0x41800000 0x10000 >;
    xlnx,family = "zynq";
    xlnx,gpo-width = <0x1>;
    xlnx,iic-freq = <0x186a0>;
    xlnx,instance = "axi_iic";
    xlnx,scl-inertial-delay = <0x0>;
    xlnx,sda-inertial-delay = <0x0>;
    xlnx,sda-level = <0x1>;
    xlnx,ten-bit-adr = <0x0>;
    #size-cells = <0>;
    #address-cells = <1>;

    };


0 Kudos
Scholar milosoftware
Scholar
9,560 Views
Registered: ‎10-26-2012

Re: Xilinx PL AXI-I2C + Linux. Work or not?

The problems you describe here sound more like bad pull-up configuration.

 

The pull-ups on the I2C bus need to be strong enough to rise to the Vcc level before the next clock edge. The value depends on board layout, number of devices and clock speed.

 

Too relaxed pull-up values lead to false "ack" signals, as the sda line is still at the "low" level when the next clock arrives.

 

Having said that, i did once connect an i2c device to one of the pmods, using about 20cm wires, and using only the internal IO pull-up from the zynq, and it worked flawlessly...

0 Kudos
Explorer
Explorer
9,554 Views
Registered: ‎02-16-2014

Re: Xilinx PL AXI-I2C + Linux. Work or not?

Yeah. Now I'm going thru everything...

 

First of all I'm using Vivado 2014.2 and Petalinux 2014.2 - I did review IP change log and went to check all changes in Xilinx kernel repo - nothing serious got changed.

 

Now I have total 4 I2C in my hardware design: 2 on PS side and 2 on PL (Xilinx AXI IIC).

I endup with simple prototype board with the only I2C device on it with 4.7k pull-up resistors. Device support 400k, 7 bit address - standard i2c sensor, no any fancy staff.

 

When device connected to PS i2c thru PMOD - I can read and write to it no problems. On scope I can see total number of SCL clocks about 19 or so, to adress and read 1 byte + ack.

 

When I connect same device to AXI I2C PMOD and try to read _invalid_ address - I can see SCL and SDA - 9 clocks or so and i2cget util report read failed. When I try to read _valid_ address for first time - I can see up to 30 or so clocks on SCL and some data on SDA and then both SCL and SDA go low and stay low forever (until reset).

 

I tryed to swap PMOD's - didn't change anything. I tryed to add internal Zynq's pull-up's - didn't change anything. Btw, signals looks good on a scope - both edge's looks good. I tryed different I2C sensor - same result.

 

I also tryed to change speed to 100k, but I have to do thru IP settings in Vivado, since changing it in a device tree didnt changed actual speed. Does it supported by the linux driver?

 

I checked IRQ numbers - everything looks good to me. I have some other IP blocks using interrupts and they report if something wrong, so I'm 99% sure IRQ's are correct.

 

Again, I'm going thru everything right now, because I'm  obviuosly missing something.

 

I tryed many different versions of DTS, but this is my current for AXI IIC:

 

axi_i2c_3: axi-iic@41610000 {
    compatible = "xlnx,xps-iic-2.00.a";
    interrupt-parent = <&ps7_scugic_0>;
    interrupts = <0 59 4>;
    reg = <0x41610000 0x10000>;
    xlnx,gpo-width = <0x1>;
    xlnx,iic-freq = <0x61a80>;
    xlnx,scl-inertial-delay = <0x0>;
    xlnx,sda-inertial-delay = <0x0>;
    xlnx,sda-level = <0x0>;
    xlnx,smbus-pmbus-host = <0x0>;
    xlnx,ten-bit-adr = <0x0>;
    #size-cells = <0>;
    #address-cells = <1>;
    bus-id = <3>;
} ;

 

Any suggestions?

 

0 Kudos
Explorer
Explorer
9,499 Views
Registered: ‎02-16-2014

Re: Xilinx PL AXI-I2C + Linux. Work or not?

terryo was right about wrong interrupt value specified in DTS, but... right( or at lease working for me) values for IRQ_F2P[1:0] is '32' and '31'.

 

Which is a big surprise for me.  Isn't Xilinx guide saying it should be 91 - 32? Can anybody comment on this?

0 Kudos