Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
10 years, 2 months ago.
connected, but getting all zeros for an output
hi,
I'm using your example code with the mbed lpc1768 and the MPU9150 eval board, i've uncommented the outputs in your main.cpp, i can see "MPU9150 is ready" on the terminal(so i figure the i2C connections is correct), but all the outputs are 0. I have the interrupt pin p15, connecting to MPU-9150 pin 12.
i understand all the 9-axis data should be in "buffer" variable but its all zeros. is there anything else i need to setup? does the interrupt need a pullup?
The interrupt is unused atm, the data is read from the fifo when there are more then 48 bytes, this also toggles LED1, does the LED flash for you?
posted by Chris Pepper 19 Oct 2014yes LED1 flashes rapidly.
posted by jonathan liu 19 Oct 2014That's odd, it sounds like everything is working, I cant think of any reason the fifo would get filled with zeros, even if the firmware transfer failed. could you assign extern Serial debug, in MPU9150.cpp and uncoment the debug messages in the initialiseDMP method. may give us a better idea whats happening.
posted by Chris Pepper 19 Oct 2014oh sorry i want to correct myself. LED1 is solid on. below is my output when uncommenting the debug messages in the initialiseDMP
terminal output
I made sure AD0 is pulled low, so device_address = 0x68, correct from datasheet. so im quite baffled. i also have a duplicate setup that performs the same way. any ideas?
posted by jonathan liu 20 Oct 2014ive extracted a bit more info. there is a write error on "0x6d"(109) which refers to "MPU9150::setMemoryBank". what is this?? i dont see anything about memory bank in the datasheet http://www.invensense.com/mems/gyro/documents/PS-MPU-9150A-00v4_3.pdf
terminal output
Writing the firmware to the chip isn't documented, at least not in any datasheet I could find, This library is derived from I2Cdev, The mpu9150 I have is revision E, it only has a very basic breakout board. what revision do you have?
posted by Chris Pepper 20 Oct 2014just noticed the write at the end of the terminal output to 0x6D succeeds, looks like the i2c is being erratic? too noisy long connections?
posted by Chris Pepper 20 Oct 2014it was a silly mistake. your code definitely works well my eval board has a LDO that i was using. but i switch the power src of the mpu9150 and now its works well.
Thank you Chris for helping!
posted by jonathan liu 20 Oct 2014Glad you got it sorted, a few things I need to mention about the code (as its unfinished I have a much easier to use version I haven't released yet), the i2c is currently set to 100kHz as mine was unstable at 400kHz, and the imu fifo is set to 20hz, which is definitely too slow, it can be modified on line 224 of dmpdata.h if you want to test, its explained in the comment, I'm currently trying to get the interrupt usable, as if it loses packet frame, it cant recover and the data stream becomes corrupt.
posted by Chris Pepper 20 Oct 2014i got another question, the outputs all seem to be relatively correct except for the accelerometer. when at rest, the accelerometer 3-axis values swing wildly positive and negative. And when i swing the MCU, there seems to be no consistent number.
Is there a special way to use the accelerometer properly? I changed "MPU6050_ACCEL_FS" from 2 to 16, any other parameters i should touch?
posted by jonathan liu 27 Oct 2014