Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using global and mgos_i2c_create causes read/write failures. #11

Open
siftd106 opened this issue Mar 7, 2019 · 1 comment
Open

Using global and mgos_i2c_create causes read/write failures. #11

siftd106 opened this issue Mar 7, 2019 · 1 comment

Comments

@siftd106
Copy link

siftd106 commented Mar 7, 2019

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

@siftd106 siftd106 changed the title Using global and mgos_i2c_create fails. Using global and mgos_i2c_create causes read/write failures. Mar 7, 2019
@rojer
Copy link
Contributor

rojer commented Mar 8, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants