Hello,
I have connected a MAG3110 magnetometer to the auxiliary I2C port of the MPU6000. I want to read out the magnetometer through the MPU6000. The code I have used is the following.
Spi1_Write_Register(0x6A,0x30); //enable SPI and I2C master
Spi_Write_Register(0x25,0x8E); // read + magnetometer address
Spi_Write_Register(0x26,0x01); // magentometer values start register
Spi_Write_Register(0x27,0x86); // read 6 bytes
unsigned char help = Spi_Read_Register(0x49);
unsigned char help2 = Spi_Read_Register(0x4A);
unsigned char help3 = Spi_Read_Register(0x4B);
unsigned char help4 = Spi_Read_Register(0x4C);
unsigned char help5 = Spi_Read_Register(0x4D);
unsigned char help6 = Spi_Read_Register(0x4E);The values that are returned look fine, but when I put this in a loop, the values seem to stay the same. It is as if the values are not updated for some reason. Do I need to reset something before I can read the new value of the magnetometer? And is it possible to automatically readout the magnetometer, meaning that I only have to read out registers 0x49 to 0x4E, without first having to specify start register and number of bytes?