w1_therm.rst 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. ======================
  2. Kernel driver w1_therm
  3. ======================
  4. Supported chips:
  5. * Maxim ds18*20 based temperature sensors.
  6. * Maxim ds1825 based temperature sensors.
  7. * GXCAS GX20MH01 temperature sensor.
  8. * Maxim MAX31850 thermoelement interface.
  9. Author: Evgeniy Polyakov <[email protected]>
  10. Description
  11. -----------
  12. w1_therm provides basic temperature conversion for ds18*20, ds28ea00, GX20MH01
  13. and MAX31850 devices.
  14. Supported family codes:
  15. ==================== ====
  16. W1_THERM_DS18S20 0x10
  17. W1_THERM_DS1822 0x22
  18. W1_THERM_DS18B20 0x28
  19. W1_THERM_DS1825 0x3B
  20. W1_THERM_DS28EA00 0x42
  21. ==================== ====
  22. Support is provided through the sysfs entry ``w1_slave``. Each open and
  23. read sequence will initiate a temperature conversion, then provide two
  24. lines of ASCII output. The first line contains the nine hex bytes
  25. read along with a calculated crc value and YES or NO if it matched.
  26. If the crc matched the returned values are retained. The second line
  27. displays the retained values along with a temperature in millidegrees
  28. Centigrade after t=.
  29. Alternatively, temperature can be read using ``temperature`` sysfs, it
  30. returns only the temperature in millidegrees Centigrade.
  31. A bulk read of all devices on the bus could be done writing ``trigger``
  32. to ``therm_bulk_read`` entry at w1_bus_master level. This will
  33. send the convert command to all devices on the bus, and if parasite
  34. powered devices are detected on the bus (and strong pullup is enabled
  35. in the module), it will drive the line high during the longer conversion
  36. time required by parasited powered device on the line. Reading
  37. ``therm_bulk_read`` will return 0 if no bulk conversion pending,
  38. -1 if at least one sensor still in conversion, 1 if conversion is complete
  39. but at least one sensor value has not been read yet. Result temperature is
  40. then accessed by reading the ``temperature`` entry of each device, which
  41. may return empty if conversion is still in progress. Note that if a bulk
  42. read is sent but one sensor is not read immediately, the next access to
  43. ``temperature`` on this device will return the temperature measured at the
  44. time of issue of the bulk read command (not the current temperature).
  45. A strong pullup will be applied during the conversion if required.
  46. ``conv_time`` is used to get current conversion time (read), and
  47. adjust it (write). A temperature conversion time depends on the device type and
  48. it's current resolution. Default conversion time is set by the driver according
  49. to the device datasheet. A conversion time for many original device clones
  50. deviate from datasheet specs. There are three options: 1) manually set the
  51. correct conversion time by writing a value in milliseconds to ``conv_time``; 2)
  52. auto measure and set a conversion time by writing ``1`` to
  53. ``conv_time``; 3) use ``features`` to enable poll for conversion
  54. completion. Options 2, 3 can't be used in parasite power mode. To get back to
  55. the default conversion time write ``0`` to ``conv_time``.
  56. Writing a resolution value (in bits) to ``w1_slave`` will change the
  57. precision of the sensor for the next readings. Allowed resolutions are defined by
  58. the sensor. Resolution is reset when the sensor gets power-cycled.
  59. To store the current resolution in EEPROM, write ``0`` to ``w1_slave``.
  60. Since the EEPROM has a limited amount of writes (>50k), this command should be
  61. used wisely.
  62. Alternatively, resolution can be read or written using the dedicated
  63. ``resolution`` entry on each device, if supported by the sensor.
  64. Some non-genuine DS18B20 chips are fixed in 12-bit mode only, so the actual
  65. resolution is read back from the chip and verified.
  66. Note: Changing the resolution reverts the conversion time to default.
  67. The write-only sysfs entry ``eeprom_cmd`` is an alternative for EEPROM operations.
  68. Write ``save`` to save device RAM to EEPROM. Write ``restore`` to restore EEPROM
  69. data in device RAM.
  70. ``ext_power`` entry allows checking the power state of each device. Reads
  71. ``0`` if the device is parasite powered, ``1`` if the device is externally powered.
  72. Sysfs ``alarms`` allow read or write TH and TL (Temperature High an Low) alarms.
  73. Values shall be space separated and in the device range (typical -55 degC
  74. to 125 degC). Values are integer as they are store in a 8bit register in
  75. the device. Lowest value is automatically put to TL. Once set, alarms could
  76. be search at master level.
  77. The module parameter strong_pullup can be set to 0 to disable the
  78. strong pullup, 1 to enable autodetection or 2 to force strong pullup.
  79. In case of autodetection, the driver will use the "READ POWER SUPPLY"
  80. command to check if there are pariste powered devices on the bus.
  81. If so, it will activate the master's strong pullup.
  82. In case the detection of parasite devices using this command fails
  83. (seems to be the case with some DS18S20) the strong pullup can
  84. be force-enabled.
  85. If the strong pullup is enabled, the master's strong pullup will be
  86. driven when the conversion is taking place, provided the master driver
  87. does support the strong pullup (or it falls back to a pullup
  88. resistor). The DS18b20 temperature sensor specification lists a
  89. maximum current draw of 1.5mA and that a 5k pullup resistor is not
  90. sufficient. The strong pullup is designed to provide the additional
  91. current required.
  92. The DS28EA00 provides an additional two pins for implementing a sequence
  93. detection algorithm. This feature allows you to determine the physical
  94. location of the chip in the 1-wire bus without needing pre-existing
  95. knowledge of the bus ordering. Support is provided through the sysfs
  96. ``w1_seq``. The file will contain a single line with an integer value
  97. representing the device index in the bus starting at 0.
  98. ``features`` sysfs entry controls optional driver settings per device.
  99. Insufficient power in parasite mode, line noise and insufficient conversion
  100. time may lead to conversion failure. Original DS18B20 and some clones allow for
  101. detection of invalid conversion. Write bit mask ``1`` to ``features`` to enable
  102. checking the conversion success. If byte 6 of scratchpad memory is 0xC after
  103. conversion and temperature reads 85.00 (powerup value) or 127.94 (insufficient
  104. power), the driver returns a conversion error. Bit mask ``2`` enables poll for
  105. conversion completion (normal power only) by generating read cycles on the bus
  106. after conversion starts. In parasite power mode this feature is not available.
  107. Feature bit masks may be combined (OR). More details in
  108. Documentation/ABI/testing/sysfs-driver-w1_therm
  109. GX20MH01 device shares family number 0x28 with DS18*20. The device is generally
  110. compatible with DS18B20. Added are lowest 2\ :sup:`-5`, 2\ :sup:`-6` temperature
  111. bits in Config register; R2 bit in Config register enabling 13 and 14 bit
  112. resolutions. The device is powered up in 14-bit resolution mode. The conversion
  113. times specified in the datasheet are too low and have to be increased. The
  114. device supports driver features ``1`` and ``2``.
  115. MAX31850 device shares family number 0x3B with DS1825. The device is generally
  116. compatible with DS1825. The higher 4 bits of Config register read all 1,
  117. indicating 15, but the device is always operating in 14-bit resolution mode.