Hi o_o & handytech I have found the final issue and MAG data is being read successfully. In a nutshell: Don't read the BMM150 registers unless you are setting up the BMX160 sensor In an attempt to find out if my compiler/project could be causing the issue, I ported the basic init & read code to a C project. This project worked & gave reliable ACC & MAG data. I think put the BMM150 register printout in the C project as well and then the MAG data being gave bogus values. Going back to my C++ project, I removed the BMM150 register read function & was able to read reliable MAG data. What other factors contributed to the resolution of this issue (please see earlier posts from o_o & handytech): handytech's setup example (but with burst length set to 8 bytes) my delay function was functioning as expected my write I2C function was not incrementing the REGISTER to write to bmm preset mode should be ENHANCED, for 50Hz MAG data Don't read the BMM150 registers unless you are setting up the BMX160 sensor I2C clk set to 100 kHz Thanks for all your help in resolving this issue. I really appreciate your inputs.
... View more
Hi o_o Thanks for highlighting this incorrect write regiter. My burst write function was not incrementing the regiter. I've fixed this and can confirm that the init I2C write traces are identical to yours. I changed my code to poll the drdy_acc and drdy_mag bits (currently at 1sec intervals). Both are set correctly. When I read the ACC and MAG data, the ACC data changes as expected. The MAG data only updates correctly for 2 read cycles. After that the data goes to some bogus value and doesn't change. I've outputted the BMM150 registers. Here are the I2C traces and register outputs when reading the registers: // BMM150 Registers READ [REG: DATA]
// Read Reg: 0x4A
IC2_W: add:68 reg:4d data:4a
IC2_R: add:68 reg:04 len:08 data: c9 00 69 00 af 00 4d 69
// Read Reg: 0x4B & 0x4C
IC2_W: add:68 reg:4d data:4b
IC2_R: add:68 reg:04 len:08 data: 00 01 06 3f 07 00 00 07
// Read Reg: 0x4D - 0x50
IC2_W: add:68 reg:4d data:4d
IC2_R: add:68 reg:04 len:08 data: 01 06 3f 07 00 00 07 1a
// Read Reg: 0x51 & 0x52
IC2_W: add:68 reg:4d data:51
IC2_R: add:68 reg:04 len:08 data: 3f 07 00 00 07 1a ff 00
52: 07 Any thoughts on why the MAG data is only valid for 2 read cycles?
... View more
Some hardware feedback. I have two boards. The first board I reduced the pull-up resistors on the SCX & SDX to get faster I2C speeds. Throught that I may have damaged the BMX160 due to too low pull-up resistors. To confirm I tested the same code on the second board. When testing with the second board, I had the same result as in my previous post. I have compared my PCB design to the examples and all is equivalent. VDD = VDDIO = 3.3V Since @handytech was able to get his BMX160 working with equivalent code, is there an external pin on the BMX160 that is only connected to the internal MAG sensor? Is there any hardware reason why the ACC & GYRO would operate as expected, but the MAG sensor does not?
... View more