Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    BME 680 - Temperature and Pressure are 0

    BaggyEyes
    New Poster

    BME 680 - Temperature and Pressure are 0

    The subject tells the story, when reading the Temp and Pressure values of the BME 680 i get 0 and humditiy is some wild number. This makes me think it has to do with how i call the user read and user write functions but how i approch it seems to fall in line with how other people do so. I am connecting to the sensor with a STM32 and i will include my code below. If you have any insight in what i could be doing wrong that would be most appreciated.

     

     

     

      struct bme680_dev bme;
      uint8_t GTXBuffer[256];
    
      int8_t user_i2c_read(uint8_t dev_id, uint8_t reg_addr, uint8_t *reg_data, uint16_t len) {
    	  uint16_t DevAddress = dev_id << 1;
    
    	  HAL_I2C_Master_Transmit(&hi2c1, DevAddress, &reg_addr, 1, 10000);
    	  HAL_I2C_Master_Receive(&hi2c1, DevAddress, reg_data, len, 10000);
    	  return 0;
      }
    
      int8_t user_i2c_write(uint8_t dev_id, uint8_t reg_addr, uint8_t *reg_data, uint16_t len) {
    	  uint16_t DevAddress = dev_id << 1;
    	  GTXBuffer[0] = reg_addr;
    	  memcpy(&GTXBuffer[1], reg_data, len);
    
    	  HAL_I2C_Master_Transmit(&hi2c1, DevAddress, GTXBuffer, len+1, 10000);
    	  return 0;
      }
    
      void user_delay_ms(uint32_t period)
      {
          HAL_Delay(period);
      }
    
    
    
      bme.dev_id = 0x76;
      bme.intf = BME680_I2C_INTF;
      bme.read = &user_i2c_read;
      bme.write = &user_i2c_write;
      bme.delay_ms = user_delay_ms;
      bme.amb_temp = 25;

     

     

     

     from here on out i follow the example from the older github repository.

    Tags (3)
    1 REPLY 1
    BSTRobin
    Community Moderator

    Re: BME 680 - Temperature and Pressure are 0

    Hello BaggyEyes,

    There was BME680 reference code on STM32, you could refer it from another ticket.
    https://community.bosch-sensortec.com/t5/MEMS-sensors-forum/BME680-with-BSEC-produces-on-0-0s-even-a...

    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