Skip to content

106. LATC bit 5 enables an I2C device, and band 0xC0's thirteen properties are its channels

Three loose ends left by sections 102 and 103: an unnamed pin, thirteen unnamed properties, and the loop at 0x2E53E that also drives the pin. They are one thing, and following the pin found it.

The bus is I2C, in hardware, and only on arch 12

0x2D2E6 writes and 0x2D32E reads through 0x2DCCC and 0x2DD0E, which are not bit banging at all. They drive the MSSP: SSP1CON2 bit 0 for a start, bit 1 for a repeated start, bit 2 for a stop, bits 4 and 5 for the acknowledge, SSP1BUF for the byte, SSP1STAT bit 0 for buffer full and SSP1CON1 bit 7 for a write collision. That is the I2C master, and the address byte is 0xC0 to write and 0xC1 to read, so the device is at 7 bit address 0x60.

The same peripheral is in a different mode on arch 14, and counting the registers says so. The Harmony One's image touches SSP1CON2 ten times; the Harmony 600's and the 700's touch it not at all and use SSP1BUF six times each. SSP1CON2 exists only for I2C, so arch 14 runs the MSSP as SPI, which is exactly what section 8's config read primitive at 0x1B9AC needs. So the reason band 0xC0 is arch 12 only is not a quirk of the opcode table: the device it talks to is arch 12 only, and there is no bus free to talk to one on arch 14.

What the device looks like from the firmware's side

Everything written to it, and nothing is ever read:

what where from register values seen
thirteen two bit channel states 0x2D254, 40 call sites a RAM bitmap at 0x259, then the device 0, 1 and 2
an eight bit level 0x249A0, from base slot 15 group 9 2 and 3, high byte first 16, 64, 128, 255 by band
a second eight bit level 0x249A0, the pair's other half 4 and 5 the same values
an eight bit level 0x23D1C, computed 2 and 3 3, 15, 63, 255
its enable 0x23DF0 and band 0xC0 selector 16 LATC bit 5 set on, clear off

0x23DF0 is the on and off sequence, and it is where the pin gets its name. Powering up calls 0x23E52 and 0x23F10, which set channels to 1, and then sets the pin. Powering down calls 0x23E0C for channels 12 down to 8 and 0x23EA2 for 0 up to 7, all thirteen to 0, and then clears it. A pin set at the end of a device's initialisation and cleared at the start of its shutdown is that device's enable, and that is as far as naming it goes here.

The firmware's own four levels are a logarithmic ladder. 0x23CB2 with its argument 2 to 5 computes 0xFF >> (2 * (5 - argument)), which is 3, 15, 63 and 255, and writes it to registers 2 and 3 with every channel enabled. Group 9's four values, 16, 64, 128 and 255, are the same shape from the config: four steps ending at full scale, spaced so the low end is finely divided. Two independent sources agreeing on the range and the top of it is what makes 255 full scale rather than a coincidence.

Group 9 is not four timeouts, and section 103 said it was

0x249A0 reads group 9's pair for the band and does exactly two things with it: sends the first half to registers 2 and 3 and the second to 4 and 5. There is no countdown, no scheduler entry and no comparison. So "timeout" was wrong, and it was inferred from the values ascending 16, 64, 128, 255 and from the routine sitting inside the display light's states. Corrected in place in section 103.

The structure the section derived from it is untouched: four bytes a band, band 3's pair in the spare run, twelve bytes accounted for. Only the name of the thing was wrong, which is the failure mode this document's own rule about naming a section by its consumer exists to prevent. The consumer was one call deeper than the reading went.

Most of the subsystem is unreachable, and the config is what switches it on

This is the part worth carrying into the application.

  • 0x23CB2 is only ever called with its argument zero, from 0x28CAE and 0x2C9A6, both shutdown paths. gprF14 is written nowhere else in the image. So of 0x23DF0's two arms only the power-down one runs, and 0x23E52, 0x23F10 and the four level ladder at 0x23D00 are unreachable.
  • 0x2D32E, the I2C read, has no callers at all. The device is write only in this build.
  • 0x2E53E has no callers either, and its one variable 0x303 is read there and written nowhere. It starts Timer 1 from the 32.768 kHz oscillator, T1CON 0x1E giving 16384 Hz after the 1:2 prescale, and then loops forever driving LATC bit 5 from bits of TMR1H. Bit 6 of the high byte is timer bit 14, which at that rate toggles every two seconds. It is dead code that would have blinked the device's enable, and it is the routine whose shape made section 102 read the pin as a bit banged output rather than as an enable.

So the firmware turns this device off at shutdown and never turns it on. Everything that switches it on or sets a channel comes from a config, through band 0xC0 selectors 16 and 0 to 12, and everything that sets its level comes from a config, through selector 17 and group 9.

That answers a question section 102 raised and could not settle. It asked why the band's uses are identical in both One configs when one has five devices and eight activities and the other has one and one, and treated it as a dead end for naming. The reason is that they are not content at all: they are the generator's fixed initialisation sequence for this device, emitted into every config, one pass setting each of the thirteen channels off and one setting each on. A config that omitted them would leave the device disabled, which is a rail a writer has to respect and could not have guessed.

What is not established

Which device it is. Thirteen channels of three states, two eight bit level registers, an enable pin and no readback is the shape of an LED driver, and on this remote the obvious load is the keypad backlight, dimmed by the same band that dims the screen. That is an inference and it is not confirmed, so the documents say "the device at 0x60". Naming a peripheral from its shape is what inverted three polarities in section 13, and a part number guessed from a register map cannot be checked against anything here.

What would settle it: the address, the register numbers and the value ranges are enough to identify the part from a datasheet search, and a photograph of the board would do it outright. Neither is firmware work.

Settled for four channels by section 400, at the bench: channels 0 to 3 light the keys beside the screen, since a call setting two of them, added to a screen's entry, is what lit them on the spare Harmony One. The part number is still not established.


Section 105 | the archive | section 107. Section 106 of the findings archive, which is frozen; the reference holds the current answer. The archive on GitHub.