i2c-tools error in Xillinux-2.0, unable to read i2c-0 file

Post a reply

Confirmation code
Enter the code exactly as it appears. All letters are case insensitive.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :arrow: :| :mrgreen: :geek: :ugeek:
BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON
Topic review
   

Expand view Topic review: i2c-tools error in Xillinux-2.0, unable to read i2c-0 file

Re: i2c-tools error in Xillinux-2.0, unable to read i2c-0 fi

Post by support »

Hello,

Xillinux relies on Ubuntu's repositories for ARM, so there's no special such for Xillinux.

Besides, I've never heard of a package being removed from a repository. If anything, you might have added a repository the last time you installed the relevant package. But this is really a general-Linux issue, and you might want to seek assistance in forums related to embedded Linux.

Regards,
Eli

Re: i2c-tools error in Xillinux-2.0, unable to read i2c-0 fi

Post by gibinchacko90 »

I updated the apt-get. Still, it's not able to download the i2c-tools and showing error like "E: Unable to locate package i2c-tools". Is the i2c-tools removed from the package repository of Xillinux-1.3?

Re: i2c-tools error in Xillinux-2.0, unable to read i2c-0 fi

Post by support »

Hello,

I don't quite follow.

You say that you managed to get the i2c part running on Xillinux-1.3, so why don't you repeat whatever worked? Or maybe you need to refresh your apt cache?

Besides, is i2c-tools necessary at all? I don't see any reference to it. May the header file for the ioctl() call, which I would expect is present in a narrower package. But either way, if you got it working last time, you probably know better than anyone else.

Regards,
Eli

Re: i2c-tools error in Xillinux-2.0, unable to read i2c-0 fi

Post by gibinchacko90 »

Since i am not getting i2c through xillinux2.0. I am trying to set up i2c in the older version xillinux1.3. but during installation, i get following error.
apt-get install i2c-tools
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    E: Unable to locate package i2c-tools

Is there any way around it?

Re: i2c-tools error in Xillinux-2.0, unable to read i2c-0 fi

Post by support »

Hello,

The long way: Download Xillinux' kernel sources, run the relevant make defconfig command, and read the .config file.

The short way: Grab it from /proc/config.gz on a running Xillinux system (this works on a lot of Linux machines nowadays).

Regards,
Eli

Re: i2c-tools error in Xillinux-2.0, unable to read i2c-0 fi

Post by gibinchacko90 »

Where can I find the kernel config file in xillinux2.0?
In xillinux-1.3, its available in /boot as config-3.12.0-xillinux-1.3, but not available in /boot in xillinux2.0.

Re: i2c-tools error in Xillinux-2.0, unable to read i2c-0 fi

Post by support »

Hello,

Being root, it's hardly a permission problem. As a general suggestion, when open() fails, the recommended practice is to use perror to create a meaningful error message. See, for example, https://en.cppreference.com/w/c/io/perror

Also, take a look on the kernel log for anything related to i2c. The "dmesg" command prints them all out, or look at /var/log/syslog.

And if all fails, I would go for bitbanging the I2C signals on plain GPIOs, instead of relying on the ARM's built-in I2C. Bonus: No limitation on which pins are used.

It's not very CPU efficient, but that doesn't matter at all if I2C is used occasionally for setting up hardware. I'm not if the following example can be copy-pasted, but it gives an idea:

https://raspberrypi.stackexchange.com/q ... spberry-pi

Regards,
Eli

i2c-tools error in Xillinux-2.0, unable to read i2c-0 file

Post by gibinchacko90 »

i2c-tools was successfully working on xillinux-1.3. But recently I moved to xillinux-2.0 and facing issues in setting it up. I used the following steps:
1. Edited the xillinux-zedboard.dts file to recompile the device tree with following i2c information.
Code: Select all
i2c0: i2c@e0004000 {
compatible = "xlnx,ps7-i2c-1.00.a";  // calls out a xlnx driver already present in xillinux
      reg = <0xE0004000 0x1000>;   // memory address and size, fixed by Zynq HW for I2C0
      bus-id = <0>;
      clocks = <&clkc 38>;   // ref to sys clk #38 = I2C clock. Simply <4000000> didn’t work
      i2c-clk = <100000>;   // 100kHz standard slow I2C
      interrupt-parent = <&ps7_scugic_0>;   
      interrupts = <0 25 4>;
      #address-cells = <1>;   //default
      #size-cells = <0>;   // default
      };

2. Installed i2c-tools using following command:
    apt-get install i2c-tools

3. The part of program developed to access the i2c was as follows:
Code: Select all
    char *fname = "/dev/i2c-0";
   Fdiic = open(fname, O_RDWR);
    printf ("Fdiic = %d",Fdiic);
   if(Fdiic < 0) {
      printf("\nError initializing IIC");
      return -1;
   }

   Status = ioctl(Fdiic, I2C_SLAVE, ltc2657_address>>0);
   if(Status < 0) {
      printf("\n Unable to set the address\n");
      return -1;
   }

The execution gives error as:
Code: Select all
Fdiic = -1
Error initializing IIC


4. The /dev contains i2c-0 files has following permission:
    crw------- 1 root root 89, 0 Feb 11 16:30 i2c-0
    crw-rw---- 1 root i2c 89, 1 Feb 11 16:30 i2c-1
    crw-rw---- 1 root i2c 89, 2 Feb 11 16:30 i2c-2
    crw-rw---- 1 root i2c 89, 3 Feb 11 16:30 i2c-3
    crw-rw---- 1 root i2c 89, 4 Feb 11 16:30 i2c-4
    crw-rw---- 1 root i2c 89, 5 Feb 11 16:30 i2c-5
    crw-rw---- 1 root i2c 89, 6 Feb 11 16:30 i2c-6
    crw-rw---- 1 root i2c 89, 7 Feb 11 16:30 i2c-7
changing the permission using chmod 666 does not change the error. I even tried with i2c-1, still the result is same.
    crw-rw-rw- 1 root root 89, 0 Feb 11 16:30 i2c-0
    crw-rw-rw- 1 root i2c 89, 1 Feb 11 16:30 i2c-1
I am unable to access the i2c-0 file, any suggestions?

Top