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.

BQ76952: After configuring the temperature coefficient, the temperature read is 127℃

Part Number: BQ76952
Other Parts Discussed in Thread: 4428, BQSTUDIO

Hi

The NTC I used is CWF1_10KF3950, and the B value is different from the default 18k temperature model, so I used TI's online tool to generate a calibration coefficient based on the relationship between the resistance value and temperature of CWF1_10KF3950, but the temperature read after writing is 127°C. Attached are the NTC specifications used and the generated calibration parameters. Please help analyze the reasons. Thank you!

The pin configuration code is as follows:

U08 BQ769x2_SetEnableTS1(void)
{
    U08 u08Result = 0;

    u08Result = BQ769x2_SetRegister(BQ769X2_SET_CONF_TS1, 0x0B, 1);//18K temperature model,

    return u08Result;
}

The code to set the 18K temperature model calibration parameters is as follows:

Please help to see if there is any problem with this setting function.3324.CWF1_10KF3950-report.zip3324.CWF1 10KF3950-B1-500.pdfCWF1_10KF3950 (1).zip

U08 BQ76952_Set18kTempModeCalib(void)
{
//CWF1 10KF3950-B1-500
U08 result = 0;
//Coeff a1 -17995 = 0x10000 - 0x464B = 0xB9B5
result = BQ769x2_SetRegister(BQ769X2_CAL_18K_TEMP_COEFF_A1, 0xB9B5, 2);

//Coeff a2 26324
result |= BQ769x2_SetRegister(BQ769X2_CAL_18K_TEMP_COEFF_A2, 26324, 2);

//Coeff a3 -16652 = 0x10000 - 0x410C = 0xBEF4
result |= BQ769x2_SetRegister(BQ769X2_CAL_18K_TEMP_COEFF_A3, 0xBEF4, 2);

//Coeff a4 31695
result |= BQ769x2_SetRegister(BQ769X2_CAL_18K_TEMP_COEFF_A4, 31695, 2);

//Coeff a5 2793
result |= BQ769x2_SetRegister(BQ769X2_CAL_18K_TEMP_COEFF_A5, 2793, 2);

//Coeff b1 -14950 = 0x10000 - 0x3A66 = 0xC59A
result |= BQ769x2_SetRegister(BQ769X2_CAL_18K_TEMP_COEFF_B1, 0xC59A, 2);

//Coeff b2 13924
result |= BQ769x2_SetRegister(BQ769X2_CAL_18K_TEMP_COEFF_B2, 13924, 2);

//Coeff b3 -6450 = 0x10000 - 0x1932 = 0xE6CE
result |= BQ769x2_SetRegister(BQ769X2_CAL_18K_TEMP_COEFF_B3, 0xEF94, 2);

//Coeff b4 4428
result |= BQ769x2_SetRegister(BQ769X2_CAL_18K_TEMP_COEFF_B4, 4428, 2);

//Adc0 default is 11703
// result |= BQ769x2_SetRegister(BQ769X2_CAL_18K_TEMP_COEFF_ADC0, 11703, 2);

return result;
}

Read the temperature code as follows:

S32 BQ769x2_ReadThermistorTemp(TE_BQ769X2_THERMISTOR thermistor)
{
U08 cmd;
S16 TemValue;
switch (thermistor)
{
case E_TH_TS1:
cmd = BQ769X2_CMD_TEMP_TS1;
break;
case E_TH_TS2:
cmd = BQ769X2_CMD_TEMP_TS2;
break;
case E_TH_TS3:
cmd = BQ769X2_CMD_TEMP_TS3;
break;
case E_TH_HDQ:
cmd = BQ769X2_CMD_TEMP_HDQ;
break;
case E_TH_DCHG:
cmd = BQ769X2_CMD_TEMP_DCHG;
break;
case E_TH_CFETOFF:
cmd = BQ769X2_CMD_TEMP_CFETOFF;
break;
case E_TH_DFETOFF:
cmd = BQ769X2_CMD_TEMP_DFETOFF;
break;
case E_TH_INT:
cmd = BQ769X2_CMD_TEMP_INT;
break;
}
BQ769x2_DirectRead_Int2(cmd,&TemValue);
float raw = TemValue / 10.0;
return (lroundf(raw - 273.15));
}

The temperature value read using the read internal temperature command 0x68 is 32, and the value read using the TS1 pin read temperature command 0x70 is 127.

When the TS1 temperature value is 128, the original value read is 1522282 or 1523628 or 1509391 or 1510016....from this data can know the ADC is reading ~0.545V, which, assuming an ideal 18k pull-up resistor, translates to ~7.8kohms on the thermistor. Looking at your thermistor curve that's 30~31ºC, so we can be quite certain that this is not a hardware issue.

I also compared it with the official code. I really don’t know where the problem is. Can you help me find out?

looking forward to your reply

thanks

quincey

  • Hello Quincy,

    The TS1 temperature read provides the value in units of 0.1-Kelvin, So you would have to convert this to Celsius to get your temperature measurements.

    That still sounds a bit too low. I checked the polynomial coefficients the report gave you, and these seem correct based on your resistance vs. temperature table, so I do not expect these are wrong. 

    My guess is that it is possible that the coefficients were not written properly to the device. Actually, I see that some of the values you wrote are in HEX, while others are in decimal. Is the  code properly converting everything? Can you use a logic analyzer to confirm the correct values are being written to the coefficients? For example, 26324 should be 0x66D4 in HEX.

    Best Regards,

    Luis Hernandez Salomon

  • Hello Luis,

    Thanks for your reply!

    The hexadecimal value in the BQ76952_Set18kTempModeCalib function is converted into hexadecimal and written because the number to be written is a negative number, while the positive number is written directly.

     26324 is 0x66D4 in HEX,Refer to the picture below:

    In addition, the temperature value read by TS3 and HDQ using the same NTC is also 127.

    Best Regards,

    quincey

  • Hello Luis,

    Coeff a1 is -17995. I converted it to hexadecimal and wrote it. Can negative numbers be converted and written like this?

    //Coeff a1 -17995 = 0x10000 - 0x464B = 0xB9B5
    result = BQ769x2_SetRegister(BQ769X2_CAL_18K_TEMP_COEFF_A1, 0xB9B5, 2);

    looking forward to your reply

    thanks

    quincey

  • Hello Quincy,

    Do you have a waveform also showing the checksum and length? 

    I can try writing these on my side to see how the communication looks. I believe your interpretation of negative numbers sounds correct, but I will check on my side just to be safe.

    Best Regards,

    Luis Hernandez Salomon

  • Hello Luis,

    eg:The waveform written to (22364 =  0x66D4) is as shown below:

    eg:The waveform written to (-17995 = 0x10000 - 0x464B = 0xB9B5) is as shown below:

    Best Regards,

    quincey

  • Hello Quincy,

    Apologies, I did not have time to check on this today. I will send a response by tomorrow.

    Best Regards,

    Luis Hernandez Salomon

  • Hello Luis,

    It's okay, you can help me answer it when you have time.

    Best Regards,

    quincey

  • Hello Quincy,

    What is the ADC gain (Register 0x91A6) and the ADC count value of the thermistor (based on 0x0076 and 0x0077)?

    You can estimate the resistor value with the ADC count by doing (ADC_counts * ADC_Gain)/(2^24) to get an estimate in mV. Additionally, is there any capacitance on the pin? Could you try removing anything measuring the thermistor or any capacitance on the pin?

    If you read back the coefficients, do they seem okay? 

    It may also be worth trying to use bqStudio and read the calibration values after they've been programmed in order to see if it was properly written to.

    Best Regards,

    Luis Hernandez Salomon

  • Hello Luis,

    The problem is solved, thanks for the answer!

    Best Regards,

    quincey

  • Hello Quincey,

    Glad to hear that Slight smile.

    Out of curiosity, what was the problem?

    Best Regards,

    Luis Hernandez Salomon

  • Hello Luis,

    It is a problem with the calibration coefficient configuration. One parameter is configured incorrectly.

    Also, I would like to ask, what is the recommended capacitance value when using the 18K model? Is 100pf okay?

    Best Regards,

    quincey

  • Hello Quincey,

    Glad that was figured out!

    Yes, 100-pF is perfectly okay. When using the 18-kOhm pull-up, it is recommended to keep this capacitance below 4-nF, see excerpt from datasheet below:

    Best Regards,

    Luis Hernandez Salomon