Problem using I2C on mangOH green


#1

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?


#2

Where is the I2C device physically connected to your system? Is it in an IoT slot? What does ls -l /dev/i2c* show?


#3

The device is plugged into IoT slot 0. Results:

root@swi-mdm9x28:~# ls -l /dev/i2c*
crw-rw---- 1 root root 89, 4 Jan 1 1970 /dev/i2c-4


#4

We haven’t tested the mangOH SDEF against the wp76xx yet. I expect that some part of the mangoh kernel module is failing.