Bosch Sensortec Community

    cancel
    Showing results for 
    Search instead for 
    Did you mean: 

    Facing communication Issue With Bme688.

    Facing communication Issue With Bme688.

    Ajay_0107
    New Poster

    Sir, I am Using I2C protocol(renesas Rl78) to communicate with Bme688 sensor to read all gas reg values but i am not getting any value from the sensor

    7 REPLIES 7

    BSTRobin
    Community Moderator
    Community Moderator

    Hi Ajay_0107,

    Could you get BME688 chip ID via I2C communication?

    I upload BME688 example code on STM32 for you reference. Hope it is helpful for you.

    yeah I am getting the chip id and communication is built with BME688. now I am facing the New issue that tha parametre are not changing or its not updating.

    This sensor we are using in Air conditioner project to measure the AQI value so please help as fast as possible.

    we cannot use your library due to controller issue.

    and here we will get the gas resistance value so please provide the formula to Calculate the Aqi value.

    Here is code,

    /* Start user code for global. Do not edit comment generated here */
    #define EEPROM_Address 0xEC
    uint8_t u8bmedataaddress[17]={0x1D,20,45,33,55,44,66,77,88,89,11,34,45,23,34,45,56};
    uint8_t u8bmedatareceive[42];
    //uint8_t Data_Address1[17]={16,11,22,33,44,55,66,77,88,99,12,23,34,45,56,67,78};
    //uint8_t Data_Address3[17]={32,11,22,33,44,55,66,77,88,99,12,23,34,45,56,67,78};
    uint8_t gu8Reset[2]={0xE0,182};
    uint8_t gu8Filteraddndata[2]={0x75,8}; 
    uint8_t gu8Modensampling[5]={0x71,32,1,0,85};
    uint8_t gu8Gaswait[2]={0x6D,89};
    uint8_t gu8Par_t[1]={0x8A};
    uint8_t gu8Par_tempdatareceive[3];
    uint8_t gu8Par_t1[1]={0xE9};
    uint8_t gu8Par_tempdatareceive1[2];
    uint8_t gu8Tempadcaddress[1]={0x22};
    uint8_t gu8Tempadc[2];
    uint8_t send = 0;
    uint8_t Receive = 0;
    uint16_t u16Counter=0;
    uint16_t counter=0;
    uint8_t flag = 0;
    uint16_t gu16Part1,gu16Part2;
    uint8_t gu8Part3;
    uint16_t gu16Tempadc;
    uint32_t gu16Tvar1, gu16Tvar2,gu16Tvar3,gu16T_fine, gu16T_comp;
     
     
     
    void main(void)
    {
         R_MAIN_UserInit();
        /* Start user code. Do not edit comment generated here */
        R_IICA0_Create();
        R_TAU0_Channel0_Start();
          for(u16Counter=0;u16Counter<4000;u16Counter++)
       {
        NOP();NOP();NOP();
        NOP();NOP();NOP();
        NOP();NOP();NOP();
        NOP();NOP();NOP();
       }
       send =0;
       R_IICA0_Master_Send(EEPROM_Address, &gu8Filteraddndata , 2 ,((uint8_t)100));
       while(0==send);
       for(u16Counter=0;u16Counter<4000;u16Counter++)
       {
        NOP();NOP();NOP();
        NOP();NOP();NOP();
        NOP();NOP();NOP();
        NOP();NOP();NOP();
       }
       R_IICA0_StopCondition();
      
       for(u16Counter=0;u16Counter<4000;u16Counter++)
       {
        NOP();NOP();NOP();
        NOP();NOP();NOP();
        NOP();NOP();NOP();
        NOP();NOP();NOP();
       }
       send =0;
       R_IICA0_Master_Send(EEPROM_Address, &gu8Modensampling , 5 ,((uint8_t)100));
       while(0==send);
       for(u16Counter=0;u16Counter<4000;u16Counter++)
       {
        NOP();NOP();NOP();
        NOP();NOP();NOP();
        NOP();NOP();NOP();
        NOP();NOP();NOP();
       }
       R_IICA0_StopCondition();
       for(u16Counter=0;u16Counter<4000;u16Counter++)
       {
        NOP();NOP();NOP();
        NOP();NOP();NOP();
        NOP();NOP();NOP();
        NOP();NOP();NOP();
       }
       
       for(u16Counter=0;u16Counter<4000;u16Counter++)
       {
        NOP();NOP();NOP();
        NOP();NOP();NOP();
        NOP();NOP();NOP();
        NOP();NOP();NOP();
       }
       R_IICA0_StopCondition();
        for(u16Counter=0;u16Counter<4000;u16Counter++)
       {
        NOP();NOP();NOP();
        NOP();NOP();NOP();
        NOP();NOP();NOP();
        NOP();NOP();NOP();
       }
        send = 0;
        R_IICA0_Master_Send(EEPROM_Address, &gu8Gaswait, 2 ,((uint8_t)100));
         while(0==send);
         for(u16Counter=0;u16Counter<4000;u16Counter++)
       {
        NOP();NOP();NOP();
        NOP();NOP();NOP();
        NOP();NOP();NOP();
        NOP();NOP();NOP();
       }
       R_IICA0_StopCondition();
      
        while (1U)
        {
        if(1==flag)
        {
       for(u16Counter=0;u16Counter<4000;u16Counter++)
       {
        NOP();NOP();NOP();
        NOP();NOP();NOP();
        NOP();NOP();NOP();
        NOP();NOP();NOP();
       }
       send =0;
       R_IICA0_Master_Send(EEPROM_Address, &gu8Reset , 2 ,((uint8_t)100));
       while(0==send);
       for(u16Counter=0;u16Counter<4000;u16Counter++)
       {
        NOP();NOP();NOP();
        NOP();NOP();NOP();
        NOP();NOP();NOP();
        NOP();NOP();NOP();
       }
       R_IICA0_StopCondition();
      
        
        for(u16Counter=0;u16Counter<4000;u16Counter++)
       {
        NOP();NOP();NOP();
        NOP();NOP();NOP();
        NOP();NOP();NOP();
        NOP();NOP();NOP();
       }
       for(u16Counter=0;u16Counter<4000;u16Counter++)
       {
        NOP();NOP();NOP();
        NOP();NOP();NOP();
        NOP();NOP();NOP();
        NOP();NOP();NOP();
       }
       send = 0;
       R_IICA0_Master_Send(EEPROM_Address, &gu8Par_t , 1 ,((uint8_t)100));
       while(0==send);
         for(u16Counter=0;u16Counter<4000;u16Counter++)
       {
        NOP();NOP();NOP();
        NOP();NOP();NOP();
        NOP();NOP();NOP();
        NOP();NOP();NOP();
       }
       R_IICA0_StopCondition();
       for(u16Counter=0;u16Counter<4000;u16Counter++)
       {
        NOP();NOP();NOP();
        NOP();NOP();NOP();
        NOP();NOP();NOP();
        NOP();NOP();NOP();
       }
        Receive = 0;
        R_IICA0_Master_Receive(EEPROM_Address+1,&gu8Par_tempdatareceive ,3 ,100);
        while(0==Receive);
         for(u16Counter=0;u16Counter<4000;u16Counter++)
       {
        NOP();NOP();NOP();
        NOP();NOP();NOP();
        NOP();NOP();NOP();
        NOP();NOP();NOP();
       }
        R_IICA0_StopCondition();
        
      
        for(u16Counter=0;u16Counter<4000;u16Counter++)
       {
        NOP();NOP();NOP();
        NOP();NOP();NOP();
        NOP();NOP();NOP();
        NOP();NOP();NOP();
       }
       send = 0;
       R_IICA0_Master_Send(EEPROM_Address, &gu8Par_t1 , 1 ,((uint8_t)100));
       while(0==send);
         for(u16Counter=0;u16Counter<4000;u16Counter++)
       {
        NOP();NOP();NOP();
        NOP();NOP();NOP();
        NOP();NOP();NOP();
        NOP();NOP();NOP();
       }
       R_IICA0_StopCondition();
       
       
       for(u16Counter=0;u16Counter<4000;u16Counter++)
       {
        NOP();NOP();NOP();
        NOP();NOP();NOP();
        NOP();NOP();NOP();
        NOP();NOP();NOP();
       }
        Receive = 0;
        R_IICA0_Master_Receive(EEPROM_Address+1,&gu8Par_tempdatareceive1 ,2 ,100);
        while(0==Receive);
         for(u16Counter=0;u16Counter<4000;u16Counter++)
       {
        NOP();NOP();NOP();
        NOP();NOP();NOP();
        NOP();NOP();NOP();
        NOP();NOP();NOP();
       }
        R_IICA0_StopCondition();
        for(u16Counter=0;u16Counter<4000;u16Counter++)
       {
        NOP();NOP();NOP();
        NOP();NOP();NOP();
        NOP();NOP();NOP();
        NOP();NOP();NOP();
       }
       send = 0;
       R_IICA0_Master_Send(EEPROM_Address, &gu8Tempadcaddress , 1 ,((uint8_t)100));
       while(0==send);
         for(u16Counter=0;u16Counter<4000;u16Counter++)
       {
        NOP();NOP();NOP();
        NOP();NOP();NOP();
        NOP();NOP();NOP();
        NOP();NOP();NOP();
       }
       R_IICA0_StopCondition();
       
       
       for(u16Counter=0;u16Counter<4000;u16Counter++)
       {
        NOP();NOP();NOP();
        NOP();NOP();NOP();
        NOP();NOP();NOP();
        NOP();NOP();NOP();
       }
        Receive = 0;
        R_IICA0_Master_Receive(EEPROM_Address+1,&gu8Tempadc ,2 ,100);
        while(0==Receive);
         for(u16Counter=0;u16Counter<4000;u16Counter++)
       {
        NOP();NOP();NOP();
        NOP();NOP();NOP();
        NOP();NOP();NOP();
        NOP();NOP();NOP();
       }
        R_IICA0_StopCondition();
        
        gu16Part2 = gu8Par_tempdatareceive[1]<<8 | gu8Par_tempdatareceive[0];
        gu16Part1 = gu8Par_tempdatareceive1[1]<<8 | gu8Par_tempdatareceive[0];
        gu8Part3 = gu8Par_tempdatareceive[2];
        gu16Tempadc = gu8Tempadc[0]<<8 | gu8Tempadc[1]; 
        gu16Tvar1 = ((gu16Tempadc>>3) - (gu16Part1<<1));
        gu16Tvar2 = (gu16Tvar1*gu16Part2)>>11;
        gu16Tvar3 = ((((gu16Tvar1>>1)*(gu16Tvar1>>1))>>12)*(gu8Part3<<4))>>14;
        gu16T_fine = gu16Tvar2+gu16Tvar3;
        gu16T_comp      = ((gu16T_fine*5)+128)>>8;
                }
    }
    }
     
    below is the output of the program, so in this code i am claculating the temperature but the reading are not coming accurate. it not even changing while pressing.

    Temp_adc is even changing while reading from three feilds

    why the variable are not changing.

    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