Closed dminskiy closed 5 years ago
@dminskiy - At first glance I'm thinking that even if you have started 'IMUWire' correctly that it is not being used in the MPU9250_DMP library because it is currently hard-coded to use Wire (as opposed to Wire1, Wire2, etc...) I will add support for using your own wire port and then try your code.
So I spent a while longer trying to add flexibility to what I2C port you use. The way I see it there are two parts to the challenge:
1) The DMP version of the library is based on a set of functions provided by InvenSense (you can find them in the src/util folder). These functions are pretty rigid - they have hardcoded data structures that contain device-specific values such as the I2C address (defaulting to 0x68). They specified an interface that requires I2C. I think that this part will be easy to modify to accept other valid I2C ports.
2) The other challenge is to reconfigure the peripherals and multiplexing so that your new pins can actually use Wire. From what I can tell (I'm new to the SAMD21) you will effectively be making a new "variant" of the board that includes more I2C peripherals and fewer other serial interfaces.
In the future I think it would be cool to support an easy way to reconfigure the board into custom variants. Please don't hesitate to shoot any more questions this way!
Hi @dminskiy ,
I'm not sure if you got this working already but you should check out this neat tutorial that might be of some use on adding additional SERCOM ports => [ https://learn.sparkfun.com/tutorials/adding-more-sercom-ports-for-samd-boards/all#adding-an-i2c. I haven't tried this specifically with the 9DoF Razor. However, I was able to add custom SERCOM ports on the SAMD21 RedBoard Turbo. You'll have to check the board defs and some datasheets for the 9DoF Razor to see if it is possible.
Hello! I've been trying to change standard Wire to the custom pins 3 and 4. I tried my best which is definitely not enough. I've done it with other sensors, they worked fine. It's just me not being able to put the code in the right place. Can you give any advice on that, please?
Here's the code I'm trying out:
P.S. I tried the beginning of .begin() func in ...MPU9250-DMP.cpp, inv_mpu.c and arduino_mpu9250_i2c.c
Thank you! Dmitry