At night I’d like to be able to turn off the LED’s to avoid distracting sleeping people. The usr0-usr3 led’s are easy to control, but the power LED had me stuck. Checking out the datasheet on the schematics for the BeagleBoneBlack I see that the led is controlled via the VLDO2 pin of the tp65217 There is nothing else on that line, so turning it off should not impact anything else AND it is sitting on a i2c bus, must likely i2c0.
Using i2c-tools and running them as root, I can make some adjustments.
i2cdetect -y -r 0 I
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: – – – – – – – – – – – – –
10: – – – – – – – – – – – – – – – –
20: – – – – UU – – – – – – – – – – –
30: – – – – UU – – – – – – – – – – –
40: – – – – – – – – – – – – – – – –
50: UU – – – – – – – – – – – – – – –
60: – – – – – – – – – – – – – – – –
70: UU – – – – – – –
That is promising. Checking the device tree in /sys I can see what i2c devices we have:
ls /sys/class/i2c-dev/i2c-0/device/
0-0024 0-0050 delete_device i2c-dev new_device subsystem
0-0034 0-0070 device name power uevent
Each 0-00xx entry is an address of an i2c device and each directory has a file called name in it, so checking them all is a simple matter.
cat /sys/class/i2c-dev/i2c-0/device/0-00*/name
tps65217
dummy
24c256
tda998x
Tthe power control chip is on this bus[tps65217] and likely it is 0-0024 the first entry.
`
cat /sys/class/i2c-dev/i2c-0/device/0-0024/name
`
tps65217
Here is the datasheet for the 65217, http://www.ti.com/lit/ds/slvsb64f/slvsb64f.pdf
Skimming through for LDO2 I find that page 63 has the voltage settings, so just to check I’ll grab that data.
i2cget -f -y 0 0x24 0x13
0x38
Convert that from hex to binary, 11 1000, and check the chart. It is 3.300 V, just what I’m expecting. Note that this register is password protected, so checking page 40 we see that we need to xor the address of the register(0x13) with the password(0x7d) and write that to the password protect register right before setting the value. IE:
i2cset -f -y 0 0x24 0x0B 0x6e
Then the lowest voltage is .9v which is 0x00, so to set it:
i2cset -f -y 0 0x24 0x13 0x00
Check the value:
i2cget -f -y 0 0x24 0x13
0x38
No change. Dang… this is a level 2 password protected register, so we need to do the above twice in a row.
i2cset -f -y 0 0x24 0x0B 0x6e i2cset -f -y 0 0x24 0x13 0x00 i2cset -f -y 0 0x24 0x0B 0x6e i2cset -f -y 0 0x24 0x13 0x00
Check the value.
i2cget -f -y 0 0x24 0x13
0x00
And look at the board, sure enough the LED is off! I originally tried to disable the LOD2 output entirely[page 67]
i2cset -f -y 0 0x24 0x0B 0x6b i2cset -f -y 0 0x24 0x16 0x7e
This worked to disable it, but there is something monitoring LOD2 to make sure the board is working, and disabling that caused the board to shutdown immediately.