105. PORTB bit 1 is the charger input, and the battery curve really is millivolts¶
Section 44 read groups 5 and 6 as a measurement to level curve, noted that "the consumer picks between them on a run time condition", and read them as millivolts while calling that "a conjecture rather than a finding". The condition is readable, and so is the arithmetic the conjecture needed.
0x24042 is four instructions:
24042: MOVF PORTB,W
24044: ANDLW 0x02
24046: BNZ 0x24050 ; PORTB<1> set: return 0
24048: MOVF 0x2d7,W
2404a: ANDLW 0x01
2404e: BZ 0x24052 ; and a software flag clear: return 1
0x238A2 uses the answer to choose group 6 when it is 1 and group 5 when it is 0. So the polarity is
stated: PORTB bit 1 clear is charging.
The scale is millivolts per count, and the trim word is per unit¶
Section 44 wanted a meter on a board. It does not need one, because the conversion is arithmetic and every constant in it is readable.
0x2372A sums eight samples of analogue channel 0 and shifts right three, so it holds a mean in
0 to 1023. Then two words come out of flash through the helper at 0x2E70A, which is nothing but
"read a u16 at a fixed address":
| routine | address | value |
|---|---|---|
0x231B0 |
0x01F580 |
4, on both Harmony Ones |
0x231CE |
0x01F582 |
18724 on one unit, 18416 on the other |
0x231EC |
0x01F5C0 |
94, on both |
0x2320A |
0x01F5C2 |
0xFFFF, on both |
The caller tests each for 0xFFFF and substitutes 1, so an erased word means "not calibrated". Then
0x2E874 multiplies, twice, and the result is
millivolts = mean * word(0x01F580) + ((mean * word(0x01F582)) >> 16)
which is mean * (4 + 18724/65536), or 4.2857 mV a count. Full scale is then 4384 mV, and that
is the closure: the curve runs 3000 to 4051, which needs 700 to 945 counts of the 1023 available, so
the whole of a lithium cell's range fits with headroom and nothing else does. A scale of 4 would put
a full cell off the top of the curve and a scale of 8 would put an empty one below its bottom.
And the firmware compares the result against a literal in the same units. At 0x2385C it tests
the result against 0x0D48, which is 3400, with the charger absent, and raises a flag. 3400 mV is a
low battery warning for a single lithium cell, it sits inside the config's own curve, and it is a
constant in the code rather than anything a config states. Two numbers in the same units, one from
the config and one from the firmware, agreeing about what a battery is.
So section 44's conjecture is a finding. Five things support it and none of them is the shape of the numbers: the eight sample mean, the scale word, the second word's per unit trim, the literal at 3400, and the curve pair.
The trim word was already in the lab, filed as unidentified¶
A claim written earlier in this section said nothing here had read those four words, and that was
wrong. The reasoning was that the arch 12 dumps cover flash 0x000000 to 0x010000 and
0x020000 upwards, so 0x01F580 falls in the gap. It does, in external flash. The processor's
TBLPTR does not reach external flash there: this part has 128 KiB of on-chip program memory at
0x000000 to 0x01FFFF, and only addresses above it go out on the external bus, which is why the
application lives at 0x020000. So 0x01F580 is internal, page 0xFF offset 0xF580, and both
Harmony Ones' 0xFF pages have been read in full.
That is worth stating as a hazard rather than as a slip. The same numeric address names two
different memories depending on who asks. A TBLRD at 0x01F580 reads on-chip flash; a
READ_FLASH over USB at 0x01F580 reads the external part and answers 0xFF, because the internal
window is reached by the top address byte 0xFF instead. Both are correct and they disagree, and
docs/memory-map-one.md lists them as separate rows without saying they overlap.
docs/memory-map-one.md already had these bytes, as two rows reading "unidentified": 0xFF
+0xF580, four bytes, and 0xFF +0xF5C0, two. It also already recorded that two Harmony Ones
differ in 39 bytes and that +0xF582 is one of the three places they do. Which is exactly what a per
unit calibration trim would look like, and nothing had connected the two facts.
Publishing these four values is deliberate. They are instrument calibration and not identity: the
identity block is +0xF400 and is never published here, and the page's other per unit record at
+0xF640 is already quoted in the memory map on the same reasoning.
What is still not established¶
The word at 0x01F5C0, 94 on both units, and its partner at 0x01F5C2, which is erased on both so
its consumer runs on the substituted 1. Both are read by the same helper and neither has a caller
traced here. And what the flag 0x2385C raises at 3400 mV is used for.
Section 104 | the archive | section 106. Section 105 of the findings archive, which is frozen; the reference holds the current answer. The archive on GitHub.