kriswilk / buzzah

A simple, easy-to-assemble vibrotactile coordinated reset (vCR) device for Parkinson's disease sufferers.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

try_lock runtime errror?

PWPInnovator898 opened this issue · comments

Hello Kris;
I continue to see therapeutic benefits from the Buzzah-based electronics, albeit mild to moderate.
I am now debugging prototype h/w for a smaller 4-finger version to eventually be sync'd w/ Bluetooth.
Photo attached.

image

For now, I'm using an adafruit feather rp2040 w/ an 8-ch tca9548a and 4 x drv2605l's.
However, I can't seem to get past the following runtime error: (code snippet shown first):

===========================================================
i2c = busio.I2C(board.SCL, board.SDA, frequency=100000)
mux = adafruit_tca9548a.TCA9548A(i2c)
print("\n... i2c init assign mux ok ... \n")
print("... pass i2c pullup test...\n")

drivers = []
for (port) in mux:
print("...enter port in mux ...\n")
try:
print("...enter try loop...\n", port, "\n")
drivers.append(adafruit_drv2605.DRV2605(port)) # this is the line 101 runtime error from REPL below:
except ValueError:
drivers.append(False)

REPL runtime error:
code.py output:

... i2c init assign mux success ...
... pass i2c pullup test...
...enter port in mux ...
...enter try loop...
<TCA9548A_Channel object at 0x200112c0>

Traceback (most recent call last):
File "code.py", line 101, in
File "adafruit_drv2605.py", line 93, in init
File "adafruit_tca9548a.py", line 62, in try_lock
OSError: [Errno 19] No such device

Code done running.

Have you seen this error before? Seems like the master i2c from the rp2040 is perhaps locking the i2c bus?
If so, how to s/w reset the tca9548a?
Thanks very much for your thoughts, Phillip

Not sure what's the matter from the code you posted but a few of observations:

  • Your i2c initialization is throttled (frequency=100000). Is this for a reason?
  • Rather than busio.I2C(board.SCL, board.SDA), consider simply using board.I2C() which does the same thing.
  • The photo of your PCB with components mounted looks like it has several solder joints unfinished. I presume that was in progress, but double-check all your i2c lines and power/gnd are connected throughout.

To troubleshoot, I'd start with Adafruit's test code for the multiplexer, at:

https://learn.adafruit.com/adafruit-tca9548a-1-to-8-i2c-multiplexer-breakout/circuitpython-python

That does a simple scan of the i2c bus and should report the addresses of any devices connected to each port.

Thank you Kris for the suggestions. I throttled back the i2c Clock because the python interpreter was reporting “pull ups
not detected” on the SDA/SCL pins. Once I added them, the interpreter got past that point in the program, and I could run it at the 400 kHz rate. The odd thing is that the
I2c mux Is supposed to already have them integrated. They are supposed to be 10k so, I added parallel 10ks To get the code through that test. All of this does point to some connection problem (?). I’ll continue to debug.
Thanks again for your kind help as always.

Hello PWPInnovator, I am also trying to use the 9548 MUX version without the Stemma connectors and got the same PULL UPS NOT DETECTED error. I think the reason we are getting the error is that the Stemma version of the 9548 has 10K pull ups integrated, whereas the non-stemma version does not. My question is this: Did you have to add pull ups to the output SDA/SCL pins of the MUX or just the inputs to get past this error? I tried adding pull ups to the two input pins and I keep getting the same error.

Each I2C output port of the mux requires pullups on both SDA and SCL.
I added 10k pullups to both SCL and SDA on each DRV2605L unit. See attached.
image