I am trying to use the I2C interface on the mangOH green using a wp7603. I can open the i2c-4 file and send ioctl commands, but whenever I try to write I get this error:
Error code 107: Transport endpoint is not connected
Here is my code:
int main()
{
int i2c_fd = open("/dev/i2c-4", O_RDWR);
cout << "fd: " << i2c_fd << endl;
while (true)
{
if (ioctl(i2c_fd, I2C_SLAVE_FORCE, 0x5a) < 0)
{
cout << "Error with ioctl call: " << errno << " " << strerror(errno) << endl;
}
else
{
if (write(i2c_fd, "asdf", 4) < 0)
{
cout << "Error with write call: " << errno << " " << strerror(errno) << endl;
}
}
sleep(1);
}
}
Which always spits out this output:
fd: 3
Error with write call: 107 Transport endpoint is not connected
Error with write call: 107 Transport endpoint is not connected
Error with write call: 107 Transport endpoint is not connected
At which point I just kill it…
From the hardware side, I have tried it while connected to a slave device, not connected, connected to a Logic Analyzer, with and without pullup resistors, but at no point did I see any activity on the bus.
Am I doing something wrong or missing some configuration with the I2C bus? i2c-4 is the only file I see in /sys/class/i2c-dev, is there another device I should be using?