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.

TMP102 takes 5-10 seconds before giving valid 13-bits temperature reading

Other Parts Discussed in Thread: TMP102

Hello,

I am using a microcontroller to read TMP102 temperature.

My system is running in the 40-50 C range.

The micro controller does the following operation:

- (power up of the system)

- read the config register value (it reads the reset value byte1=60h, byte2=A0h since the register was never programmed before)

- set the EM bit to 1 (new value is byte1=60h, byte2=B0h)

- write the config register new value

Then, at every second, it reads the temperature register and get the following results:

29A1h

29A1h

29A1h

29A1h

29A1h

29A1h

29A1h

29A1h

29A1h ==> up to this point, the temperature is still in 12-bit format, even if the bit 0 indicates 13-bit???

14D1h ==> from this point the temperature is fine (make sens)

14D1h

14D1h

14D9h

14E1h

14E9h

14F1h

I can't find anything about having to wait 9-10 seconds after changing the EM bit before reading the temperature register.

This is the only modification made to the TMP102 registers.

Note:

if I don't change the EM bit, then, all readings from the begining are fine (12-bit mode)

example:

28A0h

28A0h

28A0h

28A0h

28A0h

28A0h

28A0h

28A0h

28A0h

28A0h

28A0h

28B0h

28C0h

28D0h

28E0h

2900h

Any idea why I see this behavior?

I have a workaround, where after changing the EM bit, I wait 15 seconds before reading the temperature for the first time, but I'd like to understand why I need to do this step...

  • Can you try setting the configuration register before your first read? Is it possible your micro has a buffer of reads that isn't being flushed?

    Ren
  • Hello Ren,

    The sequence is:

    - cold boot the PC (the TMP102 is on a card in a PC).

    - once the driver is loaded, it start the micro controller.

    - The micro-controller program the cfg register

    - Then the micro controller read the temperature register (right after the cfg register programming)

    - after that, it will read again the temp reg at every second.

    So right now, there no delay between the cfg register write and temp register read.

    The patch I am using right now is to wait N seconds between the cfg write and temp reg read.

    The micro controller we are using is made by our team. There is no read buffer on it.

    It drives the I2C pins (sda/scl) to write and read register, So everything is in order.

    I couldn't find anything in the TMP102 spec that say we need to wait after a cfg register write, before reading the temperature register...

    Jay

  • I have done additional testing and here are the results:

    Sequence 1 (13-bit):

    - Cold boot

    - write CFG (EM=1)

    - (NO WAIT)

    - read TEMP, then wait 1 second (repeat this step)

    I get 9 invalid temp (seems to use temp12 format, but lsb is 1), then all subsequent read are fine.

    example:

    0x2021 0x2021 0x2021 0x2021  0x2021 0x2021 0x2021 0x2021

    0x2021 0x1021 0x1039 0x1051  0x1069 0x1081 0x10A1 0x10B9

    Sequence 2 (13-bit):

    - Cold boot

    - write CFG (EM=1)

    - wait 1s

    - read TEMP, then wait 1 second (repeat this step)

    I get all valid values, but the first 8 values are always the same.

    example:

    0x1219 0x1219 0x1219 0x1219  0x1219 0x1219 0x1219 0x1219

    0x1221 0x1229 0x1239 0x1249  0x1259 0x1269 0x1281 0x1291

     

    Sequence 3 (13-bit):

    - Cold boot

    - write CFG (EM=1)

    - wait 16s

    - read TEMP, then wait 1 second (repeat this step)

    I get all valid values, and they are all incrementing as expected ... (I'm cooling the chip before power up to see the temp rise).

    example:

    0x10B9 0x10D9 0x10F1 0x1109  0x1129 0x1149 0x1159 0x1179

    0x1189 0x11A1 0x11B9 0x11C9  0x11E1 0x11F9 0x1209 0x1219

     

    Running the same test without programming the CFG register (ie, remain in the default 12-bit mode) gives me similar results.

    I get the same readings for the first 9 seconds... (the temperature is always valid in this case, since it is always in 12-bit mode)

    So it seems the TMP102 needs:

    - a delay between the CFG write and TEMP read.

    - a delay before being able to read different values.

    I have a work around, where I simply wait 16 seconds after the CFG write, that works fine.

    However, I don't understand why this is needed ???

    Jay

  • It takes TMP102 a maximum of 35ms to complete one measurement cycle, and update the temperature register. This is called Conversion Time and is specified in the datasheet (page 4.) The EM bit will take effect when the next measurement cycle, or 'Conversion' is started.

    By default, TMP102 initiates one of these measurement cycles four times per second (datasheet page 4.) This is called Conversion Rate. It can be configured to measure temperature as slow as once every 4 seconds up to 8 times per second.

    Ren
  • This is what I have read and this is what I would expect.

    It could explain why the first reading is wrong, because it would only update the LSB bit (12-bit or 13-bit), but not the actual temperature value.

    However, in my testing, it takes 9 full seconds for the value to be updated after the configuration register write.

    Here is the sequence I am doing:

    Sequence:

    READ CONFIG REG = 0x60A0 (which is the reset value)
    WRITE CONFIG REG = 0x60B0 (we simply set EM=1)
    READ TEMP = 0x2911 (1st reading : wrong)
    WAIT 1 SECOND
    READ TEMP = 0x2911 (2nd reading : wrong)
    WAIT 1 SECOND
    READ TEMP = 0x2911 (3rd reading : wrong)
    WAIT 1 SECOND
    READ TEMP = 0x2911 (4th reading : wrong)
    WAIT 1 SECOND
    READ TEMP = 0x2911 (5th reading : wrong)
    WAIT 1 SECOND
    READ TEMP = 0x2911 (6th reading : wrong)
    WAIT 1 SECOND
    READ TEMP = 0x2911 (7th reading : wrong)
    WAIT 1 SECOND
    READ TEMP = 0x2911 (8th reading : wrong)
    WAIT 1 SECOND
    READ TEMP = 0x2911 (9th reading : wrong)
    WAIT 1 SECOND
    READ TEMP = 0x1489 (10th reading : ok)
    WAIT 1 SECOND
    READ TEMP = 0x1489 (11th reading : ok)
    ...
    

    I have modified my microcontroller code to store information at specific locations in memory:

    The HMC store in memory the CONFIG reg value read at address 0x2F42020
    The HMC store in memory the CONFIG reg value it will write at address 0x2F42024
    The HMC store in memory the TEMP reg values read at addresses 0x2F42200..0x2F22FF
    

    And this is the memory content:

    ic>dd 2f42000 2
     0x0000000002F42000  0x01010003 0x010F0004  0x0000035B 0x00000326  ........[...&...
     0x0000000002F42010  0x000005C2 0x000003A0  0x00000000 0x00000104  ................
     0x0000000002F42020  0x000060A0 0x000060B0  0x00000000 0x00000000  .`...`..........
     0x0000000002F42030  0x01BB8A4B 0x00000082  0x00000000 0x00000100  K...............
     0x0000000002F42040  0x00000004 0x00000000  0x00000000 0x00000006  ................
     0x0000000002F42050  0x00000000 0x00000000  0x00000000 0x00000000  ................
     0x0000000002F42060  0x00000000 0x00000000  0x00000000 0x00000000  ................
     0x0000000002F42070  0x00000000 0x00000000  0x00000000 0x00000000  ................
    ic>dw 2f42200
     0x0000000002F42200  0x2911 0x2911 0x2911 0x2911  0x2911 0x2911 0x2911 0x2911  .).).).).).).).)
     0x0000000002F42210  0x2911 0x1489 0x1489 0x1489  0x1491 0x1499 0x14A1 0x14A9  .)..............
     0x0000000002F42220  0x14B1 0x14B9 0x14C9 0x14D1  0x14D9 0x14E1 0x14E9 0x14F1  ................
     0x0000000002F42230  0x14F1 0x1501 0x1501 0x1509  0x1511 0x1511 0x1519 0x1521  ..............!.
     0x0000000002F42240  0x1521 0x1529 0x1531 0x1531  0x1539 0x1539 0x1541 0x1541  !.).1.1.9.9.A.A.
     0x0000000002F42250  0x1549 0x1549 0x1551 0x1551  0x1551 0x1559 0x1559 0x1561  I.I.Q.Q.Q.Y.Y.a.
     0x0000000002F42260  0x1561 0x1561 0x1569 0x1569  0x1569 0x1571 0x1571 0x1571  a.a.i.i.i.q.q.q.
     0x0000000002F42270  0x1571 0x1579 0x1579 0x1581  0x1581 0x1581 0x1581 0x1581  q.y.y...........
    ic>dw
     0x0000000002F42280  0x1589 0x1589 0x1589 0x1589  0x1589 0x1591 0x1591 0x1591  ................
     0x0000000002F42290  0x1591 0x1591 0x1599 0x1599  0x1599 0x1599 0x1599 0x15A1  ................
     0x0000000002F422A0  0x15A1 0x15A1 0x15A1 0x15A1  0x15A1 0x15A9 0x15A9 0x15A9  ................
     0x0000000002F422B0  0x15A9 0x15A9 0x15B1 0x15B1  0x15B1 0x15B1 0x15B1 0x15B1  ................
     0x0000000002F422C0  0x15B9 0x15B9 0x15B9 0x15B9  0x15B9 0x15C1 0x15C1 0x15C1  ................
     0x0000000002F422D0  0x15C1 0x15C1 0x15C1 0x15C1  0x15C1 0x15C1 0x15C9 0x15C9  ................
     0x0000000002F422E0  0x15C9 0x15C9 0x15C9 0x15C9  0x15D1 0x15D1 0x15D1 0x15D1  ................
     0x0000000002F422F0  0x15D1 0x15D1 0x15D1 0x15D1  0x15D9 0x15D9 0x15D9 0x15D9  ................

    So the update delay explains the first invalid reading.

    But It doesn't explain why it takes 8-9 seconds before I can get a temperature update after CGF reg is changed.

    PS:

    if I wait 1 second also before the first TEMP read, then the value is valid, but it still need the same 8-9 seconds before being updated.

    In all cases, the refresh rate should be 4Hz (default value).

  • Are you sure your micro is waiting 1 second between reads?

    Ren
  • I did another quick trial where I read the temperature at every 1/2 seconds and the temperature still update after 8-9 seconds (so 15 readings that returns the same value). This trial was to make sure there wasn't any fifo holding "old values" in the TMP102.
  • yes.

    I have a counter in memory that indicates the number of reading and I already verified that after 16 seconds, the counter incremented by 0x10 (16) in my first trials.

    In my latest trial, where the temperature was read at every half second, the counter increment by 0x20 (32) after 16 seconds.