Skip to content

board.SCK in use error on second run #10818

@grgrant

Description

@grgrant

CircuitPython version and board name

Adafruit CircuitPython 10.0.3 on 2025-10-17; Adafruit Feather ESP32S3 4MB Flash 2MB PSRAM with ESP32S3

Code/REPL

import board
import busio
import displayio
import fourwire
import time
import alarm


SLEEP=20

time.sleep(10) # Allow me time connect after reset via USB Serial
print("Initing SPI")
spi = busio.SPI(board.SCK, board.MOSI)  # Uses SCK and MOSI
print("Done initing SPI")

epd_cs = board.D9
epd_dc = board.D10
epd_reset = board.D12
epd_busy = board.D11

display_bus = fourwire.FourWire(spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000)

time.sleep(1) # In case things need to settle before deep sleep
displayio.release_displays()  # Without this line the issue doesn't happen
time_alarm = alarm.time.TimeAlarm(monotonic_time=time.monotonic() + SLEEP)
alarm.exit_and_deep_sleep_until_alarms(time_alarm)

Behavior

Output after a microcontroller reset and the second error is after waking up from simulated deep sleep:

Initing SPI
Done initing SPI

Code done running.
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.
Pretending to deep sleep until alarm, CTRL-C or file write.
Woken up by alarm.

Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Initing SPI
Traceback (most recent call last):
  File "code.py", line 13, in <module>
ValueError: SCK in use

Code done running.

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

Adafruit CircuitPython 10.0.3 on 2025-10-17; Adafruit Feather ESP32S3 4MB Flash 2MB PSRAM with ESP32S3

Same output when typing control D rather than waiting for a deep sleep timeout

Initing SPI
Done initing SPI

Code done running.
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.
Pretending to deep sleep until alarm, CTRL-C or file write.
[^D pressed here]
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
Initing SPI
Traceback (most recent call last):
  File "code.py", line 13, in <module>
ValueError: SCK in use

Code done running.

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

Description

  • First noticed in REPL connected via USB to ESP32-S2/Eink Feather Friend./3rd party BWR display.
  • Now replicated by above code on brand new Feather ESP32-S3 with nothing but USB REPL attached and fresh Circuit Python 10.0.3.
  • Traced to the displayio.release_displays() done in the previous iteration. When commented out this problem does not happen
  • I'm releasing displays so the previously painted info stays on the screen rather than showing the console when I'm in REPL
  • At the end of deep sleep when the code starts over the SCK in use error happens
  • The error also happens if I do a control-c control-d to execute before deep sleep is done
  • This is simulated deep sleep because of connected USB but I have reason to believe from some unexpected resetting that it may be happening after a real deep sleep.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions