Closed digitaldanny closed 3 years ago
This University of Illinois edit to the MPU9250 SPI interface is extremely helpful. Page 4 includes a timing diagram to compare with my waveforms output.
Still having trouble getting any response from the MPU6500. I am trying to read from the WHO_AM_I register (address 0x75) through both the I2C and SPI interfaces, and I am documenting what I have tried below.
I2C
MSP432 to MPU6500 breakout connections for I2C | MSP432 Pin | MSP432 Pin Mux | MPU6500 Breakout Pin |
---|---|---|---|
P6.4 | SDA | SDA | |
P6.5 | SCL | SCL |
SPI
MSP432 to MPU6500 breakout connections for SPI | MSP432 Pin | MSP432 Pin Mux | MPU6500 Breakout Pin |
---|---|---|---|
P1.5 | SCLK | SCL | |
P1.6 | MOSI | SDA | |
P1.7 | MISO | AD0 | |
P3.5 | GPIO CS | nCS |
Got an Arduino Nano in today. I'm going to use this with the Arduino's MPU6500 library to check if my breakout board's are defective. If I can read the WHO_AM_I register with the Arduino, there is something wrong with my MSP432 SPI/I2C drivers. If not, my breakout boards are defective and I will switch to using the MPU6050 instead.
I was able to use the Arduino as an I2C scanner. The scanner returned "No device found" for both MPU6500 breakout boards, but I am seeing a device found at 0x68 for the MPU6050 breakout boards. This test confirms that both of my MPU6500 breakout boards are defective, so I will be switching to the MPU6050 and will have to do the sensor fusion algorithm on the MSP432 instead of offloading to the DMP.
Using the Arduino files included here for the MPU6050, and I am seeing the following sensor outputs. I will port this library to work with the MSP432.
Also, this link has some Arduino code for calculating the MPU6050 offsets.
https://42bots.com/tutorials/arduino-script-for-mpu-6050-auto-calibration/
This library is based on the Jeff Rowberg drivers, but requires dynamic memory. Going to try avoiding this for now if possible.
This library uses floating point math and requires this compile flag (--float_support=fpv4spd16).
Having trouble with the MPU6050's DMP. I am going to simply read the raw accelerometer / gyroscope values and convert to euler angles using this repo. It looks like there are not any external dependencies for the algorithm, so it should be (as close as possible) to plug and play.
Need to implement a "millis()" function to capture the amount of time elapsed since last capture. This is critical to the quaternion calculations.
I am going to keep the mpu6050 DMP library in for now because I think the millis function may affect the data I am seeing. Right now, I am hardcoding the millis function to 0, so there is never a time delta.
TODO
I wanted to try using SPI for this because noise over the lines will not matter as much, and I will not hang for i2c NACK issues. Look like my breakout board does not provide a pin for the CS line. Since my SPI lines are also controlling the LCD, the CS line is important for this application. Will have to make the i2c drivers work for this.
Going to focus on getting the main program developed and the DSP Effects Rack project up and running. Will come back to this before my final demo as long as everything else is working right.
Arduino Raw Value Burst Read
MSP432 Raw Value Burst Read Hang
Looks like the I2C hang issue was solved by switching to my I2C drivers from the MicroMania project. Still seeing all 0 data being returned. Currently looking into this issue.
Figured out why the device was returning only 0's. My configuration to wake up the device by writing to the PWR_MGMT register was pointing to the wrong address. Previous I wrote to address 0x68 when the correct address is 0x6B.
/* MPU6050_PWR_MGMT_1 */ {0x6B, 0x00}, // Wake up device
Describe the solution you'd like
Additional context
39 - Gyro / Accel connections.