Tool/software: Code Composer Studio
Hi
I am getting same accelerometer and gyroscope values for all axis.The value i am getting is 19456 for x,y,z axis for both sensors.
For gyroscope i am using this code
txBuffer[0] = 0x43;
txBuffer[1] = 0x44 ;
txBuffer[2] = 0x45;
txBuffer[3] = 0x46;
txBuffer[4] = 0x47;
txBuffer[5] = 0x48;
i2cTransaction.slaveAddress = Board_MPU9250_ADDR;
i2cTransaction.writeBuf = txBuffer;
i2cTransaction.writeCount = 6;
i2cTransaction.readBuf = rxBuffer;
i2cTransaction.readCount = 6;
for (i = 0; i < 20; i++) {
if (I2C_transfer(i2c, &i2cTransaction)) {
gyroX = (((int16_t)rxBuffer[1]) << 8) | rxBuffer[0];
gyroY = (((int16_t)rxBuffer[3]) << 8) | rxBuffer[2];
gyroZ = (((int16_t)rxBuffer[5]) << 8) | rxBuffer[4];
int16_t gyrox = SensorMpu9250_gyroConvert(gyroX);
int16_t gyroy = SensorMpu9250_gyroConvert(gyroY);
int16_t gyroz = SensorMpu9250_gyroConvert(gyroZ); //Function call to source code file
.............
and for accelerometer
txBuffer[0] = 0x3B;
txBuffer[1] = 0x3C;
txBuffer[1] = 0x3D;
txBuffer[3] = 0x3E;
txBuffer[3] = 0x3F;
txBuffer[5] = 0x40;
i2cTransaction.slaveAddress = Board_MPU9250_ADDR;
i2cTransaction.writeBuf = txBuffer;
i2cTransaction.writeCount = 3;
i2cTransaction.readBuf = rxBuffer;
i2cTransaction.readCount = 3;
/* Take 20 samples and print them out onto the console */
for (i = 0; i < 20; i++) {
if (I2C_transfer(i2c, &i2cTransaction)) {
accelerationX = (((int16_t)rxBuffer[1]) << 8) | rxBuffer[0];
accelerationY = (((int16_t)rxBuffer[3]) << 8) | rxBuffer[2];
accelerationZ = (((int16_t)rxBuffer[5]) << 8) | rxBuffer[4];
int16_t accelx = SensorMpu9250_accConvert(accelerationX);
int16_t accely = SensorMpu9250_accConvert(accelerationY);
int16_t accelz = SensorMpu9250_accConvert(accelerationZ);
is there anything i am doing wrong?any help would be greatly appreciated
thanks in advance
best regards
Shyam