Closed codenio closed 3 years ago
Thanks for your contribution :)
@codenio I do not have this particular hardware, it seems that you have, is that correct? if so I could take a look at the datasheet and see the changes made,as I could not test. let me know thanks.
@codenio I do not have this particular hardware, it seems that you have, is that correct? if so I could take a look at the datasheet and see the changes made,as I could not test. let me know thanks.
yes @jposada202020 , I have this hardware with me, and the Bug and FIx mentioned earlier are results from hardware.
Good take a look to the Datasheet tonight to see what we are talking about here. Thanks
I can add the entire code used for testing and its results in this thread by tomorrow
Yes, as mentioned in the other PR, we like to include new examples that way people coulddiscover the new features.
I took a look, at the datasheet, if you have the test code that would be great. Thanks
Added Text code and added the same in examples.rst :+1:
Mocked Test Code : examples/tca9548a_channelscan.py It uses VPi (Virtual-Pi) Package for testing with mock adafruit_tca9548a library
# This example shows scanning of each TCA9548A channels.
try:
import board
import busio
import adafruit_tca9548a
except:
import VPi.board as board
import VPi.busio as busio
import VPi.adafruit_tca9548a as adafruit_tca9548a
# Create I2C bus as normal
i2c = busio.I2C(board.SCL, board.SDA)
# Create the TCA9548A object and give it the I2C bus
tca = adafruit_tca9548a.TCA9548A(i2c)
# Scan the Main I2C Channel present in your board
print(f"Scan of Main I2C Channel:{[hex(i) for i in i2c.scan()]}")
# Scan Each TCA9548A channel
for i in range(8):
print(f"Scan of TCA[{i}] Channel: {[hex(j) for j in tca[i].scan()]}")
$ python examples/tca9548a_channelscan.py
Scan of Main I2C Channel:['0x70']
Scan of TCA[0] Channel: ['0xec', '0x70']
Scan of TCA[1] Channel: ['0x55', '0x70']
Scan of TCA[2] Channel: ['0xeb', '0xc5', '0x70']
Scan of TCA[3] Channel: ['0xe0', '0x70']
Scan of TCA[4] Channel: ['0x4a', '0x19', '0x91', '0x70']
Scan of TCA[5] Channel: ['0x14', '0x70']
Scan of TCA[6] Channel: ['0xfe', '0xfd', '0x9a', '0x70']
Scan of TCA[7] Channel: ['0x5b', '0x7', '0x70']
@codenio I will test this change with hardware on hand at the end of this week, also I want to see if this could help be or not an issue in the VL53L0X library. Also just, after discussion last week, because M0 boards does not have f-strings, we would avoid them in the example code.. We have just change our design guide last week. Thanks and sorry for that last minute change https://github.com/adafruit/circuitpython/blob/main/docs/design_guide.rst
@codenio I will test this change with hardware on hand at the end of this week, also I want to see if this could help be or not an issue in the VL53L0X library. Also just, after discussion last week,
Sure will take a look
because M0 boards does not have f-strings, we would avoid them in the example code.. We have just change our design guide last week. Thanks and sorry for that last minute change https://github.com/adafruit/circuitpython/blob/main/docs/design_guide.rst
Replaced fstrings with format :+1:
Thanks I have to re-submit one of my own PRs 😄 . question could you Mock-up test try to mock this issue? https://github.com/adafruit/Adafruit_CircuitPython_VL53L0X/issues/27. Just asking :)
on it already, suggesting some debugging tips there.
@jposada202020 , happy to see your reviews, I have the following comments
is Active Low RESET of TCA9548A is pulled up to 5v with suitable resistor..? without Pulling it up TCA9548A can react abnormally (from my experience) and PFA a clip from Datasheet as it say "MUST BE CONNECTED"
it is observable that, connected MMA8451 appears in the 2nd channel, not from first (0th index), but from last(7th Index).
Further Testing Required.
- You are right it needs a pull-up resistor. Adafruit TCA9548A Breakout already has taken this into consideration. see https://cdn-learn.adafruit.com/assets/assets/000/027/693/original/adafruit_products_schem.png?1442010910
I had the same feeling that, it is taken care at the design level until I had issues with the Breakout Board, It would partially detect and would go into reset state in random intervals (may be specific to my environment or setup). so decided to pull it up externally and it started working fine.
Gotcha, we will see
I did a retake on this
This PR works, with a SAMD51, and the nRF52840, however it does not work for the RP2040. I tested this with the code mentioned above, and with a modified simpletest to include two sensor and not one. Sensor were a BH1750 and a MMA8451
Adafruit CircuitPython 6.2.0 on 2021-04-05; Adafruit Feather M4 Express with samd51j19
>>> import tca9548_scantest
Scan of Main I2C Channel:['0x70']
Scan of TCA[0] Channel: ['0x70']
Scan of TCA[1] Channel: ['0x1d', '0x70']
Scan of TCA[2] Channel: ['0x70']
Scan of TCA[3] Channel: ['0x70']
Scan of TCA[4] Channel: ['0x23', '0x70']
Scan of TCA[5] Channel: ['0x70']
Scan of TCA[6] Channel: ['0x70']
Scan of TCA[7] Channel: ['0x70']
>>> import tca9548a_simpletest
Acceleration: x=-0.283m/s^2 y=1.097m/s^2 z=9.821m/s^2
346.67 Lux
Acceleration: x=-0.354m/s^2 y=1.087m/s^2 z=9.797m/s^2
345.83 Lux
Adafruit CircuitPython 6.2.0 on 2021-04-05; Adafruit Feather RP2040 with rp2040
>>> import tca9548_scantest
Scan of Main I2C Channel:['0x70']
Scan of TCA[0] Channel: ['0x70']
Scan of TCA[1] Channel: ['0x70']
Scan of TCA[2] Channel: ['0x70']
Scan of TCA[3] Channel: ['0x70']
Scan of TCA[4] Channel: ['0x70']
Scan of TCA[5] Channel: ['0x70']
Scan of TCA[6] Channel: ['0x70']
Scan of TCA[7] Channel: ['0x70']
Adafruit CircuitPython 6.2.0 on 2021-04-05; Adafruit Feather RP2040 with rp2040
>>> import tca9548a_simpletest
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "tca9548a_simpletest.py", line 11, in <module>
File "/lib/adafruit_bh1750.py", line 164, in __init__
ValueError: No I2C device at address: 23
Adafruit CircuitPython 6.2.0 on 2021-04-05; Adafruit Feather nRF52840 Express with nRF52840
>>> import tca9548a_simpletest
Acceleration: x=-0.273m/s^2 y=1.135m/s^2 z=9.802m/s^2
322.08 Lux
Adafruit CircuitPython 6.2.0 on 2021-04-05; Adafruit Feather nRF52840 Express with nRF52840
>>> import tca9548_scantest
Scan of Main I2C Channel:['0x8', '0x70']
Scan of TCA[0] Channel: ['0x8', '0x70']
Scan of TCA[1] Channel: ['0x8', '0x1d', '0x70']
Scan of TCA[2] Channel: ['0x8', '0x70']
Scan of TCA[3] Channel: ['0x8', '0x70']
Scan of TCA[4] Channel: ['0x8', '0x23', '0x70']
Scan of TCA[5] Channel: ['0x8', '0x70']
Scan of TCA[6] Channel: ['0x8', '0x70']
Scan of TCA[7] Channel: ['0x8', '0x70']
>>>
import time
import board
import adafruit_mma8451
import adafruit_tca9548a
import adafruit_bh1750
i2c = board.I2C()
tca = adafruit_tca9548a.TCA9548A(i2c)
sensor = adafruit_mma8451.MMA8451(tca[1])
sensor2 = adafruit_bh1750.BH1750(tca[4])
while True:
x, y, z = sensor.acceleration
print(
"Acceleration: x={0:0.3f}m/s^2 y={1:0.3f}m/s^2 z={2:0.3f}m/s^2".format(x, y, z)
)
time.sleep(1)
print("%.2f Lux" % sensor2.lux)
time.sleep(1)
So basically this work, and there is maybe a bug in the RP2040
I am trying to run this PR on a feather m4 express and a feather rp2040 but I am a bit confused about actual code used for the "scantest" When I try the tca9548a_channelscan.py from the repository on the Feather_m4 I get
Adafruit CircuitPython 7.0.0-alpha.2-646-g7df5d74d9 on 2021-05-23; Adafruit Feather M4 Express with samd51j19
>>>
>>> import tca9548a_channelscan
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "tca9548a_channelscan.py", line 16, in <module>
RuntimeError: Function requires lock
>>>
with this PR installed. What code are you using for the test?
You are right I mentioned regarding the lock in previous comments but I never actually put the code. here the modified code
# SPDX-FileCopyrightText: 2021 codenio (Aananth K)
# SPDX-License-Identifier: MIT
# This example shows scanning of each TCA9548A channels.
import board
import busio
import adafruit_tca9548a
# Create I2C bus as normal
i2c = busio.I2C(board.SCL, board.SDA)
# Create the TCA9548A object and give it the I2C bus
tca = adafruit_tca9548a.TCA9548A(i2c)
# Scan the Main I2C Channel present in your board
i2c.try_lock()
print("Scan of Main I2C Channel:{}".format([hex(i) for i in i2c.scan()]))
i2c.unlock()
# Scan Each TCA9548A channel
for i in range(8):
print("Scan of TCA[{}] Channel: {}".format(i, [hex(j) for j in tca[i].scan()]))
I can confirm the same problematic behavior on the rp2040
Adafruit CircuitPython 7.0.0-alpha.2-646-g7df5d74d9 on 2021-05-23; Adafruit Feather M4 Express with samd51j19
>>>
>>> import scantest
Scan of Main I2C Channel:['0x70']
Scan of TCA[0] Channel: ['0x70']
Scan of TCA[1] Channel: ['0x5e', '0x70']
Scan of TCA[2] Channel: ['0x70']
Scan of TCA[3] Channel: ['0x70']
Scan of TCA[4] Channel: ['0x23', '0x70']
Scan of TCA[5] Channel: ['0x70']
Scan of TCA[6] Channel: ['0x70']
Scan of TCA[7] Channel: ['0x70']
>>>
Adafruit CircuitPython 7.0.0-alpha.2-646-g7df5d74d9 on 2021-05-23; Adafruit Feather RP2040 with rp2040
>>> import scantest
Scan of Main I2C Channel:['0x70']
Scan of TCA[0] Channel: ['0x70']
Scan of TCA[1] Channel: ['0x70']
Scan of TCA[2] Channel: ['0x70']
Scan of TCA[3] Channel: ['0x70']
Scan of TCA[4] Channel: ['0x70']
Scan of TCA[5] Channel: ['0x70']
Scan of TCA[6] Channel: ['0x70']
Scan of TCA[7] Channel: ['0x70']
>>>
Thanks, strange.. I added this to our Weekly meeting
however, the mux works OK on the RP2040
Adafruit CircuitPython 7.0.0-alpha.2-646-g7df5d74d9 on 2021-05-23; Adafruit Feather RP2040 with rp2040
>>> import tca9548a_test
X: 0.0, Y: 0.098, Z: 0.0 mT
109.58 Lux
X: 0.0, Y: 0.098, Z: -0.098 mT
111.25 Lux
X: 0.196, Y: 0.196, Z: 0.0 mT
111.25 Lux
X: 0.196, Y: -0.098, Z: 0.0 mT
111.25 Lux
X: -0.098, Y: 0.098, Z: -0.098 mT
111.25 Lux
X: 0.0, Y: -0.098, Z: -0.098 mT
111.25 Lux
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "tca9548a_test.py", line 28, in <module>
KeyboardInterrupt:
>>>
as well as on the m4
Adafruit CircuitPython 7.0.0-alpha.2-646-g7df5d74d9 on 2021-05-23; Adafruit Feather M4 Express with samd51j19
>>> import tca9548a_test
X: 0.392, Y: 0.0, Z: 0.098 mT
109.17 Lux
X: 0.0, Y: 0.196, Z: -0.098 mT
109.17 Lux
X: 0.294, Y: 0.196, Z: 0.098 mT
109.17 Lux
X: 0.294, Y: 0.098, Z: 0.098 mT
109.17 Lux
X: 0.098, Y: 0.098, Z: -0.098 mT
109.17 Lux
X: 0.196, Y: 0.098, Z: 0.098 mT
109.17 Lux
X: 0.196, Y: 0.098, Z: -0.098 mT
109.17 Lux
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "tca9548a_test.py", line 28, in <module>
KeyboardInterrupt:
>>>
I have a bht1750 and a tlv493d attached running this code
import time
import board
import busio
import adafruit_tca9548a
import adafruit_bh1750
import adafruit_tlv493d
# Create I2C bus as normal
i2c = busio.I2C(board.SCL, board.SDA)
# Create the TCA9548A object and give it the I2C bus
tca = adafruit_tca9548a.TCA9548A(i2c)
# For each sensor, create it using the TCA9548A channel instead of the I2C object
bh = adafruit_bh1750.BH1750(tca[4])
tlv = adafruit_tlv493d.TLV493D(tca[1])
# After initial setup, can just use sensors as normal.
while True:
print("X: %s, Y: %s, Z: %s mT" % tlv.magnetic)
print("%.2f Lux" % bh.lux)
time.sleep(1)
even stranger - I plugged in the rp2040 and did 2 scans with different (incorrect) results
Adafruit CircuitPython 7.0.0-alpha.2-646-g7df5d74d9 on 2021-05-23; Adafruit Feather RP2040 with rp2040
>>> import scantest
Scan of Main I2C Channel:['0x70']
Scan of TCA[0] Channel: ['0x8', '0x23', '0x70']
Scan of TCA[1] Channel: ['0x70']
Scan of TCA[2] Channel: ['0x70']
Scan of TCA[3] Channel: ['0x70']
Scan of TCA[4] Channel: ['0x70']
Scan of TCA[5] Channel: ['0x70']
Scan of TCA[6] Channel: ['0x70']
Scan of TCA[7] Channel: ['0x70']
>>>
soft reboot
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Hello World!
Code done running.
Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 7.0.0-alpha.2-646-g7df5d74d9 on 2021-05-23; Adafruit Feather RP2040 with rp2040
>>>
>>> import scantest
Scan of Main I2C Channel:['0x70']
Scan of TCA[0] Channel: ['0x70']
Scan of TCA[1] Channel: ['0x70']
Scan of TCA[2] Channel: ['0x70']
Scan of TCA[3] Channel: ['0x70']
Scan of TCA[4] Channel: ['0x70']
Scan of TCA[5] Channel: ['0x70']
Scan of TCA[6] Channel: ['0x70']
Scan of TCA[7] Channel: ['0x70']
>>>
and now the I2C is failing on the RP2040
>>> import tca9548a_test
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "tca9548a_test.py", line 22, in <module>
File "adafruit_tlv493d.py", line 106, in __init__
ValueError: No I2C device at address: 5e
BUT -- after a reboot -- it is working again ..... sometimes
Yes I see some of these results also, the 0x8 ghost is present in the nRF52840, and I have seen in folks commenting about these in discord
just FYI -- I connected the 2 sensors directly to the RP2040 with the tca9548a still connected and an I2C scan looks normal
Adafruit CircuitPython 7.0.0-alpha.2-646-g7df5d74d9 on 2021-05-23; Adafruit Feather RP2040 with rp2040
>>> import i2c_scan
Scanning I2C bus
0x23
0x5e
0x70
3 device(s) found on I2C bus
>>>
>>>
soft reboot
and the sensors work normally
Adafruit CircuitPython 7.0.0-alpha.2-646-g7df5d74d9 on 2021-05-23; Adafruit Feather RP2040 with rp2040
>>> import test_i2c
X: 0.0, Y: -0.098, Z: -0.196 mT
3.75 Lux
X: 0.294, Y: 0.196, Z: 0.0 mT
3.75 Lux
X: 0.0, Y: 0.196, Z: 0.0 mT
3.75 Lux
and repeatably....
@jposada202020 and @jerryneedell
# Scan the Main I2C Channel present in your board
i2c.try_lock()
print("Scan of Main I2C Channel:{}".format([hex(i) for i in i2c.scan()]))
i2c.unlock()
I Feel that the i2c lock for i2c.scan() should be added inside Adafruit_Blinka.busio.i2c.scan() method to make it work across all the circuit python platforms..?
do let me know your thoughts.
@codenio :) thanks, I think that would be a totally different PR. Blinka has work very well in different contexts, so different boards and sensors, and this is proven over time. So, I am not to keen to change a library just because one I2C Mux. But this is my opinion, and maybe not the people that work with Blink, so a PR to discuss is the best way to open that discussion
so do i need to push the modified example with i2c.try_lock() for merging this PR..? I had made the changes already, just wanted to confirm before pushing it.
Could we try this example, that scans main channel before initialising TCA9548A, to debug further..?
# SPDX-FileCopyrightText: 2021 codenio (Aananth K)
# SPDX-License-Identifier: MIT
# This example shows scanning of each TCA9548A channels.
import board
import busio
import adafruit_tca9548a
# Create I2C bus as normal
i2c = busio.I2C(board.SCL, board.SDA)
# Scan the Main I2C Channel present in your board
print("Scan of Main I2C Channel:{}".format([hex(i) for i in i2c.scan()]))
# Create the TCA9548A object and give it the I2C bus
tca = adafruit_tca9548a.TCA9548A(i2c)
# Scan Each TCA9548A channel
for i in range(8):
print("Scan of TCA[{}] Channel: {}".format(i, [hex(j) for j in tca[i].scan()]))
That still fails without a lock
Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 7.0.0-alpha.2-646-g7df5d74d9 on 2021-05-23; Adafruit Feather RP2040 with rp2040
>>>
>>> import scantest2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "scantest2.py", line 13, in <module>
RuntimeError: Function requires lock
>>>
@Codenio lets wait until tomorrow I will like more inputs regarding this. But for sure, if the example fails, without the lock a change is needed because user needs working code without any hardware tweaking.
Commented in #31 thread with link to an example.
Keep in mind the boiler plate I2C scan code without a mux involved:
import board
i2c = board.I2C()
i2c.try_lock()
i2c.scan()
i2c.unlock()
The general idea with the TCA is that each channel mimics that same behavior. Try with example linked in issue thread and see if that approach will work.
@caternuson why does the RP2040 behave differently from the M4?
I don't have a BH1750 to try for testing. But all the scanning I'm doing (so far at least) with a Feather RP2040 seems to work OK.
Here's an example scan sweep, with a MMA8451 on channel 1 and a MSA301 on channel 5:
>>> for channel in range(8):
... if tca[channel].try_lock():
... print("Channel {}:".format(channel), end='')
... tca[channel].scan()
... tca[channel].unlock()
...
Channel 0:[112]
Channel 1:[29, 112]
Channel 2:[112]
Channel 3:[112]
Channel 4:[112]
Channel 5:[38, 112]
Channel 6:[112]
Channel 7:[112]
>>>
EDIT above is with current library, not PR code.
I have a bme680 and a tlv4930 on a feather Rp2040 I ran this
import adafruit_tca9548a
# Create I2C bus as normal
i2c = busio.I2C(board.SCL, board.SDA)
i2c.try_lock()
# Scan the Main I2C Channel present in your board
print("Scan of Main I2C Channel:{}".format([hex(i) for i in i2c.scan()]))
i2c.unlock()
# Create the TCA9548A object and give it the I2C bus
tca = adafruit_tca9548a.TCA9548A(i2c)
# Scan Each TCA9548A channel
for channel in range(8):
if tca[channel].try_lock():
print("Channel {}:".format(channel), end='')
tca[channel].scan()
tca[channel].unlock()
and i hangs on the first channel of tht tca9548a
Adafruit CircuitPython 7.0.0-alpha.2-646-g7df5d74d9 on 2021-05-23; Adafruit Feather RP2040 with rp2040
>>>
>>> import scantest2
Scan of Main I2C Channel:['0x70']
Channel 0:
hung
``
oh wait -- did you have the PR installed or not?
No PR, the comment was edited...
without thr PR I get
Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 7.0.0-alpha.2-646-g7df5d74d9 on 2021-05-23; Adafruit Feather RP2040 with rp2040
>>>
>>> import scantest2
Scan of Main I2C Channel:['0x70']
Channel 0:Channel 1:Channel 2:Channel 3:Channel 4:Channel 5:Channel 6:Channel 7:>>>
and the same on an M4 -- did I type something wrong?
fixed teh code
Adafruit CircuitPython 7.0.0-alpha.2-646-g7df5d74d9 on 2021-05-23; Adafruit Feather RP2040 with rp2040
>>> import scantest2
Scan of Main I2C Channel:['0x70']
Channel 0:['0x70']
Channel 1:['0x5e', '0x70']
Channel 2:['0x70']
Channel 3:['0x70']
Channel 4:['0x70', '0x77']
Channel 5:['0x70']
Channel 6:['0x70']
Channel 7:['0x70']
>>>
using
# This example shows scanning of each TCA9548A channels.
import board
import busio
import adafruit_tca9548a
# Create I2C bus as normal
i2c = busio.I2C(board.SCL, board.SDA)
i2c.try_lock()
# Scan the Main I2C Channel present in your board
print("Scan of Main I2C Channel:{}".format([hex(i) for i in i2c.scan()]))
i2c.unlock()
# Create the TCA9548A object and give it the I2C bus
tca = adafruit_tca9548a.TCA9548A(i2c)
# Scan Each TCA9548A channel
for channel in range(8):
if tca[channel].try_lock():
print("Channel {}:".format(channel), end='')
print("{}".format([hex(i) for i in tca[channel].scan()]))
tca[channel].unlock()
Now the scan works -- wit the bh1750 , but I cant access it
Adafruit CircuitPython 7.0.0-alpha.2-646-g7df5d74d9 on 2021-05-23; Adafruit Feather RP2040 with rp2040
>>>
>>> import scantest2
Scan of Main I2C Channel:['0x70']
Channel 0:['0x70']
Channel 1:['0x5e', '0x70']
Channel 2:['0x70']
Channel 3:['0x70']
Channel 4:['0x23', '0x70']
Channel 5:['0x70']
Channel 6:['0x70']
Channel 7:['0x70']
>>>
>>>
soft reboot
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Hello World!
Code done running.
Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 7.0.0-alpha.2-646-g7df5d74d9 on 2021-05-23; Adafruit Feather RP2040 with rp2040
>>> import tca9548a_test
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "tca9548a_test.py", line 22, in <module>
File "adafruit_tlv493d.py", line 106, in __init__
ValueError: No I2C device at address: 5e
>>>
I'm also using 6.2.0. I added a BME680 and TLV4930 to channel 3. Running your scan code above, I get:
Adafruit CircuitPython 6.2.0 on 2021-04-05; Adafruit Feather RP2040 with rp2040
>>> import scantest2
Scan of Main I2C Channel:['0x70']
Channel 0:['0x70']
Channel 1:['0x1d', '0x70']
Channel 2:['0x70']
Channel 3:['0x5e', '0x70', '0x77']
Channel 4:['0x70']
Channel 5:['0x26', '0x38', '0x70']
Channel 6:['0x70']
Channel 7:['0x70']
>>>
For me with jerryn code, with a BH1750 it hangs in Channel 0.
Adafruit CircuitPython 6.2.0 on 2021-04-05; Adafruit Feather RP2040 with rp2040
>>> import testing_pt
Scan of Main I2C Channel:['0x70']
Channel 0:
@jposada202020 that is with the PR, correct? I have reverted to the pre-PR library
the same code as above runs OK on a feather M4 --
Adafruit CircuitPython 7.0.0-alpha.2-646-g7df5d74d9 on 2021-05-23; Adafruit Feather M4 Express with samd51j19
>>> import tca9548a_test
X: -0.196, Y: 0.294, Z: -0.294 mT
55.00 Lux
X: 0.098, Y: 0.294, Z: 0.0 mT
53.75 Lux
X: 0.0, Y: 0.392, Z: -0.098 mT
53.75 Lux
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "tca9548a_test.py", line 28, in <module>
KeyboardInterrupt:
>>>
Thanks @jerryneedell my bad..
>>> import testing_pt
Scan of Main I2C Channel:['0x70']
Channel 0:['0x70']
Channel 1:['0x1d', '0x70']
Channel 2:['0x70']
Channel 3:['0x70']
Channel 4:['0x23', '0x70']
Channel 5:['0x70']
Channel 6:['0x70']
Channel 7:['0x70']
so - the scans are now fine on RP2040, but it won't access the sensor -- at least not the tlv4930 ...
sometimes I get this as well on the RP2040
Adafruit CircuitPython 7.0.0-alpha.2-646-g7df5d74d9 on 2021-05-23; Adafruit Feather RP2040 with rp2040
>>> import tca9548a_test
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "tca9548a_test.py", line 21, in <module>
File "adafruit_bh1750.py", line 191, in __init__
File "adafruit_bh1750.py", line 196, in initialize
File "adafruit_bh1750.py", line 116, in __set__
File "adafruit_bh1750.py", line 205, in _settings
File "adafruit_bh1750.py", line 235, in _write
File "adafruit_tca9548a.py", line 54, in unlock
OSError: [Errno 19] Unsupported operation
>>>
Seems OK using my same setup as above.
Adafruit CircuitPython 6.2.0 on 2021-04-05; Adafruit Feather RP2040 with rp2040
>>> import board
>>> import adafruit_tca9548a
>>> import adafruit_tlv493d
>>> tca = adafruit_tca9548a.TCA9548A(board.I2C())
>>> tlv = adafruit_tlv493d.TLV493D(tca[3])
>>> tlv.magnetic
(0.294, 0.196, 0.0)
>>>
This PR addresses #31 ,
Action: To perform i2c scan on a particular channel in TCA9548A
Bug: It Performs i2c scan on actual i2c bus where TCA9548A is connected
Fix: Perform i2c scan on selected channel