Skip to content

SPI lock not aquired #171

Open
Open
@IanBurwell

Description

@IanBurwell

Problem

adafruit_esp32spi.py throws the below RuntimeError

Traceback (most recent call last):
  File "code.py", line 21, in <module>
  File "helpers.py", line 120, in handle_weather
  File "helpers.py", line 113, in get_weather
  File "helpers.py", line 73, in safe_requests_get
  File "adafruit_requests.py", line 818, in get
  File "adafruit_requests.py", line 664, in request
  File "adafruit_requests.py", line 532, in _get_socket
  File "adafruit_esp32spi/adafruit_esp32spi_socket.py", line 75, in connect
  File "adafruit_esp32spi/adafruit_esp32spi.py", line 806, in socket_connect
  File "adafruit_esp32spi/adafruit_esp32spi.py", line 708, in socket_open
  File "adafruit_esp32spi/adafruit_esp32spi.py", line 332, in _send_command_get_response
  File "adafruit_esp32spi/adafruit_esp32spi.py", line 315, in _wait_response_cmd
  File "adafruit_esp32spi/adafruit_esp32spi.py", line 282, in _check_data
  File "adafruit_esp32spi/adafruit_esp32spi.py", line 256, in _read_byte
RuntimeError: Function requires lock

How to reproduce

  1. Play a sound file from an sd card (via SPI) with audioio.AudioOut
  2. Without waiting for it to finish, use adafruit_requests (which uses adafruit_esp32spi/adafruit_esp32spi_socket)

Inspecting the error, I would guess that _read_byte should be acquiring a lock on the SPI bus, which is being used to play audio (with DMA if I had to guess).

Hardware Config

Adafruit CircuitPython 7.3.1 on 2022-06-22; Adafruit PyPortal Titano with samd51j20
Board ID:pyportal_titano

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions