[U-Boot-Users] Bug in DTT for temperatures below zero degress !!!

Steven Scholz steven.scholz at imc-berlin.de
Wed Jun 15 10:50:27 CEST 2005


Hi there,

there's a terrible bug in the current U-Boot CVS concerning DDT:

For temperature below zero the function dtt_get_temp() (at least for lm75) 
returns wrong values!

...
DTT:   1 is 235 C
LCD:    Hitachi TX14D11 5,7" 320x240 TFT (235°C)
WDT:    disabled

This is because of the use of an "int" although the lm75 only returns two 
byte ("signed short").

This trivial fix is needed:

Index: u-boot/dtt/lm75.c
===================================================================
RCS file: /cvsroot/u-boot/u-boot/dtt/lm75.c,v
retrieving revision 1.2
diff -u -r1.2 lm75.c
--- u-boot/dtt/lm75.c   27 Jun 2003 21:32:38 -0000      1.2
+++ u-boot/dtt/lm75.c   15 Jun 2005 08:44:21 -0000
@@ -174,7 +170,7 @@

  int dtt_get_temp(int sensor)
  {
-    return (dtt_read(sensor, DTT_READ_TEMP) / 256);
+    return ( ((signed short) dtt_read(sensor, DTT_READ_TEMP)) / 256);
  } /* dtt_get_temp() */

  #endif /* CONFIG_DTT_LM75 */

Then the output is correct:

...
DTT:   1 is -28 C
LCD:    Hitachi TX14D11 5,7" 320x240 TFT (-28°C)
CCFL:   disabled (too cold!)
WDT:    disabled

I am afraid this is an issues on all DTT in U-Boot. Some even only use "uchar".

Comments?

--
Steven







More information about the U-Boot mailing list