Need help with MPU6050 self-test using Embedded MPL 1.1.1

By stephan_friesecke , 12 July 2011

Hello everyone,

I'm new to this forum. While trying to port Embedded MotionApps 1.1.1 to interface with a small ARM board via I2C, I encountered some problems.

Initially whoamitest failed. I found the following in whoamitest code:

#ifdef M_HW
regaddr = 117;
#else
regaddr = 0;
#endif

But M_HW is not mentioned in Embedded_MotionApps_Platform_User_Guide-V_3_1.pdf, so initially it's left as undefined.

Later I found the following in mpu6050a2.h:

MPUREG_WHOAMI, /* 0x75, 117 */

After correcting the regaddr, whoamitest passed. I think this means that wiring from my ARM board to MPU6050 evaluation board looks like correct, and my I2C driver code is working (at least for this part of the test).

The following test in driverselftest.c also passed:

test_open, test_single_write,
test_register_dump, test_fill_ram_in_chunks

But these tests just test if read or write operations are finished successfully. They don't perform comparison check (e.g., comparing value read back with value written to), so they might not mean much.

There were problems with all other tests.

1. No signal on CLKOUT (System clock output, pin 22 on MPU6050 chip)

While debugging problem using oscilloscope, I found no CLKOUT signal (it stayed flat at 0V) . Is it normal?

I initially thought this was cause of my problems, but later found that CLKOUT signal stayed flat even when using InvenSense ARM Reference Board. It looks like that PC_Demo_V2.9 was running fine with InvenSense ARM Reference Board.

2. test_single_wr

Although the print out indicated it passed, but I added the following line to compare value written with value read back,

printf("nwrote: 0x%02X %s read back:0x%02Xn",
write_val, (write_val==read_val? "==" : "!="), read_val );

and here is the output:

TEST SINGLE BYTE READ AND WRITE

wrote: 0xC6 != read back:0x00


--->>>> test_single_wr Success

Should test_single_wr be considered successful? Is the code correct for other chips but not for MPU6050?

3. test_fill_fifo

It failed since there were mismatches. Here is the output :

TEST Fill FIFO

There were 510 mismatches


--->>>> test_fill_fifo Success


4. test_burst_wr

Although it output "test_burst_wr Success" in the end, there were a lot errors like the following:

serial burst write and read failed at 1 B

test_burst_wr reads data starting from REG_BURST_START, which is defined as:

#define REG_BURST_START MPUREG_PRODUCT_ID

and MPUREG_PRODUCT_ID is defined in mpu6050a2.h:

#define MPUREG_PRODUCT_ID MPUREG_WHOAMI /* 0x75 HACK!*/

Since the comment says it's a HACK, is the test code valid for MPU6050?

5. test_fill_ram

It failed and here is last part of the output:

RAM area fill mismatch : 7E -> 7E != 01

RAM area fill mismatch : 7F -> 7F != 62

RAM area fill failed - memory write and read mismatch in 519 location


--->>>> test_fill_ram Success

I following a forum post, and changed definition of MPU_MEMORY_BANKS to the following in order to compile test_fill_ram and test_fill_ram_in_chunks successfully.

enum MPU_MEMORY_BANKS {
MPU_RAM_BANK_0 = 0,
MPU_RAM_BANK_1,
MPU_RAM_BANK_2,
MPU_RAM_BANK_3,
MPU_RAM_BANK_4,
MPU_RAM_BANK_5,
MPU_RAM_BANK_6,
MPU_RAM_BANK_7,
MPU_RAM_BANK_8,
MPU_RAM_BANK_9,
MPU_RAM_BANK_10,
MPU_RAM_BANK_11,
MPU_MEM_NUM_RAM_BANKS,
MPU_MEM_OTP_BANK_0 = 16
};

Since these code cannot pass compilation, it means that they have not been tested for MPU6050 by Invensense. Is test_fill_ram and test_fill_ram_in_chunks code valid for MPU6050?

6. testGyro in testmpu.c

It failed, and here is the output:

D/:Initialising test value.
I/:Reading Temperature: 0
I/:Packet Count: 0
I/:Incorrect packet count: 0
I/:Reading Temperature: 0
I/:Packet Count: 0
I/:Incorrect packet count: 0
I/:Reading Temperature: 0
I/:Packet Count: 0
I/:Incorrect packet count: 0
I/:Reading Temperature: 0
I/:xSum: 0, ySum: 0, zSum: 0
I/:xAvg: %f, yAvg: %f, zAvg: %f
I/:XRMS Test: %f, YRMS Test: %f, ZRMS Test: %f
I/:Temperature: %f

Here are first few reads/writes in testGyro:

MLSLSerialWriteSingle(pI2C, IMU_ADDR, 0x15, 0x07);
//sensor_bus_put(gyro.hal, 0x16, 0x03); // full scale = 250dps, filter = 42Hz, analog_sample rate = 1 KHz
MLSLSerialWriteSingle(pI2C, IMU_ADDR,0x16, 0x03);
MLSLSerialRead (pI2C, IMU_ADDR, 0x1b,
sizeof (dataout),dataout); //Read Temperature

And here is what's defined for 0x1b in mpu6050a2.h:

MPUREG_GYRO_CONFIG, /* 0x1b, 27 */

Thus for MPU6050, temperature is not stored at 0x1b. Is testGyro code valid for MPU6050?

It looks many selftest code come with Embedded MotionApps 1.1.1 are not valid for MPU6050. May someone in Invensense please send me a (informal, early access) copy of Embedded MotionApps code with correct selftest code for MPU6050?

I don't have full confidence on the small ARM board purchased elsewhere, since it even labels I2C SDA and SCL incorrectly on the board. My progress was stalled until discovering this labeling issue. Thus I'd like to first verify MPL porting and hardware setup are correct before moving forward.

Thanks a lot for your help!

bobf

phpbb Topic ID
13650