ARGroup Aleš Ruda

How to get working PS I2C in Xillinux

by Administrator 14. November 2012 12:31

I would like to join camera Aptina MT9V034 to the ZedBoard. The camera is configured via I2C bus and video data will be processed using the PL. To save PL resources I want to use PS I2C.

  1. Configure I2C in XPS. Double click on system.xmp in the "boot image creation kit"\system. In my case MIO 10..11.
    Zynq configuration
    Zynq configuration
  2. It is necessary to rebuild FSBL. From XPS export a project to the SDK and add new standalone project Zynq FSBL. Select Release configuration and rebuildit project. Copy compiled ... \Release\FSBL.elf to "boot image creation kit"\boot.
  3. Regenerate boot.bin. Run the makeboot.bat In the folder "boot image creation kit"\boot and resulting boot.bit copy to first partition of the SD card.
  4. Recompile the kernel.
    1. Download sources.
      $ git clone
    2. Apply patches from "/usr/src/xillinux/kernel-patches".
    3. Edit ".config". Set CONFIG_I2C_CHARDEV option to y.
    4. $ make
    5. Copy arch/arm/boot/zImage to the first partition of the SD card.
  5. Edit DTS.
    1. Decompile a DTB.
      $ dtc -I dtb -O dts -o devicetree.dts devicetree.dtb
    2. To node ax@0 in devicetree.dts supplement.
      i2c0: i2c @ e0004000 
         compatible = "xlnx, PS7-i2c-1.00.a";
         reg = <0x1000 0xE0004000>;
         interrupts = <0 25 0>;
         interrupt-parent = <1>;
         bus-id = <0>;
         input-clk = <111111111>;
         i2c-clk = <100000>;
         # address-cells = <1>;
         # size-cells = <0>;
    3. Compile DTB.
      $ dtc -I dts -O dtb -o devicetree.dtb devicetree.dts
  6. Reboot ZedBoard.
  7. In /dev exists i2c-0.
  8. Type
    $ I2cdetect-l
    i2c-0 i2c XILINX I2C I2C adapter at e0004000



Comments (9) -

11/23/2012 4:46:33 AM #


Thanks for this tuto but i can't decompile my DTB file, I have got an error message like this :

DTC: dts->dtb  on file "devicetree.dtb"
devicetree.dtb:1 syntax error
FATAL ERROR: Unable to parse input tree

Can you help me please ?
my best regards ascherit

11/23/2012 8:56:30 AM #

It is my bug in step 5a. Input and output formats were swapped.

$ dtc -I dts -O dtb -o devicetree.dts devicetree.dtb

Right command is

$ dtc -I dtb -O dts -o devicetree.dts devicetree.dtb


11/24/2012 6:00:51 AM #

Thank you very much.
and Sorry to don't see this before to

12/6/2012 2:25:14 AM #


Sorry to disturb you again but did the  /dev/i2c-0 exist before you plug your i2C component or only when you plug it ?

1/4/2013 1:57:53 AM #

/dev/i2c-0 is bus interface. It exists independently on devices on I2C bus.

1/8/2013 7:50:26 AM #

Hi all,

I wanted to know whether, if I enable I2C via MIO port in ZedBoard then I can from an application written for Linux in C or C++ to communicate with I2C device(camera) using native libraries for Linux without using VHDL or Verilog in Xilinx Zynq Linux?

1/10/2013 10:00:07 AM #

Hi Pawel,
Yes, if you use PS (ARM portion of Zynq) I2C on MIO you need not write any HDL code for communication with I2C. But usualy camera chip uses I2C for configuration and for video stream uses other port as LVDS lines or CMOS paralel interface. You will probably must write some HDL code for this second port.

1/8/2013 1:49:13 PM #

Whether need to enable interrupts for I2C?

1/10/2013 10:11:21 AM #

I am not sure that I understand. Used I2C interrupt is configured in DTS and I2C driver enables interrupt while initializing.

Comments are closed

Month List