MPU6000 initialization

By novaktamas , 8 June 2018

I have a MPU6000 connected to a MCU through SPI. No INT pin used. In main cycle MCU is continously reading FIFO_COUNT, and reads out FIFO if FIFO_COUNT>=12 (6*16bit data to read: 6axis only, no external I2C slaves and no TEMP data). The problem is FIFO_COUNT always reads 0.
SPI communication seems to work well, as reading WHO_AM_I(0x75) register responds 0x68 which is correct (checking SCK, MISO, MOSI, CS lines with logic analyzer).

Initialization:

void SensInit(void) {
SPI_WriteReg(0x6b, 0x89); //0x6B=PWR_MGMT_1 DEVICE_RESET | CLK=PLL X gyro
HAL_Delay(100);
SPI_WriteReg(0x68, 0x07); //0x68=SIGNAL_PATH_RESET GYRO_RESET | ACCEL_RESET | TEMP_RESET
HAL_Delay(100);
SPI_WriteReg(0x6a, 0x54); //0x6A=USER_CTRL, FIFO_EN | I2C_IF_DIS | FIFO_RESET
SPI_WriteReg(0x23, 0x78); //0x23=FIFO_EN Gyro-XH, XL, YH, YL, ZH, ZL, Accel-XH, XL, YH, YL, ZH, ZL goes to FIFO
}

Communication checking (successfully reads 0x68):
checkid= SPI_ReadReg(0x75); //WHO_AM_I register: must read back 0x68. OK!!

In main while(1) cycle:

uint16_t x;

x= SPI_ReadReg(0x72) << 8; //FIFO_COUNT_H
x += SPI_ReadReg(0x73); //FIFO_COUNT_L
if (x >= 12) { //FIFO_COUNT: always 0 :((((((

Scrutinized Document Number: RM-MPU-6000A-00
Revision: 4.2
Release Date: 08/19/2013

Any hint what else should've been initialized?

phpbb Topic ID
36965