Note that there are some explanatory texts on larger screens.

plurals
  1. POwrite()ing to i2c device: Operation not permitted
    primarykey
    data
    text
    <p>So I have 2 PCA9555 (16 channel digital I/O) chips connected to a small embedded device running Linux over i2c. The PCA9555 devices have 7 bit addresses 0100000 and 0100001.</p> <p>When I power up the board, I run:</p> <pre><code># modprobe i2c-i801 # modprobe i2c-dev # i2cdetect -l i2c-0 smbus SMBus I801 adapter at 0500 SMBus adapter # i2cdump -y -r 0 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- ... (Same for every line) 70: -- -- -- -- -- -- -- # dmesg|tail i801_smbus 0000:00:1f.3 Transaction timeout ... (For every '--' in i2cdump, one of these errors outputted) i801_smbus 0000:00:1f.3 Transaction timeout </code></pre> <p>So then I tried to write a simple program to set all pins on the first PCA9555 chip to output high:</p> <pre><code>char *file; unsigned char buf[3]; int addr, fd; file = "/dev/i2c-0"; addr = 0x20; /* 0100000 */ if((fd = open(file, O_RDWR)) &lt; 0){ err(1, "open()"); } if(ioctl(fd, I2C_SLAVE, addr) &lt; 0){ /* also tried I2C_SLAVE_FORCE */ err(1, "ioctl()"); } /* Set all digital I/Os to output */ buf[0] = 6; buf[1] = 0x00; buf[2] = 0x00; if(write(fd, buf, 3) != 3){ err(1, "write() 1"); } /* Set all outputs high */ buf[0] = 2; buf[1] = 0xFF; buf[2] = 0xFF; if(write(fd, buf, 3) != 3){ err(1, "write() 2"); } return 0; </code></pre> <p>Running this returns:</p> <pre><code># ./i2c ./i2c: write() 1: Operation not supported </code></pre> <p>So I don't really understand what I'm doing wrong. Assuming the hardware is wired correctly where do I go from here?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload