Mariusz Bialonczyk | 6d69155 | 2017-02-23 07:38:44 +0100 | [diff] [blame] | 1 | Kernel driver w1_ds2438 |
| 2 | ======================= |
| 3 | |
| 4 | Supported chips: |
Mauro Carvalho Chehab | e9bb627 | 2019-07-31 17:08:53 -0300 | [diff] [blame] | 5 | |
Mariusz Bialonczyk | 6d69155 | 2017-02-23 07:38:44 +0100 | [diff] [blame] | 6 | * Maxim DS2438 Smart Battery Monitor |
| 7 | |
| 8 | supported family codes: |
Mauro Carvalho Chehab | e9bb627 | 2019-07-31 17:08:53 -0300 | [diff] [blame] | 9 | ================ ==== |
Mariusz Bialonczyk | 6d69155 | 2017-02-23 07:38:44 +0100 | [diff] [blame] | 10 | W1_FAMILY_DS2438 0x26 |
Mauro Carvalho Chehab | e9bb627 | 2019-07-31 17:08:53 -0300 | [diff] [blame] | 11 | ================ ==== |
Mariusz Bialonczyk | 6d69155 | 2017-02-23 07:38:44 +0100 | [diff] [blame] | 12 | |
| 13 | Author: Mariusz Bialonczyk <manio@skyboo.net> |
| 14 | |
| 15 | Description |
| 16 | ----------- |
| 17 | |
| 18 | The DS2438 chip provides several functions that are desirable to carry in |
| 19 | a battery pack. It also has a 40 bytes of nonvolatile EEPROM. |
| 20 | Because the ability of temperature, current and voltage measurement, the chip |
| 21 | is also often used in weather stations and applications such as: rain gauge, |
| 22 | wind speed/direction measuring, humidity sensing, etc. |
| 23 | |
| 24 | Current support is provided through the following sysfs files (all files |
| 25 | except "iad" are readonly): |
| 26 | |
| 27 | "iad" |
| 28 | ----- |
| 29 | This file controls the 'Current A/D Control Bit' (IAD) in the |
| 30 | Status/Configuration Register. |
| 31 | Writing a zero value will clear the IAD bit and disables the current |
| 32 | measurements. |
| 33 | Writing value "1" is setting the IAD bit (enables the measurements). |
| 34 | The IAD bit is enabled by default in the DS2438. |
| 35 | |
| 36 | When writing to sysfs file bits 2-7 are ignored, so it's safe to write ASCII. |
| 37 | An I/O error is returned when there is a problem setting the new value. |
| 38 | |
| 39 | "page0" |
| 40 | ------- |
| 41 | This file provides full 8 bytes of the chip Page 0 (00h). |
| 42 | This page contains the most frequently accessed information of the DS2438. |
| 43 | Internally when this file is read, the additional CRC byte is also obtained |
| 44 | from the slave device. If it is correct, the 8 bytes page data are passed |
| 45 | to userspace, otherwise an I/O error is returned. |
| 46 | |
| 47 | "temperature" |
| 48 | ------------- |
| 49 | Opening and reading this file initiates the CONVERT_T (temperature conversion) |
| 50 | command of the chip, afterwards the temperature is read from the device |
| 51 | registers and provided as an ASCII decimal value. |
| 52 | |
| 53 | Important: The returned value has to be divided by 256 to get a real |
| 54 | temperature in degrees Celsius. |
| 55 | |
| 56 | "vad", "vdd" |
| 57 | ------------ |
| 58 | Opening and reading this file initiates the CONVERT_V (voltage conversion) |
| 59 | command of the chip. |
| 60 | |
| 61 | Depending on a sysfs filename a different input for the A/D will be selected: |
Mauro Carvalho Chehab | e9bb627 | 2019-07-31 17:08:53 -0300 | [diff] [blame] | 62 | |
| 63 | vad: |
| 64 | general purpose A/D input (VAD) |
| 65 | vdd: |
| 66 | battery input (VDD) |
Mariusz Bialonczyk | 6d69155 | 2017-02-23 07:38:44 +0100 | [diff] [blame] | 67 | |
| 68 | After the voltage conversion the value is returned as decimal ASCII. |
Mariusz Bialonczyk | c7e5a5b | 2018-07-05 06:51:36 +0200 | [diff] [blame] | 69 | Note: To get a volts the value has to be divided by 100. |