I have similarly have been having a nightmare trying to get the PCA9685 to work with the Jetson Orin Nano. For reference, I have used the PCA9685 with the Jetson Nano before without issue.
Here was my process:
I started with trying to use the I2C Bus 7. Upon running:
sudo i2cdetect -y -r 7
I would get something like:
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: 70 -- -- -- -- -- -- --
The PCA9685 is supposed to appear on 0x40 and 0x70. So there is something weird going on. I tried multiple different PCA9685 modules (2 of them that I knew worked correctly) and I could never get a 0x40 address to show up for them, only 0x70.
So I tried to use them on the 0x70 channel. Unfortunately it seems extremely difficult to address the I2C Bus 7 using Python. Using board:
import board
dir(board)
ouput:
['CE0', 'CE1', 'D10', 'D11', 'D12', 'D13', 'D16', 'D17', 'D18', 'D19', 'D20', 'D21', 'D22', 'D23', 'D24', 'D25', 'D26', 'D27', 'D4', 'D5', 'D6', 'D7', 'D8', 'D9', 'I2C', 'MISO', 'MOSI', 'SCK', 'SCL', 'SCLK', 'SCL_1', 'SDA', 'SDA_1', 'SPI', '__blinka__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__repo__', '__spec__', '__version__', 'ap_board', 'board_id', 'detector', 'os', 'pin', 'sys']
No SCL_7 or SDA_7 to use. Couldn’t figure out how to address bus 7 any other way either.
So, I tried switching to I2C Bus 1. I verified that I was able to see the device on 0x70 (still not appearing on 0x40, although that channel is already taken on this bus) with i2cdetect:
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- UU -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: UU -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: 70 -- -- -- -- -- -- --
Then I tried using the device:
i2c = busio.I2C(board.SCL_1, board.SDA_1)
pca = adafruit_pca9685.PCA9685(i2c, address=0x70)
pca.frequency = 1000
leftPump = pca.channels[0]
leftPump.duty_cycle = 0
and got the following error:
Traceback (most recent call last):
File "TankCalibration.py", line 17, in <module>
leftPump.duty_cycle = 0
File "/home/maize/.local/lib/python3.8/site-packages/adafruit_pca9685.py", line 95, in duty_cycle
self._pca.pwm_regs[self._index] = (0, 0x1000)
File "/home/maize/.local/lib/python3.8/site-packages/adafruit_register/i2c_struct_array.py", line 70, in __setitem__
i2c.write(buf)
File "/home/maize/.local/lib/python3.8/site-packages/adafruit_bus_device/i2c_device.py", line 100, in write
self.i2c.writeto(self.device_address, buf, start=start, end=end)
File "/home/maize/.local/lib/python3.8/site-packages/busio.py", line 219, in writeto
return self._i2c.writeto(address, memoryview(buffer)[start:end], stop=True)
File "/home/maize/.local/lib/python3.8/site-packages/adafruit_blinka/microcontroller/generic_linux/i2c.py", line 60, in writeto
self._i2c_bus.write_bytes(address, buffer[start:end])
File "/home/maize/.local/lib/python3.8/site-packages/Adafruit_PureIO/smbus.py", line 303, in write_bytes
self._device.write(buf)
OSError: [Errno 121] Remote I/O error
Exiting...
Cleaning up pins
Afterwards, I couldn’t even see the devices on i2cdetect. Has anyone had any success/insight/ideas that they would be willing to share?
Thanks!