Hi everyone
I am currently developing my own driver using the ICM20648 invensense module that includes magnetometer AK8963C. I communicate the ICM module to the main processor through SPI, and I know that is not possible to access directly from the main processor to the magnetometer in this way and is mandatory enable the i2c master bus from ICM to communicate with the AK8963C. I had no troubles getting data from accelerometer and gyroscope, but I am not getting data from the magnetometer, my current configuration for only the magnetometer is shown below:
//set features of I2C master //writeRegister(thisRegister, thisValue)
writeRegister(REG_BANK_SEL, REG_BANK_SEL_3);
//set I2c master clock frequency, to achieve a targeted clock frequency of 400 kHz, MAX, it is recommended to set 0x07
writeRegister(I2C_MST_CTRL, 0b0000111);
//i2c slave 0 physical address
writeRegister(I2C_SLV0_ADDR, 0x8E);//<--- not sure where to get or what is i2c slave4 physical address
//register address from slave0
writeRegister(I2C_SLV0_REG, 0x00);// WHO_AM_I register from AK8963C
//Enable transfer with slave0 and receieve 1 byte
writeRegister(I2C_SLV0_CTRL, 0b10000001); <------ not sure if it is necessary set more bits
delay(50);
//show data
printf(readRegister(EXT_SENS_DATA_00)); <---------- I got only 0 should be 0x48 according to datasheet
What am I supposed to do to read and write properly to the magnetometer? I am sure I need to set up more registers but I don't know exactly where registers and what parameters. I want to read properly the 3 axis os magnetometer through i2c master bus inside ICM20648. Please help