Closed pvint closed 6 years ago
So I'm looking deeper into this and this is what I've found.
0x20
for MODE1
(Auto-Increment ONLY) and run the demo, it works and the two MODE
registers show up as 20
and 04
, respectively. I still don't know why this works for me but not for you.
pi@raspberrypi:~/src/libPCA9685/examples $ ./PCA9685demo
PCA9685_openI2C(): opened /dev/i2c-1 as fd 3
_PCA9685_readI2CReg(): 40:00:46 20 04 e2 e4 e8 e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
20 04 e2 e4 e8 e0
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
_PCA9685_readI2CReg(): 40:fa:05 00 00 00 00 1e
00 00 00 00 1e
_PCA9685_writeI2CRaw: 00: 06
PCA9685_setPWMVal(): reg fa, on 00, off 00
_PCA9685_writeI2CReg(): 40:fa:01 00
_PCA9685_writeI2CRaw: 40: fa 00
_PCA9685_writeI2CReg(): 40:fb:01 00
_PCA9685_writeI2CRaw: 40: fb 00
_PCA9685_writeI2CReg(): 40:fc:01 00
_PCA9685_writeI2CRaw: 40: fc 00
_PCA9685_writeI2CReg(): 40:fd:01 00
_PCA9685_writeI2CRaw: 40: fd 00
_PCA9685_readI2CReg(): 40:00:01 11
_PCA9685_writeI2CReg(): 40:00:01 11
_PCA9685_writeI2CRaw: 40: 00 11
_PCA9685_writeI2CReg(): 40:fe:01 1e
_PCA9685_writeI2CRaw: 40: fe 1e
_PCA9685_writeI2CReg(): 40:00:01 01
_PCA9685_writeI2CRaw: 40: 00 01
_PCA9685_writeI2CReg(): 40:00:01 81
_PCA9685_writeI2CRaw: 40: 00 81
_PCA9685_writeI2CReg(): 40:00:01 20
_PCA9685_writeI2CRaw: 40: 00 20
_PCA9685_readI2CReg(): 40:00:46 20 04 e2 e4 e8 e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
20 04 e2 e4 e8 e0
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
_PCA9685_readI2CReg(): 40:fa:05 00 00 00 00 1e
00 00 00 00 1e
0x21
(Auto-Increment and All Call) I get the same result. Also note that MODE1
is initially still 20
from the previous test but subsequently is set to 21
and read as 21
and the demo also works.
PCA9685_openI2C(): opened /dev/i2c-1 as fd 3
_PCA9685_readI2CReg(): 40:00:46 20 04 e2 e4 e8 e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
20 04 e2 e4 e8 e0
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
_PCA9685_readI2CReg(): 40:fa:05 00 00 00 00 1e
00 00 00 00 1e
_PCA9685_writeI2CRaw: 00: 06
PCA9685_setPWMVal(): reg fa, on 00, off 00
_PCA9685_writeI2CReg(): 40:fa:01 00
_PCA9685_writeI2CRaw: 40: fa 00
_PCA9685_writeI2CReg(): 40:fb:01 00
_PCA9685_writeI2CRaw: 40: fb 00
_PCA9685_writeI2CReg(): 40:fc:01 00
_PCA9685_writeI2CRaw: 40: fc 00
_PCA9685_writeI2CReg(): 40:fd:01 00
_PCA9685_writeI2CRaw: 40: fd 00
_PCA9685_readI2CReg(): 40:00:01 11
_PCA9685_writeI2CReg(): 40:00:01 11
_PCA9685_writeI2CRaw: 40: 00 11
_PCA9685_writeI2CReg(): 40:fe:01 1e
_PCA9685_writeI2CRaw: 40: fe 1e
_PCA9685_writeI2CReg(): 40:00:01 01
_PCA9685_writeI2CRaw: 40: 00 01
_PCA9685_writeI2CReg(): 40:00:01 81
_PCA9685_writeI2CRaw: 40: 00 81
_PCA9685_writeI2CReg(): 40:00:01 21
_PCA9685_writeI2CRaw: 40: 00 21
_PCA9685_readI2CReg(): 40:00:46 21 04 e2 e4 e8 e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
21 04 e2 e4 e8 e0
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
_PCA9685_readI2CReg(): 40:fa:05 00 00 00 00 1e
00 00 00 00 1e
SUBADRn
bits simply directs the PCA9685 to respond on addrs 0x71
, 0x72
, and 0x74
. Removing those simply removes those addrs from i2cdetect
. I think removing them is correct until SUBADR
functionality is specifically added. So I do approve this PR, but I'd like to get to the bottom of the MODE1
discrepancy so I'll re-open an issue for that. Furthermore, I'll merge this into develop
but not into master
until there is enough modification to justify a new minor version for the lib.Good stuff. I'd like to understand the SUBx addresses as well (especially because I think I would like to use them!).
As luck would have it I received new PCBs today and plan to assemble a couple tonight. On the off chance that it's something off with my particular PCA9685 device I was testing with I will make sure to use parts from the new batch.
When I "fixed" my lockup problem in #2 I added the sub address bits (_PCA9685_SUB[1-3]BIT) but I should not have.
After running init with these set the PCA9685 sets more I²C addresses.
My device's base address is 0x70, here is output from
i2cdetect -y 1
before init with those bits set:And here is what I see after running init:
(The device at 0x48 is a temp sensor and is not relevant to this issue)
Removing the SUB bits prevents this, but I still need the ALLCALL bit set for my device to work.
(TODO: I would like to add the use of the SUB bits, as it would be nice to have groups so I can control certain zones of lights together!)