| | 23 | |
| | 24 | Then we can start comparing the values reported by the BIOS with the values reported by {{{sensors}}}. I will use the Asus E35M1-I Deluxe motherboard as an example. This board uses an ITE IT8771 chip for hardware monitoring. According to the table above, its ADC ranges from 0 to 3.06V with 1 bit = 12 mV. |
| | 25 | |
| | 26 | The BIOS reports the following voltage values: |
| | 27 | |
| | 28 | {{{ |
| | 29 | CPU: 1.368 V |
| | 30 | 3.3V: 3.33 V |
| | 31 | 5V: 5.003 V |
| | 32 | 12V: 12.072 V |
| | 33 | }}} |
| | 34 | |
| | 35 | The (unconfigured) {{{sensors}}} command reports the following voltage values: |
| | 36 | |
| | 37 | {{{ |
| | 38 | in0: +1.36 V (min = +2.15 V, max = +2.69 V) ALARM |
| | 39 | in1: +2.23 V (min = +1.24 V, max = +2.56 V) |
| | 40 | in2: +2.90 V (min = +1.14 V, max = +0.95 V) ALARM |
| | 41 | +3.3V: +3.34 V (min = +4.75 V, max = +2.28 V) ALARM |
| | 42 | in4: +2.23 V (min = +1.51 V, max = +3.05 V) |
| | 43 | in5: +2.93 V (min = +3.01 V, max = +2.93 V) ALARM |
| | 44 | in6: +2.23 V (min = +1.60 V, max = +1.63 V) ALARM |
| | 45 | 3VSB: +3.38 V (min = +2.83 V, max = +2.18 V) ALARM |
| | 46 | Vbat: +3.29 V |
| | 47 | }}} |
| | 48 | |
| | 49 | Here we are lucky that some of the inputs have internal mapping and scaling so the driver already applied proper scaling and labels to them. In particular the +3.3V line is already OK. 3VSB and Vbat are also OK, so we get them for free even though the BIOS doesn't even list them. This leaves us with 3 voltage values to map and optionally scale: CPU, 5V and 12V. |
| | 50 | |
| | 51 | We'll start with CPU as it is the easiest one. Voltage of modern processors is relatively low, always inside the ADC range so scaling isn't needed. So we are looking for an input with value 1.368. {{{in0}}} is a very obvious candidate. Note that we are again lucky here because most modern processors can operate at different voltages depending on the frequency, so the value from {{{sensors}}} doesn't necessarily match what the BIOS shows. Frequency scaling is usually not in effect under the BIOS setup screen so you should either temporarily disable it under Linux as well or put heavy load on the CPU while trying to do the input match. On the plus side, note that the CPU voltage (Vcore) is almost always connected to {{{in0}}} so it's a safe bet if there's nothing contradicting this hypothesis. |
| | 52 | |
| | 53 | For 5V and 12V, things are a little harder. Both values are above the ADC's range (3.06 V) so we aren't looking only for mappings but also for scaling factors. Unfortunately it's not possible to find the mappings if you don't know the scaling factors (comparing the scaled values from the BIOS with the unscaled values from {{{sensors}}} doesn't work), and it would seem impossible to guess the scaling factors if you don't know the mapping. Looks like a dead end to you? Not really. All this means is that we have to be smart. |
| | 54 | |
| | 55 | Let's [http://www.google.com/search?q=Asus+E35M1-I+Deluxe+BIOS&hl=en&prmd=imvnsfd&source=lnms&tbm=isch&oi=mode_link&ct=mode&cd=2&biw=1682&bih=859 search the web for snapshots of BIOS pages from other users with the same board]. As motherboards tend to get a lot of online reviews, it's usually not too difficult. Then we write down all sample values we can for 5V and 12V, and add them to the ones we already got from our own board. After sorting, we get the following: |
| | 56 | |
| | 57 | {{{ |
| | 58 | 5V samples: 4.942 V, 5.003 V, 5.024 V, 5.147 V |
| | 59 | 12V samples: 11.872 V, 11.922 V, 12.072 V, 12.122 V |
| | 60 | }}} |
| | 61 | |
| | 62 | Here again we are somewhat lucky, hunt was good and we have 4 sample values for each input. Each of the values above corresponds to an 8-bit register value, which is multiplied by 12 mV and then by the scaling factor for the respective input. As registers can only hold integer values, we know that the values listed above are separated by an integer number of 12 mV * scaling factor steps, and the integer numbers in question will always be small (typically 1, 2 or 3.) From this we should be able to guess the scaling factor. |
| | 63 | |
| | 64 | Let's start with 12V. The differences between the 4 values are as follows: |
| | 65 | |
| | 66 | {{{ |
| | 67 | 11.922 - 11.872 = 0.050 V |
| | 68 | 12.072 - 11.922 = 0.150 V |
| | 69 | 12.122 - 12.072 = 0.050 V |
| | 70 | }}} |
| | 71 | |
| | 72 | From the above, it seems clear that 1 LSB of the ADC corresponds to 50 mV after scaling. And we know that it corresponds to 12 mV before scaling. So we can conclude that the scaling factor is 50/12. And we validate this conclusion as: |
| | 73 | |
| | 74 | {{{ |
| | 75 | 12.072 V / (50/12) = 2.897 V |
| | 76 | }}} |
| | 77 | which is close enough to {{{in2}}} (2.90 V). If it had not worked, we would have tried again with the assumption that 2 LSB of the ADC corresponds to 50 mV after scaling. Then 3 LSB, etc until the candidate scaling factor is below 1, which never happens. |
| | 78 | |
| | 79 | And now we do the same for 5V: |
| | 80 | |
| | 81 | {{{ |
| | 82 | 5.147 - 5.024 = 0.123 V |
| | 83 | 5.024 - 5.003 = 0.021 V |
| | 84 | 5.003 - 4.942 = 0.061 V |
| | 85 | }}} |
| | 86 | |
| | 87 | It is slightly more difficult this time because there are some rounding errors, but still: it seems that 1 LSB of the ADC corresponds to about 21 mV after scaling. To limit the rounding errors, best is to divide the difference between the greatest and least values by our estimation of the number of ADC steps between them: |
| | 88 | |
| | 89 | {{{ |
| | 90 | (5.147 - 4.942) / (6 + 1 + 3) = 0.0205 V |
| | 91 | }}} |
| | 92 | so our guess is that 1 LSB of the ADC corresponds to 20.5 mV after scaling. And we know that it corresponds to 12 mV before scaling. So we can conclude that the scaling factor is 20.5/12 or 205/120. And we validate this conclusion as: |
| | 93 | |
| | 94 | {{{ |
| | 95 | 5.003 V / (205/120) = 2.929 V |
| | 96 | }}} |
| | 97 | which is close enough to {{{in5}}} (2.93 V). |
| | 98 | |
| | 99 | Finally we can write the partial configuration file which corresponds to our findings: |
| | 100 | |
| | 101 | {{{ |
| | 102 | chip "it8771-*" |
| | 103 | |
| | 104 | ### Voltages |
| | 105 | |
| | 106 | # in1, in4 and in6 all read +2.23V, no idea why. |
| | 107 | |
| | 108 | label in0 "Vcore" |
| | 109 | ignore in1 |
| | 110 | label in2 "+12V" |
| | 111 | ignore in4 |
| | 112 | label in5 "+5V" |
| | 113 | ignore in6 |
| | 114 | |
| | 115 | compute in2 @ * (50/12), @ / (50/12) |
| | 116 | compute in5 @ * (205/120), @ / (205/120) |
| | 117 | |
| | 118 | set in0_min 0.7 |
| | 119 | set in0_max 1.5 |
| | 120 | set in2_min 12 * 0.95 |
| | 121 | set in2_max 12 * 1.05 |
| | 122 | set in3_min 3.3 * 0.95 |
| | 123 | set in3_max 3.3 * 1.05 |
| | 124 | set in5_min 5 * 0.95 |
| | 125 | set in5_max 5 * 1.95 |
| | 126 | set in7_min 3.3 * 0.95 |
| | 127 | set in7_max 3.3 * 1.05 |
| | 128 | }}} |
| | 129 | |
| | 130 | And now, good luck with your own motherboard! |