Comments (9)
Hi @Koepel - thanks for all of your feedback on all of these libraries. If you'd like to open pull requests with the aforementioned fixes, we can test those and merge them in to make sure you get credit.
Thanks!
from mma8452_accelerometer.
When writing new libraries, I hope Sparkfun will use the Arduino Wire library the way it is meant to be. My issues are there that when a library needs a change, that issue with the Wire library can be solved as well.
The issues will not return 'bad' data. For example a Wire.beginTransmission() before a Wire.requestFrom() does nothing. And a Wire.endTransmission() after Wire.requestFrom() puts the address on the I2C bus and the sensor acknowledges that. But that does not do any harm.
On the Arduino forums I'm seeing the wrong use of the Wire library so many times. That is why I made the issues here on Github. Many people copy the code or use it as an example. I don't need credits.
from mma8452_accelerometer.
So, Keopel, perhaps you can answer this question I have always had about the Sparkfun MMA8452 library - why can't you use the standard Wire library with interrupts? The advanced example uses a different set of header files for i2c and not Wire. Why?
Thank you, Chip
from mma8452_accelerometer.
@chipmc, I don't know. Sparkfun uses direct low level I2C code with more sensors.
I prefer the Arduino Wire library, because bugs get fixed and it is (almost) the same for all the processors. It is interrupt driven, but the Wire.endTransmission() and Wire.requestFrom() wait until everything is finished. That is the way it works. It can not be changed without changing the complete Wire library. Maybe, someday, there will be a new and better Arduino library for I2C.
If you mean, why can't the Wire library be used inside one of your own interrupt service routines, that is because the Wire library uses interrupts itself.
from mma8452_accelerometer.
Koepel, I also prefer to use the standard libraries. In the comments section of the Sparkfun Advanced Example sketch, there is the following explanation:
"Note: The MMA8452 is an I2C sensor, however this code does
not make use of the Arduino Wire library. Because the sensor
is not 5V tolerant, we can't use the internal pull-ups used
by the Wire library. Instead use the included i2c.h, defs.h and types.h files."
I guess I was wondering what they meant by this or if there is - in fact - some limitation in the Wire library that prevents its use with a 3.3V sensor.
Thanks, Chip
from mma8452_accelerometer.
The Wire library enables the internal pullup resistors. For an Arduino Uno, that is about 50k to 5V. That could lift the voltage of SDA and SCL above the safe levels of the sensor.
The I2C voltage level problem can be avoided with a 3.3V board, or a 5V board with the SparkFun Logic Level Converter.
from mma8452_accelerometer.
Fixed in the main lib a long time ago. Pulled in with the latest commit
from mma8452_accelerometer.
In the file "MMA8452_Accelerometer/Firmware/MMA842Q Sketches/MMA8452Q_BasicExample/MMA8452Q_BasicExample.ino", there is still this wrong line:
while(Wire.available() < bytesToRead); //Hang out until we get the # of bytes we expect
and that is still copied by others.
Please remove that line.
Explanation: Common-mistakes#1
from mma8452_accelerometer.
Old firmware removed from repo.
from mma8452_accelerometer.
Related Issues (10)
- x, y, z values not processing correctly HOT 1
- Wrong mask HOT 3
- Hangs when using 2 accelerometers HOT 3
- Problem with sampling frequency HOT 9
- A4/5 pins HOT 1
- Hangs on Leonardo HOT 2
- Signedness bug in Basic Example HOT 1
- Teensy 2.0 HOT 1
- wrong g calculation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mma8452_accelerometer.