I would like to apologize before I start this question as I don't have the code to put down here as it is in my work pc. BUT.. 1)I have figured out that my GY521 Module (for MPU6050) has been correctly interfaced with the CPU ATMEGA32 that I am using.
SDA -> SDA
SCL -> SCL
Vcc for CPU as well as GY521 is being powered up at 3.3V
2)TWI interface works perfectly. I am using 6 functions for TWI Library.
TWI_START for generating start conditon
TWI_STOP for generating stop condition
TWI_READ and TWI_WRITE for reading and writing.
TWI_DEVICE_READ for generating a frame for reading data from register of the slave address provide.
TWI_DEVICE_WRITE for generating a frame for writing data to register of the slave address provide.
3)When I read WHOAMI register, it returns me the correct value ie 104d or 68h. I am able to write to registers , but when I read them back for conforming all I get 0.
4)After a lil working around I found out that the default state of bit 6 of PWR_MGMT_1 happens to be high ie in the sleep mode. I tried to write new vale to PWR_MGMT_1 but when I read back , I get the same default value ie 40h or 64d.
Now here I would like to believe that I have given almost all the description I could think of, if anything is left out do let me know please.
and I would appreciate any efforts made in order to solve my problem of initializing the mpu6050, reading and writing the registers and turning off the sleep mode.