LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.

Notices


Reply
  Search this Thread
Old 08-12-2019, 12:10 PM   #1
StevenJC
LQ Newbie
 
Registered: Aug 2019
Posts: 1

Rep: Reputation: Disabled
Adding I2C devices for embedded 4.9.89 linux


Having trouble talking to new devices. From user space:
Code:
 const char *i2cDevice1 = "/dev/i2c-1";
 int i2cAddr = 0x59;
 int fdI2c1 = open(i2cDevice1, O_RDWR); /* this works */
 if (ioctl(fdI2c1, I2C_SLAVE, i2cAddr) < 0) {
    printf("I2C Error 2. Bye.\n");
    return 0;
 }                                      /* this works */
 if (write(fdI2c1, buf, 2) != 2) {
    printf("I2C Error 3. Bye.\n");
    return 0;
  }                                     /* this FAILS */
Tried simply tweaking the Device Tree Source (.dts file) in linux-4.9.89/arch/arm/boot/dts by adding max3107 block below:
Code:
&i2c2 { 
        clock-frequency = <400000>;
        max3107@58 {
                      compatible = "maxim, 3107";
                      reg = <0x58>;
                   };
};
and rebuilt kernel and dtb. This did not seem to do anything since I still get the same error from my code and the i2cdetect utility still doesn't see a device 0x59.

Code:
# i2cdetect -y -r 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- UU -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
Suggestions?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ipxe smbus i2c driver i2c-i801.c toma642 Linux - Hardware 0 01-08-2019 07:45 PM
i2c-dev.h missing i2c read/write functions dbrazeau Programming 1 12-17-2015 10:40 PM
How to forward IOCTL's from i2c-dev.c to adapter driver (i2c-rt3352.c) elonica.pl Linux - Kernel 2 08-23-2011 02:03 AM
[SOLVED] No /dev/i2c-0 entry after insmod i2c-dev sajnanazeer Linux - Newbie 1 08-10-2011 07:39 AM
Help! Problems with i2c-dev. No more /dev/i2c-* em1l Fedora 0 10-28-2005 05:48 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 06:44 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration