Soekris NET4526 LM75 sensor


Poul-Henning Kamp
phk@FreeBSD.org
$Id: index.html,v 1.1 2005/04/12 20:44:32 phk Exp $

Measuring temperature on the NET4526.

The NET4526 has a LM75 temperature sensor located right next to the GPIO connector. The chip ta

The chip uses I2C (a two wire digital protocol) and is connected to the first two GPIO pins.

Here is a program (with Makefile) which bit-bangs a temperature out of the chip:

net45xx_lm75.c

Makefile

Sample output (one measurement per second):

0: 0 00011101 11100000 3bc0 15296 29.875000
0: 0 00011101 11100000 3bc0 15296 29.875000
0: 0 00011110 00100000 3c40 15424 30.125000
0: 0 00011111 11000000 3f80 16256 31.750000
0: 0 00100000 00100000 4040 16448 32.125000
0: 0 00100000 01100000 40c0 16576 32.375000
0: 0 00100000 01100000 40c0 16576 32.375000
0: 0 00100000 01100000 40c0 16576 32.375000
0: 0 00011111 10100000 3f40 16192 31.625000

The LM75 is only documented to give a resolution of half a degree Celsius, but the chip in my NET4526 actually returns 1/16 Celsius as an undocumented feature. The program exploits this.

As far as I can tell, the I2C timing is correct with the program as it stands.


Valid HTML 3.2!