[urgent] Cannot read product revision on MPU6050 eval board

By morten_tychsen , 20 September 2011

Hello,

I use MPU6050EVB with i2c connection to separate AVR32UC3 controller.

When I call the function umplStartMPU(), the product revision "prod_rev" in the function inv_get_silicon_rev_mpu6050() cannot be read correctly. It reads always 0. This gives us an error "INV_ERROR_INVALID_MODULE". So I tried to give a value directly to "prod_rev"(from 1 to 15 and 27). And I got another problem, in the function inv_mpu_set_firmware(), I cannot successfully write and read the memory, it means that the elements of "data" are different from those of "read", which gives us an error "INV_ERROR_SERIAL_WRITE".
Any idea?

thanks

morten_tychsen

14 years 5 months ago

@app1engineer wrote:

Resetting the device and waiting 15ms should resolve this issue.


I have tried it and I have also added several ms of delay between the read/write. But the issue cannot be resolved.
phpbb Post ID
17955

oc0001

14 years 1 month ago

Was there another answer to this? I'm having the same problem. I have two eval boards and they both exhibit the same behavior. Can't read product rev. or load what I assume is the dmp code. I'm attempting to port to the UC3C architecture but not getting past this block.

Thanks

phpbb Post ID
17958

jims_li

14 years 1 month ago

It appears that you may be having a problem accessing the DMP memory, which is where the product rev is located.

Can you provide the following information so that we can further look into the issue -

1. We are asusming you are using the MPU-6050 boards to port to the UC3 platform. Is that correct ?

2. Which version of the library are you using. Is it A2 or B1 ?

3. Did you call the umplInit function ? umplInit is the entry point to uMPL and must be called before all other functions.

phpbb Post ID
17961

oc0001

14 years 1 month ago

1) Yes, I am using the MPU-6050 EVB. I have tried both building my own code up using the embedded apps and approached it by using the uc3_a3_xplained code with the necessary modifications for the UC3C and my board.

2) I am building it as a 6-DOF board using rev B1. (The EVB board itself is 9 DOF capable so I assumed that was the correct rev to chose.)

3) Yes, in both cases umplInit is called. I can confirm that TWI is working for
the other registers, but it appears that the writes to mem (i.e. anything using inv_serial_write_mem) isn't taking. The read_mem returns non-zero data but it clearly doesn't match what was written. Unlike the above case, it still doesn't work even if I skip bank 0. The request for rev often returns something like 49.

phpbb Post ID
17964

vrmmeh

14 years 1 month ago

@punk wrote:

I can confirm that TWI is working for
the other registers, but it appears that the writes to mem (i.e. anything using inv_serial_write_mem) isn't taking. The read_mem returns non-zero data but it clearly doesn't match what was written. Unlike the above case, it still doesn't work even if I skip bank 0. The request for rev often returns something like 49.


I have run into the same problem. I discovered that the mem bank reads appear to be reading sequential registers instead of repeated bytes from the same MEM_R_W register. The data read did not match what I wrote, but it did match what I expected to see in the next register addresses, all the way up until I ran out of registers to read.

