Hi everybody,
I am using ICM20649 on SPI and MAG3110, which is connected on Auxiliary master I2C bus of ICM20649.
Communication with ICM20649 on SPI is working.
At first I can communicate with magnetometer too, for example, I can read WHO AM I register.
This problem occurs shortly after configuring:
1) communication with magnetometer is stopped (no activity more on auxiliary i2c master)
2) write to many registers of ICM20649 is ignored (for example USER_CTRL, I2C_MST_CTRL, I2C_SLV0_CTRL ....). I cannot change context of many registers, they contains the previously written value.
Helps only the device reset (writting 0x80 into PWR_MGMT_1) but after few seconds the situation is repeated. I cannot use the magnetometer really.
The ICM20649 configuration is here:
{ICM20649REGISTER::ICM20649REG_BANK0_PWR_MGMT_1, 0b00000001}, //sleep disable, lp disable, temperature enable, clksel=1
{ICM20649REGISTER::ICM20649REG_BANK0_USER_CTRL, 0b00110010}, //DMP disable, FIFO disable, I2cMaster enable, i2c disable, i2c master reset
{ICM20649REGISTER::ICM20649REG_BANK0_INT_PIN_CFG, 0b10010000}, //INT active low, push-pull, pulse, anyclear, fsync int disabled
{ICM20649REGISTER::ICM20649REG_BANK0_INT_ENABLE_1, 1}, //enable raw read int
{ICM20649REGISTER::ICM20649REG_BANK2_GYRO_SMPLRT_DIV, 0x00}, //GYRO_SMPLRT_DIV=0
{ICM20649REGISTER::ICM20649REG_BANK2_GYRO_CONFIG_1, 0b00100111}, //GYRO_DLPFCFG=4(BW 23.9Hz), SCALE=+-4000dps, GYRO_FCHOICE=1
{ICM20649REGISTER::ICM20649REG_BANK2_ACCEL_CONFIG, 0b00100111}, //ACCEL_DLPFCFG=4(BW 23.9Hz), SCALE=+-30G, ACCEL_FCHOICE=1
{ICM20649REGISTER::ICM20649REG_BANK2_TEMP_CONFIG, 6}, //TEMP_DLPFCFG=6(8.8 Hz)
{ICM20649REGISTER::ICM20649REG_BANK3_I2C_MST_CTRL, 7}, //Page81: To achieve a targeted clock frequency of 400 kHz, MAX, it is recommended to set I2C_MST_CLK = 7 (345.6 kHz / 46.67% duty cycle).
for configuring/checking of magnetometer I am using SLV4: for example read WHO AM I:
ICM20649REG_BANK3_I2C_SLV4_ADDR <--- 0x8E);
ICM20649REG_BANK3_I2C_SLV4_REG <--- 0x07);
ICM20649REG_BANK3_I2C_SLV4_CTRL, 0b10000001); //start, len=1 B
wait some ms
result is in ICM20649REG_BANK3_I2C_SLV4_DI -> 0xC4
for reading of data I am using SLV0
ICM20649REG_BANK3_I2C_SLV0_ADDR <--- 0x8E);
ICM20649REG_BANK3_I2C_SLV0_REG <--- 0x00);
ICM20649REG_BANK3_I2C_SLV0_CTRL, 0b10001000); //start, len=8 B
Does anyone have any idea how to solve this problem?
Or am I doing something wrong?
Thanks,
J.Kovacs
Which driver file have you used, one provided by Invensense Driver file or made your custom file?
Which controller are you using?
Thank you for your response. I am use the own driver. The ICM20649 is connected to STM32F746 over SPI. On this SPI is connected another one device, but has separate CS signal of course. The communication between ICM20649 and STM32F746 is working stable while I am working only with accelerometer and gyroscope registers. The problem begins when I want to configure ICM20649 for periodic data readings from magnetometer MAG3110, which is connected on auxiliary I2C, (pull-up resistors on this i2c are 1k5). The ICM20649 stops work and I can't modify longer some registers of ICM20649. Helps reset of device (write 0x80 to PWR_MGMT_1) only.
All chips are powered from 3V.
I tried connect MAG3110 directly to STM32F746 on separate i2c, and it works.
Thanks.