mongoose-os-libs/i2c

Using global and mgos_i2c_create causes read/write failures.

Opened this issue · 1 comments

Hello,

It appears there is some type of issue/bug with the creating of an i2c bus maually and also using the i2c bus from the get global.
This was working fine back in firmware version 2.7, however when we upgraded to 2.12.1 we ran into the issue.

How I we were using the i2c buses.
We do some initialization code on the global i2c bus, then initialize the secondary i2c. All of this happens without errors. Then when we try to read/write to the global i2c, the read/writes return false.

Removing the secondary manual create resolves the problem (as a debugging measure), and then reading/writing to the global i2c works as expected.
I notice that an i2c1 was added to the config, so switching to using this, instead of manually creating the i2c also resolves the problem.

I traced the issue down to within the mgos_i2c_exec function. The ints (dev->int_raw.val) variable was 1600, during the read/writes that failed. This line

ok = (ints & I2C_DONE_INTS) && !(ints & I2C_ERROR_INTS);
is as far as I traced down the "issue".

-siftd106

rojer commented

hm. i'm not sure i quite follow at the moment. can you share an example application that demonstrates the problem?