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

SPI lock not aquired #171

Open
IanBurwell opened this issue Jul 19, 2022 · 0 comments
Open

SPI lock not aquired #171

IanBurwell opened this issue Jul 19, 2022 · 0 comments

Comments

@IanBurwell
Copy link

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant