This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

BQ79606A-Q1: Temperature Calculation on GPIO1 Pin

Part Number: BQ79606A-Q1
Other Parts Discussed in Thread: BQ79606EVM-897

We are using Temperature sensor configuration on GPIO1 Pin of IC BQ79606A.
As per given in data sheet we have performed below steps for calculation of Temperature in degree Celsius.

step 1:
ReadReg(0x00, AUX_GPIO1_HU , 3, 0, FRMWRT_SGL_R);  // read 3 byte of data starting from address AUX_GPIO1_HU  register
step 2:
Temp_Reg_2sComp = TwosComplement_24bit((int32_t)((int32_t)BMS_Rx_Data.response_data[0] << 16) | ((int32_t)BMS_Rx_Data.response_data[1] << 8) | BMS_Rx_Data.response_data[2]); // taken 2s complement of 24 bit data
step3:
TSREF = (Temp_Reg_2sComp  * MUL_TSREF);
step 4:
BMS_Parameters.Sense_Temp = (1 / (((log((R1 * R2 * TSREF)/ (R0 * (R1 * TSREF - R2 * (1 - TSREF))))) / TEMP_COEFF) + (CONST))); // Final temperature reading

the ref values used in the program are listed below :

#define TEMP_COEFF                (3380)
#define CONST                         (0.04)        //(1/25)
#define R1                               (5100)
#define R2                               (57600)
#define R0                               (10000)
#define MUL_TSREF                 (0.00007628)

#define ENABLE_TSREF                        0x10
#define START_CELL_ADC_CONV         0x01
#define START_AUX_ADC_CONV          0x02

configuration of temperature sensor registers is as per below list:

AUX_ADC_CTRL1 = 0x11
GPIO_ADC_CONF = 0x00
CONTROL2 = ENABLE_TSREF | START_CELL_ADC_CONV | START_AUX_ADC_CONV


But we are not getting any variation in temperature reading even if we change the readings to hi- low extremes. Please review the above steps and give your suggestion.

I have attached the file which we have used for TEMPERATURE CALCULATION.Temperature Calculations.xlsx

Thank you in Advance.

Mandar S

  • Hi Mandar,

    Thank you for your question!

    Can you provide the following information on your setup:

    • Are you utilizing a "BQ79606EVM-897" EVM device, or your own custom design?
    • If this is your own custom design, what is the schematic circuit and thermistor you are utilizing for the GPIO temperature input.
    • If this is the EVM, what thermistor (value and model) are you utilizing for this design, and how are you connecting it?
    • What is the unchanging temperature you are getting (is it the value in the provided Excel file)?
    • Can you provide what you are doing in your "TwosComplement_24bit" function?

    Thank you in advance for your response!

    Regards,

    Vince

  • Hi Mandar,

    Some additional notes regarding running the GPIO temperature input software:

    The AUX ADC that is used for the GPIO is not continuous, so you will need to set the AUX_ADC_GO bit each time you want a conversion to be run. Please see section 8.3.4.4.1 of the datasheet for more details regarding this.

    Additionally, ensure that TSREF_EN is not being turned off in any subsequent writes to the CONTROL2 register.

    Let me know if this assisted with your debug process!

    Regards,

    Vince

  • Hi Vince,

    Thank you for your response!

    Here are the details:

    -Are you utilizing a "BQ79606EVM-897" EVM device, or your own custom design?
    >> We have custom design as per specified in DS.

    -If this is your own custom design, what is the schematic circuit and thermistor you are utilizing for the GPIO temperature input.
    >>attached the schematic for TS interface.

    -If this is the EVM, what thermistor (value and model) are you utilizing for this design, and how are you connecting it?
    >> Thermistor part number: NCP18XH103F03RB
          other details in attached schematic

    -What is the unchanging temperature you are getting (is it the value in the provided Excel file)?
    >> Yes, as per excel sheet

    -Can you provide what you are doing in your "TwosComplement_24bit" function?
    >> here's the function,

    int32_t TwosComplement_24bit(int32_t rawData)
    {
        if((rawData & 0x00800000) == (0x00800000))
        {
            return ((~rawData) & (0x007FFFFF) + 1);
        }
        else
        {
            return (rawData);  
    }


    -The AUX ADC that is used for the GPIO is not continuous, so you will need to set the AUX_ADC_GO bit each time you want a conversion to be run. Please see section 8.3.4.4.1 of the datasheet for more details regarding this.
    >> Yes Vince, We are enabling the AUX_ADC_GO every time and we check DRDY_AUX before reading the result from AUX_GPIO1_HU/MU/LU register.

    -Additionally, ensure that TSREF_EN is not being turned off in any subsequent writes to the CONTROL2 register.
    >> no, TSREF_EN is not getting changed anywhere else in program


    Regards,

    Mandar S.

  • Hi Mandar,

    You mentioned that you are setting:

    CONTROL2 = ENABLE_TSREF | START_CELL_ADC_CONV | START_AUX_ADC_CONV

    Can you please enable TSREF first, wait, an then enable the start of CELL and AUX ADC conversion? TSREF needs to be enabled and settled before running any GPIO conversions. See first paragraph of section 8.3.1.4 "TSREF" of the datasheet on how to determine the startup time of TSREF but for this debugging you can just have a long wait time (seconds) to see if this solves your issue.

    Best regards,

    Leslie

  • Hi Leslie,


    As you suggested I have tested by giving 2 sec delay after TEREF enabled.But that will not make any change.
    The temperature reading still stick with nearly 25 oC. Here I have attached TemperatureReadings.xlsx having some readings for
    your reference.

    Also I am sharing TemperatureCalculationsoCoK.xlsx in that I have implemented same formulas as in datasheet.But by changing register count
    for full scale value then also temperature reading stick with nearly 25 oC.

    I have also tried same calculation by taking R0 (NTC value at room temperature 25 oC) is in oK (ie. 273.15+25 = 298.15 oC).
    For this temperature reading changes as register count varies for full scale. Please find attaches TemperatureCalculationsoCoK.xlsx  for reference.
    I want to know if this approach is correct or not.

    if not then what is solution for this problem.


    Thanks & Regards,
    Sagar G.

     

  • Hi Sagar,

    You have two threads with same topic.

    Is it okay if we close this and discuss in another thread?

    So, I will close this.

    thanks

    Roger

  • Hi Roger,


    Thank you for your response.

    -Is it okay if we close this and discuss in another thread?

    >>Yes, you can close this will discuss on another thread

    Thanks and Regards,

    Sagar G.

  • Hello Leslie ad Roger,

    I am not getting any behavioral changes after adding delay between TSREF init and start of conversion bit.

    For further details on this issue, you can refer XLS sheets shared by Sagar Gunjal in below post. 

    What we are observing is, Using formula in degree Celsius unit is not allowing result to change even after readings are changed to full scale

    unlike this, if we calculate in degree kelvin then we can observe the change in final temperature if we change the input block in attached xls sheet.

     TemperatureCalculationsoCoK.xlsx  contains 2 sheet 

    1. Calculations in degree Celsius

    2. Calculations in degree Kelvin

    you can try varying "Input" block in both sheets to see the changes in final reading in "Result" block.

    Kindly confirm whether we are on right track.

    Thank you in Advance.

    Mandar S.

  • HI Mandar,

    There are two equationsin the datasheet. It's depends on how you connect your thermistor.

    It seems like you have to use another equation.

    Can you double check the equation in the datasheet?

    Roger

  • HI Mandar,

    I am going to close the tread.

    Let us know if you still having issues.

    Roger