Giter VIP home page Giter VIP logo

Comments (5)

YifanAtBioRoboLab avatar YifanAtBioRoboLab commented on August 17, 2024 1

Hi There,
I just happen to see this closed issue. Actually I have just encountered the exact same issue and I think I should put my solution here as a clue.

The main reason openCM9.04 and BNO055 cannot work together correctly is about the clock stretching. The BNO055 will pull down the SCL to low before and after the ACK signal for about 120 microseconds each. The hardware I2C of other devices can detect such a scenario and hold communication during that time. Yet the SlowSoftI2CMaster lib (which is used in the wire lib of openCM9.04) is lacking such ability, continuing sending the clock signal during that time which would not show up because of the SCL pulling low. And therefore the whole signal sequence afterward would be messed up because of such clock missing.

My simple solution is in SlowSoftI2CMaster.cpp, below L98, L104, L120, L126, adding the following code:
while(digitalRead(_scl)!=HIGH);
This line will do the job to detect the scenario I mentioned before and confirm the clock signal's integrity. You can change this code to some other detection methods with a timeout if there do have a possibility that something can pull the SCL to low for an unacceptable amount of time.

from opencm9.04.

OpusK avatar OpusK commented on August 17, 2024

Hi, @TahaShafa

I can not check the operation because I do not have that hardware.

Wire.h in OpenCM 9.04 uses software i2c, which can cause this problem because of the slow speed.

In the case of I2CDev, it is an API that is incompatible with the Wire example code. Unless you modify the code to match the I2CDev API, it will not be available.

from opencm9.04.

OpusK avatar OpusK commented on August 17, 2024

This issue will be closed since there were no actions for a while. You can reopen this issue to show this issue to the users whenever. Thanks.

from opencm9.04.

iicfcii avatar iicfcii commented on August 17, 2024

I was also trying to use OpenCM9.04 with Adafruit BNO055. The above solution does not work for me but it is really close. Instead, I only added the following line after line 103 and line 121(both lines are setHigh(_scl);) in SlowSoftI2CMaster.cpp located at Arduino15/packages/OpenCM904/hardware/OpenCM904/1.5.1/libraries/Wire.

while(digitalRead(_scl)!=HIGH);

I also noticed that if I tried to pull the data from the sensor too fast(greater than about 300Hz), it will return zeros from time to time. As long as the polling rate is not too fast. It works pretty well.

After also adding one after line 85, the data didn't drop anymore.

from opencm9.04.

lianuo avatar lianuo commented on August 17, 2024

same issue~, with BNO055,hope the example code can add a i2c code .

from opencm9.04.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.