Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 
    SOLVED

    BMX160 Weird behavior while configuring MAG sensor

    BMX160 Weird behavior while configuring MAG sensor

    YahyaTawil
    Established Member

    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. 

     

    YahyaTawil_0-1623013632674.png

    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

     

    6 REPLIES 6

    YahyaTawil
    Established Member

    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

    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.   

     

    YahyaTawil_0-1627738686255.png

     

    A full view of the power supply line (the voltage drop stay for 10 mS). Before the drop, Acc and Gyro where enabled. 

    YahyaTawil_1-1627738710260.png

     

    Thanks

    Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist