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.

BQ40Z50-R2: Temperature Calibration with MCP2221 device

Part Number: BQ40Z50-R2


Tool/software:

Hi All,

The saga continues to calibrate a BQ40Z50R2!

The last piece of the puzzle is to calibrate the temperature readings,  and still using a MCP2221 SMBus device.

We apply a known temperature, e.g. 21 degrees C

We then read out the TINT offset for the Internal temperature for example.

 -smbw=14,40 -slave8=17 -register=00 -pec=off  (read internal temperature offset, normally between -128 and 127 in 0.1 degrees C)

 -smbr=3 -slave8=17 -register=23 -pec=off 

This gives us 

SMBus Read 3 bytes, Slave = 0x17, Reg Index = 0x23, PEC = Off
0x20, 0x7d, 0x78  (first byte ignored)

Where the offset in this case is 7D78 = 32120, 32767 - 32120 = 647  ??

then read temperature from DAstatus2 (72)

 -smbw=72,00 -slave8=17 -register=00 -pec=off

 -smbr=17 -slave8=17 -register=23 -pec=off 

this gives us

SMBus Read 17 bytes, Slave = 0x17, Reg Index = 0x23, PEC = Off
0x10, 0xb, 0xc, 0x13, 0xc, 0x13, 0xc, 0x55, 0x12, 0x59, 0x12, 0x13, 0xc, 0, 0, 0x13, 0xc (first byte ignored)

Where AAaa is 0C0B = 3083 = 308.3 K = 35.15 degrees C

and to find out the new offset, do this calculation 

Calculate temperature offset:
TINT offset = TEMPTINT – TINT + TINT offsetold    =  21.0 - 35.15 + 647 (again, not too sure if correct) = 633, therefore new offset = 32767 - 633 = 32134 = 7D86


Write the new Internal Temp Offset value to data flash

 -smbw=03,14,86,7D -slave8=17 -register=44 -pec=off

Then recheck the reading to see if it is nearer 21.0 degrees C

This doesn't seem to work, does anyone have any experience of doing this please?

Many thanks,

Steve

  • Hi Steve,

    If possible, can you please try reading out the temperature reading from the 0x08 function? I would like to see if this reports the same 35.15 internal temperature that you are seeing from the DAStatus2().

    Regards,

    Anthony Baldino

  • Hi Anthony,

    Thanks for the reply

    From DAStatus2()

    SMBus Read 17 bytes, Slave = 0x17, Reg Index = 0x23, PEC = Off
    0x10, 0x6f, 0xb, 0x72, 0xb, 0x6f, 0xb, 0xc9, 0x12, 0x6b, 0x12, 0x72, 0xb, 0, 0, 0x72, 0xb

    From 0x08

    SMBus Read 2 bytes, Slave = 0x17, Reg Index = 0x8, PEC = Off
    0x72, 0xb

    0X0B72 = 2930 = 293.0 K = 19.85 degrees C

    I think I have been able to calibrate it now, with this method.

    I have a target actual temperature, then I send a calibration offset value YYXX to all temperature values - IntTemp TS1 and TS2

     -smbw=03,14,XX,YY -slave8=17 -register=44 -pec=off

     -smbw=03,15,XX,YY -slave8=17 -register=44 -pec=off

     -smbw=03,16,XX,YY -slave8=17 -register=44 -pec=off

    Then I read the temperature and increment or decrement the YYXX value until they are +/- 0.5 degrees difference between the target and read temperature, sort of autotuned it.

    The end YYXX value (this example was EA40) is then used for the next part and as they are all at the same temperature, it seems to get it first time after the initial one is set, but if it is out, it will adjust.

    Does that make sense? That seems to have worked for me! 

    Many thanks,

    Steve

  • Hi Steve,

    That process seems like it should work. Just to confirm, do you have any of the external Temperature Sense pins enabled? 

    Also, when Temperature is read back out after this calibration process, does it reflect the proper temperature?

    Regards,

    Anthony Baldino

  • Hi Anthony,

    Yes, it sets it to the temperature target value from a calibrated source, and afterward, it stays correct, TS1 and TS2 are enabled, at this stage all of them are the same temperature, just on the pcba.


    Thanks for your input Slight smile

    Best wishes,
    Steve