06-06-2021 11:06 PM - edited 06-06-2021 11:17 PM
Hi
I followed the process as shown in Table 16 in the BMX160 datasheet
_writeByte(BMX160_COMMAND_REG_ADDR, BMX160_MAG_IF_NORMAL_MODE);
ThisThread::sleep_for(1ms);//sleep 650 uS
//Enable magnetometer register access (setup mode)
_writeByte(BMX160_MAG_IF_0_ADDR, BMX160_MAG_IF_SETUP_MANUAL_EN);
//put MAG into sleep mode.
// write 0x01 to MAG 0x4B register
_writeByte(BMX160_MAG_IF_3_ADDR,0x01);
_writeByte(BMX160_MAG_IF_2_ADDR,0x4B);
//MAG lowpower XY preset.
// write 0x01 to MAG 0x51 register
_writeByte(BMX160_MAG_IF_3_ADDR,BMX160_MAG_XY_LP_PRESET);
_writeByte(BMX160_MAG_IF_2_ADDR,BMX160_MAG_CONF_XY_PRESET_ADDR);
//MAG regular Z preset.
// write 0x01 to MAG 0x51 register
_writeByte(BMX160_MAG_IF_3_ADDR,BMX160_MAG_Z_REGULAR_PRESET);
_writeByte(BMX160_MAG_IF_2_ADDR,BMX160_MAG_CONF_Z_PRESET_ADDR);
//set ODR to 12.5 HZ
_writeByte(BMX160_MAG_CONF_ADDR, BMX160_MAG_ODR_12_5HZ);
//put MAG_IF into lowpower mode
_writeByte(BMX160_COMMAND_REG_ADDR, BMX160_MAG_IF_LOWPOWER_MODE);
/* map data ready to INT1 */
_writeByte(BMX160_INT_ENABLE_1_ADDR, BMX160_DATA_RDY_INT_EN );
_writeByte(BMX160_INT_MAP_1_ADDR, BMX160_INT1_DATA_READY);
// prepare MAG_IF[1-3] for mag_if data mode
_writeByte(BMX160_MAG_IF_3_ADDR,0x02);
_writeByte(BMX160_MAG_IF_2_ADDR,0x4C);
_writeByte(BMX160_MAG_IF_1_ADDR,0x42);
//Enable magnetometer data mode
_writeByte(BMX160_MAG_IF_0_ADDR, BMX160_MAG_RD_BURST_8);
I sniffed these commands using logic Analyzer and I can see clearly that all commands have Ack from BMX160 but after sending 0x01 to 0x4C register (to switch to MAG force mode), it gives NACK responses as shown in the figure below.
Any idea what is happening ? I also mentioned that when I disable the Channel X-Y-Z from 0x4E (bmm150 datasheet), the chip doesn't goes to NACK mode and I can receive data ready interrupts, but all MAG Data is only a small fixed number (= 0x0001).
Note:The ACC and GYRO stop working after configuring the MAG
Solved! Go to Solution.
06-27-2021 07:06 PM
I can not use the provided demo because it is not using the interrupt pin and for other technical specs related of the way this demo is designed.
However, my question is simple, is the Table 16 missing something?. I followed the Table 16 in the BMX160 datasheet and the code and I2C log, which shows a weird behavior, are provided in my first 2 replies.
Thanks
07-31-2021 03:42 PM - edited 07-31-2021 03:42 PM
The issue was because of PCB problem making the trace of VDD line not properly provide the needed voltage when Mag start-up. The voltage drops below the power supply accepted range and this explains why the chips seem to refuse any command later.
A full view of the power supply line (the voltage drop stay for 10 mS). Before the drop, Acc and Gyro where enabled.
Thanks