Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i2c is not unlocked with soft reset on 6.2.0 #4786

Closed
kevinjwalters opened this issue May 20, 2021 · 5 comments · Fixed by #4801
Closed

i2c is not unlocked with soft reset on 6.2.0 #4786

kevinjwalters opened this issue May 20, 2021 · 5 comments · Fixed by #4801
Milestone

Comments

@kevinjwalters
Copy link

On 6.2.0 on a Feather nRF52840 Express using the singleton from board.I2C():

Press any key to enter the REPL. Use CTRL-D to reload.

Adafruit CircuitPython 6.2.0 on 2021-04-05; Adafruit Feather nRF52840 Express with nRF52840
>>> import board
>>> i2c = board.I2C()
>>> i2c.try_lock()
True
>>> ["{:2x}".format(x) for x in i2c.scan()]
[' 8', '23', '76']
>>> ["{:02x}".format(x) for x in i2c.scan()]
['23', '76']
>>> ["{:02x}".format(x) for x in i2c.scan()]
['23', '76']
>>>  ### Control-D here then Control-C after that to interrupt
soft reboot

Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.

code.py output:
Traceback (most recent call last):
  File "code.py", line 40, in <module>
  File "/lib/pimoroni_pms5003/__init__.py", line 167, in <module>
  File "/lib/pimoroni_pms5003/__init__.py", line 189, in PMS5003
KeyboardInterrupt:

Code done running.

Press any key to enter the REPL. Use CTRL-D to reload.

Adafruit CircuitPython 6.2.0 on 2021-04-05; Adafruit Feather nRF52840 Express with nRF52840
>>> import board
>>> i2c = board.I2C()
>>> i2c.try_lock()
False
>>> i2c.try_lock()
False
>>> i2c.try_lock()
False
>>> i2c.unlock()
>>> i2c.try_lock()
True
>>> ["{:02x}".format(x) for x in i2c.scan()]
['23', '76']
>>> i2c.unlock()

Similar theme to #3266

@dhalbert dhalbert added this to the 7.0.0 milestone May 20, 2021
@dhalbert
Copy link
Collaborator

TThanks! This is a very old bug. It has been true since 5.0.0, probably ever since we started supporting I2C displays. shared-module/busio/__init__.c needs to unlock the board.I2C() object, as it already does to to the board.SPI() object.

@kevinjwalters
Copy link
Author

Did I dupe an existing issue? I had a quick look and couldn't find anything obvious.

@dhalbert
Copy link
Collaborator

Did I dupe an existing issue? I had a quick look and couldn't find anything obvious.

No, I just mean it has lain undiscovered for quite a while.

@kevinjwalters
Copy link
Author

Unrelated to the issue here, there's a strange address 0x08 (device?) in there which appears on first query and not afterwards. I've got it attached to a Pimoroni Enviro+ FeatherWing which has an LTR-559 (0x23) and BME280 (0x76) and nothing else AFAIK...

@tannewt tannewt added the busio label May 20, 2021
@dhalbert
Copy link
Collaborator

Unrelated to the issue here, there's a strange address 0x08 (device?) in there which appears on first query and not afterwards. I've got it attached to a Pimoroni Enviro+ FeatherWing which has an LTR-559 (0x23) and BME280 (0x76) and nothing else AFAIK...

Bring this up in another issue if you think it's a CircuitPython issue. But it might be some I2C device issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants