I am trying to hook up MPU6050 from Sparkfun. What I am doing is trying to merge three trunks: 1) MP6050 driver 2) I2Cdev driver 3) Arduino sample code for MPU6050.
And also with one Arduino (.ino) example from here.
In this project, I have the file list as following
MPU6050_raw.ino (arduino file)
helper_3dmath.h
helper_3dmath.h (empty)
MPU6050_9Axis_MotionApps41.h
MPU6050_9Axis_MotionApps41.cpp (empty)
MPU6050_6Axis_MotionApps20.h
MPU6050_6Axis_MotionApps20.cpp (empty)
I2Cdev.cpp
I2Cdev.h
I also noticed that these libraries relate with “Wire” library which is porting to Spark internal firmware. So that I try to put //#include “application.h” to “I2Cdev.h”.
However, I got this error message as below,
It looks like the Wire object isn’t compatible somehow? No member function implemented? I’ve gone through forum but couldn’t get the right answer, any one experience this issue can give me some hint or suggestion?
Thanks!! xoxo
Harry
In file included from ../inc/spark_wiring.h:30:0,
from ../inc/application.h:31,
from I2Cdev.cpp:46:
../../core-common-lib/SPARK_Firmware_Driver/inc/config.h:12:2: warning: #warning "Defaulting to Release Build" [-Wcpp]
I2Cdev.cpp:53:14: warning: #warning Using outdated Arduino IDE with Wire library is functionally limiting. [-Wcpp]
I2Cdev.cpp:54:14: warning: #warning Arduino IDE v1.0.1+ with I2Cdev Fastwire implementation is recommended. [-Wcpp]
I2Cdev.cpp:55:14: warning: #warning This I2Cdev implementation does not support: [-Wcpp]
I2Cdev.cpp:56:14: warning: #warning - Repeated starts conditions [-Wcpp]
I2Cdev.cpp:57:14: warning: #warning - Timeout detection (some Wire requests block forever) [-Wcpp]
I2Cdev.cpp: In static member function 'static int8_t I2Cdev::readBytes(uint8_t, uint8_t, uint8_t, uint8_t*, uint16_t)':
I2Cdev.cpp:231:22: error: 'class TwoWire' has no member named 'send'
I2Cdev.cpp:237:40: error: 'class TwoWire' has no member named 'receive'
I2Cdev.cpp: In static member function 'static int8_t I2Cdev::readWords(uint8_t, uint8_t, uint8_t, uint16_t*, uint16_t)':
I2Cdev.cpp:351:22: error: 'class TwoWire' has no member named 'send'
I2Cdev.cpp:360:44: error: 'class TwoWire' has no member named 'receive'
I2Cdev.cpp:363:45: error: 'class TwoWire' has no member named 'receive'
I2Cdev.cpp: In static member function 'static bool I2Cdev::writeBytes(uint8_t, uint8_t, uint8_t, uint8_t*)':
I2Cdev.cpp:597:14: error: 'class TwoWire' has no member named 'send'
I2Cdev.cpp:611:18: error: 'class TwoWire' has no member named 'send'
I2Cdev.cpp: In static member function 'static bool I2Cdev::writeWords(uint8_t, uint8_t, uint8_t, uint16_t*)':
I2Cdev.cpp:652:14: error: 'class TwoWire' has no member named 'send'
I2Cdev.cpp:666:18: error: 'class TwoWire' has no member named 'send'
I2Cdev.cpp:667:18: error: 'class TwoWire' has no member named 'send'
make: *** [I2Cdev.o] Error 1
Error: Could not compile. Please review your code.
Yeah, that’s not going to port over easily. Someone is going to need to rewrite that I2C abstraction library I think.
I actually started writing an MPU6050 library a couple of weeks ago on a unit I’ve had for months. That is until I realized their whole “9-Axis Sensor Fusion” claim was a huge crock of horseshit and doesn’t even exist. (It’s only 6-Axis and to this day they still haven’t officially released the I2C registers needed to enable it, someone had to reverse engineer one of their preprogrammed dev boards to figure it out.)
That said, I will take a deeper look at that library for you in the next few days, unless someone else wants to take a crack at it.
mamahow, just a few things right off the bat. To compile theMPU6050_raw example you included these files:
In this project, I have the file list as following
1. MPU6050_raw.ino (arduino file)
2. helper_3dmath.h
3. helper_3dmath.h (empty)
4. MPU6050_9Axis_MotionApps41.h
5. MPU6050_9Axis_MotionApps41.cpp (empty)
6. MPU6050_6Axis_MotionApps20.h
7. MPU6050_6Axis_MotionApps20.cpp (empty)
8. I2Cdev.cpp
9. I2Cdev.h
I got everything compiling and it should work with the Spark from what I can see. I will post the code on my github as soon as I get a few things done. Back soon.
Mike43110, I’m only porting the code for you as I can’t actually test it. The only reference to calibration code is in the MPU6050_6Axis_MotionApps20.h file which I am still working on porting. Is that what you mean by the calibration code?
Mike43110, for some reason, I cannot compile the MPU6050_DMP6.cpp sketch that uses MPU6050_6Axis_MotionApps20.h on the web IDE. However, with the latest firmware master, it will compile locally. I put all the code on my github and if you want, I can put the firmware.bin if you want to dfu via USB to your core.
I was going to try your library with a MPU6050 breakout board I’ve got, but I don’t see where to set the pins to use for SCL and SDA? Am I missing something?
Well bummer. I added the 10K pull-ups, but I’m still getting “connection failed”. I’ve even tried forcing the AD0 line low or high, and changing the I2C address from 0x68 to 0x69.
Dougal, I looked at the specs for the module and it already has pull-ups so you can remove the other ones. let me take a look at everything and get back to you later.
Hey!
I was looking for ported libraries of MPU6050 and I2Cdev. @peekay123, there’s one repository that’s been assembled from yours that I suddenly found today: https://github.com/kraken-down/MPU6050
Unfortunately, there are a lot of errors in those files and some are fatal, which stops compilation.
Is there a solution to these?
In file included from ../inc/spark_wiring.h:30:0,
from ../inc/application.h:29,
from /I2Cdev/I2Cdev.h:49,
from /I2Cdev/I2Cdev.cpp:46:
../../core-common-lib/SPARK_Firmware_Driver/inc/config.h:12:2: warning: #warning "Defaulting to Release Build" [-Wcpp] #warning "Defaulting to Release Build"
^
In file included from ../inc/spark_wiring.h:37:0,
from ../inc/application.h:29,
from /I2Cdev/I2Cdev.h:49,
from /I2Cdev/I2Cdev.cpp:46:
../inc/spark_wiring_ipaddress.h: In member function 'IPAddress::operator uint32_t()':
../inc/spark_wiring_ipaddress.h:53:52: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
operator uint32_t() { return ((uint32_t)_address); };
^
../inc/spark_wiring_ipaddress.h: In member function 'bool IPAddress::operator==(const IPAddress&)':
../inc/spark_wiring_ipaddress.h:54:72: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
bool operator==(const IPAddress& addr) { return (((uint32_t)_address)) == (((uint32_t)addr._address)); };
^
../inc/spark_wiring_ipaddress.h:54:105: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
bool operator==(const IPAddress& addr) { return (((uint32_t)_address)) == (((uint32_t)addr._address)); };
^
/MPU6050/MPU6050.cpp:37:29: fatal error: MPU6050.h: No such file or directory #include "MPU6050.h"
^
compilation terminated.
make: *** [/MPU6050/MPU6050.o] Error 1
@LIGHThouse, I’m just glad the library is out there. It looks like Kraken did not include all the files and I2Cdev.h and .cpp files are missing. Also the example program was not separated. I will build a correct library and should have it posted in the next 30mins or so.
@peekay123, Kraken has kept I2Cdev in a separate repository, which i guess is because there are two separate libraries. Anyway, the repo looks recently modified and I’m glad I found it soon after.
@LIGHThouse, I saw that. However, he did not make any reference in the README file. There are other issues as well. There is an ongoing discussion with library dependencies on the IDE.
Thanks for that update, @peekay123!
What are the other issues? I don’t think it might be with the 2 libraries inherently because they’re individually ported nicely.
Again, the problem is was about MPU6050.h referring to I2Cdev.h, just the way you’re saying. There isn’t anything else, is there?