circuitpython: I2C error after soft reboot on nRF52840

I get the following error accessing an I2C device (VCNL4040) after a soft reboot. It works normally after a hard reboot, but fails after a soft reboot (control-D)

This occurs with CP4.1.0 and CP 5.0 (current master)

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

Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 4.1.0 on 2019-08-03; SparkFun Pro nRF52840 Mini with nRF52840
>>> import vcnl4040_simpletest
Proximity: 1
Light: 824
White: 2359
Proximity: 1
Light: 825
White: 2372
Proximity: 1
Light: 830
White: 2385
Proximity: 1
Light: 827
White: 2398
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "vcnl4040_simpletest.py", line 13, in <module>
KeyboardInterrupt: 
>>> 
soft reboot

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



Press any key to enter the REPL. Use CTRL-D to reload.
Adafruit CircuitPython 4.1.0 on 2019-08-03; SparkFun Pro nRF52840 Mini with nRF52840
>>> import vcnl4040_simpletest
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "vcnl4040_simpletest.py", line 7, in <module>
  File "adafruit_vcnl4040.py", line 277, in __init__
  File "adafruit_register/i2c_struct.py", line 86, in __get__
  File "adafruit_register/i2c_struct.py", line 86, in __get__
  File "adafruit_bus_device/i2c_device.py", line 154, in write_then_readinto
  File "adafruit_bus_device/i2c_device.py", line 96, in readinto
OSError: [Errno 19] Unsupported operation
>>> 

test code

import time
import board
import busio
import adafruit_vcnl4040

i2c = busio.I2C(board.SCL, board.SDA)
sensor = adafruit_vcnl4040.VCNL4040(i2c)

while True:
    print("Proximity:", sensor.proximity)
    print("Light:", sensor.light)
    print("White:", sensor.white)
    time.sleep(0.3)

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 21 (2 by maintainers)

Most upvoted comments

No, I didn’t, sorry, doing multiple things at once 😃