It is likely that the I2C read/write code implementation you are using is behaving differently from that built into MotionApps (this is my current hunch, but I haven't verified and solved it yet). I2C supports a repeated-start condition, but some implementations don't make use of it. I believe that repeated starts are necessary to use the MEM_R_W register as intended. I could be wrong, but maybe now you have another place to look that will lead to a helpful discovery.
phpbb Post ID
17967

nikchu

14 years ago

Same problem here I think!

Has anyone figured it out? Is the problem in the AVR Software Framework, that TWI functions are behaving in different way?

I thought that the TWI functionality came from the ASF that is included in the project downloaded from Invensense? Can it be that AVR Studio 5.1 automatically uses a newer version of the files if they are installed on the computer?

phpbb Post ID
17973

markw

13 years 10 months ago

@app2engineer wrote:

Repeated start condition is supported by the library. You can use it with the MEM_R_W register. Please let us know if it helps solve the issue.


Hello,

I am using a Luminary LM3S811 to implement the MotionApps, and I have the same problem : In the function inv_get_silicon_rev_mpu6050, when I am trying to read prod_rev, I read 0.

I am using a MPU6050 revision D. (I read "1202 D" on the chip).

Thanks for your help.
phpbb Post ID
17976

markw

13 years 10 months ago

Yes I have the EMBEDDED_MOTIONAPPS-V2_0_2Rel-MPU6050-6axis-2012-05-02-1255 downloaded last week.

I use the IDE : Code Composer Studio v4 because I use a µC from Texas Intruments.
I have compiled with all DEBUG settings set to NONE, as it is said here : https://invensense.tdk.com/developers/forum/viewtopic.php?f=3&t=155. In CCS4 it seems to be in basic option of the compiler and it is called suppres all symbolic debug generation
But I still have :
prod_ver = 8
prod_rev = 0
index = 65535
Unsupported product key 800 in MPL

phpbb Post ID
17982

guy_mcilroy

13 years 10 months ago

800 is an invalid key. The prod_rev value comes from OTP memory, and prod_rev = 0 usually means that either the DMP read/write function was ported incorrectly, or the startup delay isn’t fast enough.

phpbb Post ID
17985

vrmmeh

13 years 10 months ago

@sectionsbest wrote:

...or the startup delay isn’t fast enough.


What is the startup delay, as it relates to DMP usage and/or memory bank read/write operations? I have had mixed success with my own experiments here, and while the code I have right now appears to be working, I am not sure why based on the changes I made (none of which seem like they were significant enough to fix everything all at once). Is there a required minimum or maximum delay after power-on or reset before you can read memory banks, or write them?
phpbb Post ID
17988

markw

13 years 10 months ago

Hello,

I manage to make the initialization works, with your recommendation (not read MPU register before 30ms). I had some problems after that because my stack memory was to small ... I fixed it.
Now I can go inside the Loop and read Quaternions, but there is a problem in the values of the quaternions, they are always as follow :
[64, 0, 0, 0, 0, 0, 0, 0] (I don't display buttons and packetCount++)
I used this code to format the output values :

out[0] = (unsigned char) (longquat[0] >> 24);
out[1] = (unsigned char) ((uint16_t)(longquat[0] >> 16) % 256);
out[2] = (unsigned char) (longquat[1] >> 24);
out[3] = (unsigned char) ((uint16_t)(longquat[1] >> 16) % 256);
out[4] = (unsigned char) (longquat[2] >> 24);
out[5] = (unsigned char) ((uint16_t)(longquat[2] >> 16) % 256);
out[6] = (unsigned char) (longquat[3] >> 24);
out[7] = (unsigned char) ((uint16_t)(longquat[3] >> 16) % 256);
sprintf(sendBuffer, "[%d, %d, %d, %d, %d, %d, %d, %d]rn", out[0],
out[1],
out[2],
out[3],
out[4],
out[5],
out[6]);


Do you know why it seems to be frozen like that ?

Thanks
phpbb Post ID
17994

markw

13 years 10 months ago

I can read temperature and it corresponds to the room temperature (Temp = 1834026, Temp= 1838024, Temp = 1843113 , ...), is it normal if it take times to reach a stabilized value ?

But any use of inv_get_accel, inv_get_gyro, inv_get_quaternion has 0 for the value (only one paramameter is 64 or 2^30 if not trunkated.

Any ideas why it seems the fifo not work properly ?

Thanks.

phpbb Post ID
17997

guy_mcilroy

13 years 10 months ago

You can always attempt gyro/accel raw data reads to verify it is not a hardware issue. However, your value 741619291 appears to be a 32-bit number, so it seems your casting does not work as you intend.

phpbb Post ID
18000

markw

13 years 10 months ago

I have try to read directly the accel and gyro registers and their values are updated. so the device is not into sleep mode.
Actually it seems that I can't read the FIFO because I get a length of 0 when calling inv_get_fifo_length.

Are you sure that what is said here https://invensense.tdk.com/developers/forum/viewtopic.php?f=3&t=131&hilit=enable+fifo is right ?

The FIFO_EN may be 0 since it is internally set by the DMP when you intiliaze the part

If I read the register 0x23 (FIFO_EN) I see 0. so I should be why nothing is put into the FIFO ...

Thanks
phpbb Post ID
18003

wonkyum_lee

13 years 4 months ago

I'm attempting to port motionapps to the UC3C architecture.
I'm using MPU6000 rev C with a custom board using I2C serial comunication (AD0 and CS pin connect to ground).
I'm building the project as a 6-DOF board using rev A2.
When I call the function umplStartMPU(), the product revision "prod_rev" in the function inv_get_silicon_rev_mpu6050() cannot be read correctly. It reads always 0.
I tried whitout succes to put in a 100ms delay before starting the eMPL engine ( umplStartMpu() ).
Any ideas to fix the problem?

phpbb Post ID
18009

guy_mcilroy

13 years 4 months ago

After a sufficient start-up delay, there should be no issues communicating with the device registers. The operation of MPU-6000 with the eMPL 2.0 is not officially supported, however, and the product key will not match the product devices included within the project. Developers have reported that they have modified the project successfully to default the device to a "MPU-6050" operation mode after the product ID is read. Please review the prod_rev_map() function in the mldl_cfg.c file, which is released as part of the project.

phpbb Post ID
18015

wonkyum_lee

13 years 4 months ago

I've found and fixed the problem.

As I supposed, there was a problem with I2C comunication.
I deleted twim.h and twim.c files provided with the MotionApps 2.0.2 and I loaded the TWI - Two-Wire Interface module from ASF (3.4.1 version).
Then in mlsl_at32.c I renamed all the functions twim_write and twim_read in twi_write and twi_read respectively.
Then I added these lines of code at the begining of mlsl_at32.c:


status_code_t twi_read(uint16_t dev, uint8_t reg, void * data, size_t count)
{
twi_package_t packet_received = {
.addr[0] = reg, // TWI slave memory address data
.addr_length = sizeof (uint8_t), // TWI slave memory address data size
.chip = dev, // TWI slave bus address
.buffer = (void *)data, // transfer data destination buffer
.length = count // transfer data size (bytes)
};

return (twi_master_read(TWIM, &packet_received));
}

status_code_t twi_write(uint16_t dev, uint8_t reg, const void * data, size_t count)
{
twi_package_t packet = {
.addr[0] = reg, // TWI slave memory address data
.addr_length = sizeof (uint8_t), // TWI slave memory address data size
.chip = dev, // TWI slave bus address
.buffer = (void *)data, // transfer data source buffer
.length = count // transfer data size (bytes)
};

return (twi_master_write(TWIM, &packet));
}


That's it... Now it works.
phpbb Post ID
18018
phpbb Topic ID
13515