Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    BMX160 - PMU_STATUS (0x03) is always 0

    BMX160 - PMU_STATUS (0x03) is always 0

    Nikosant03
    Long-established Member

    Hi everyone,

    At the moment I am working on power optimizing BMX160. When my firmware starts I initialize the sensor by setting

    Accel = Normal Mode

    Gyro = Normal Mode

    Mag = Forced Mode

    This is my BMI160() function

    void BMI160_init(void) {  
      uint8_t data = 0;
    
      sensor.id = BMI160_I2C_ADDR;        //0x68
      sensor.interface = BMI160_I2C_INTF; //0x00
      sensor.read = Acc_i2c_Read;
      sensor.write = Acc_i2c_Write;
      sensor.delay_ms = Acc_delay_ms;
    
      bmm150.dev_id = BMM150_DEFAULT_I2C_ADDRESS;
      bmm150.intf = BMM150_I2C_INTF;
      bmm150.read = bmm150_aux_read;
      bmm150.write = bmm150_aux_write;
      bmm150.delay_ms = Acc_delay_ms;
    
      rslt = bmi160_init(&sensor);
      APP_ERROR_CHECK(rslt);
    
      sensor.aux_cfg.aux_sensor_enable = 1;                     // auxiliary sensor enable
      sensor.aux_cfg.aux_i2c_addr = BMI160_AUX_BMM150_I2C_ADDR; // auxiliary sensor address
      sensor.aux_cfg.manual_enable = 1;                         // setup mode enable
      sensor.aux_cfg.aux_rd_burst_len = 2;                      // burst read of 2 byte
    
      rslt = bmi160_aux_init(&sensor);
      APP_ERROR_CHECK(rslt);
    
      rslt = bmm150_init(&bmm150);
      APP_ERROR_CHECK(rslt);
    
      if (rslt == BMI160_OK) {
        //NRF_LOG_INFO("BMI160 Initialized...");
      } else {
        //NRF_LOG_INFO("BMI160 not Initialized...");
      }
      NRF_LOG_FLUSH();
    
      sensor.accel_cfg.odr = BMI160_ACCEL_ODR_400HZ;     // na - Accel Output Data Rate - 400Hz is the min acceptable ODR in order to measure at 100Hz. See table 13 pg21
      sensor.accel_cfg.range = BMI160_ACCEL_RANGE_2G;    // na - Range of accel measurements
      sensor.accel_cfg.bw = BMI160_ACCEL_BW_NORMAL_AVG4; // Number of averaging cycling. The higher the AVG the lower the noise but the higher the current consumption (see pg18 Table 9). Important for Low Power Mode
      sensor.accel_cfg.power = BMI160_ACCEL_NORMAL_MODE; // na - Set the power mode (see pg15 Table 7,pg16 Table 8 ,pg18 Table 9)
    
      sensor.gyro_cfg.odr = BMI160_GYRO_ODR_400HZ;        // na - Output Data Rate - 400Hz is the min acceptable ODR in order to measure at 100Hz. See table 15 pg23
      sensor.gyro_cfg.range = BMI160_GYRO_RANGE_2000_DPS; // na - Range of gyro measurements
      sensor.gyro_cfg.bw = BMI160_GYRO_BW_NORMAL_MODE;    // The gyro bandwidth coefficient defines the 3dB cutoff frequency for the low pass filter for the sensor data (see pg22 2.4.2)
      sensor.gyro_cfg.power = BMI160_GYRO_NORMAL_MODE;    // na - Set the power mode (see pg15 Table 7,pg16 Table 8 ,pg18 Table 9)
    
      rslt = bmi160_set_sens_conf(&sensor); //  configure the ODR, range, power mode and bandwidth of sensor
      APP_ERROR_CHECK(rslt);
      nrf_delay_ms(150); // na - see pg 90 of BMX160 datasheet
    
      /* Configure the magnetometer. The regular preset supports up to 100Hz and the Low Power Preset up to 200Hz in Forced mode (see pg19 Table 11) */
      bmm150.settings.preset_mode = BMM150_PRESETMODE_LOWPOWER; // na - The higher the preset the lower the noise but the higher the current consumption (see pg19 Table 11)
                                                            
      rslt = bmm150_set_presetmode(&bmm150);
      APP_ERROR_CHECK(rslt);
    
      bmm150.settings.pwr_mode = BMM150_FORCED_MODE; // na - see datasheet pg16 Magnetometer power mode section
      rslt = bmm150_set_op_mode(&bmm150);
    
      //  bmm150_get_regs(BMM150_OP_MODE_ADDR, &data, 1, &bmm150); // na - Read the BMM150_OP_MODE_ADDR (0x4C) register
      //  NRF_LOG_INFO("BMM150_OP_MODE_ADDR (0x4C) : %d", data);
    
      sensor.aux_cfg.aux_odr = BMI160_AUX_ODR_100HZ; 
      bmi160_config_aux_mode(&sensor);
      bmi160_set_aux_auto_mode(&aux_addr, &sensor); 
    
      if (rslt == BMI160_OK) {
        //NRF_LOG_INFO("sensor Configured...");
      } else {
        //NRF_LOG_INFO("sensor not Configured...");
      }
    
      rslt = bmi160_get_regs(BMI160_PMU_STATUS_ADDR, &data, 1, &sensor);
      NRF_LOG_INFO("BMI160_PMU_STATUS_ADDR - STAND BY STATE: %d", rslt);
    }

     

    After setting the power modes and applying the nesessary delay according to page 90 of the datasheet, I am still reading 0s from PMU_STATUS (0x03) register. This is strange because I can read normally the values from all of the 9 axis of the sensor..

    Any advice?

    Thanks in advance

    Nick

    1 REPLY 1

    FAE_CA1
    Community Moderator
    Community Moderator

    Hi,

    Thanks for your inquiry.

    I have replied to you in another thread. Please use a USB logic analyzer to capture the I2C waveform for your function and send it to us. We will check what went wrong.

    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