#AttributeError: 'function' object has no attribute 'try_lock'

1 messages · Page 1 of 1 (latest)

young star
#

hello CP-community,
i encountered a error i have no idea how to fix / where it belongs to:

main.py output:
check_spi_lock.py
Traceback (most recent call last):
  File "main.py", line 12, in <module>
AttributeError: 'function' object has no attribute 'try_lock'

the code i found is enough to trigger this:

import board
import adafruit_bus_device.spi_device as spidev
import digitalio

print("check_spi_lock.py")
cs = digitalio.DigitalInOut(board.D10)

spi = spidev.SPIDevice(board.SPI, cs, baudrate=200000, polarity=0, phase=0)

bytes_read = bytearray(4)

with spi as device:
    device.readinto(bytes_read)

as fare as i understand this code should work.
(reference: https://docs.circuitpython.org/en/latest/shared-bindings/adafruit_bus_device/spi_device/index.html#module-adafruit_bus_device.spi_device)

board:
Adafruit Feather ESP32-S3 Reverse TFT with ESP32S

CP versions tried:

  • Adafruit CircuitPython 9.2.0-beta.0 on 2024-09-17
  • Adafruit CircuitPython 9.1.4 on 2024-09-17

any idea what is causing this?
has it to do something with https://github.com/adafruit/Adafruit_CircuitPython_DotStar/pull/65 (and the related ones)

GitHub

See adafruit/circuitpython#9586. As of adafruit/circuitpython#9164, on Espressif, SPI.deinit() waits for the SPI lock to be unlocked before doing the deinit. This causes DotStar.deinit() to hang. T...

storm pivot
#

board.SPI is a function, you have to call it, like board.SPI() for the spi object

young star
#

hmpf

#

ok yeah that makes sens then..
i just did forgett thsi 😦

#

i was mislead by the fact that it seems like a CONSTANT....