OSError: SPI device already in use
Posted: Wed Jun 26, 2019 11:22 am
I am aware that this is an issue that (as far as i can tell) has been fixed in a newer MicroPython version, but my problem still exists because i am using uPyCraft V1.0 and it shows up a lot when i try to run my test code.
This is the error im getting:
This is the code im trying to run: (Dont ask me what the hell it is, i did this half a year ago and probably just assembled some things i found online, as i do not have much knowledge in MicroPython and ESP32)
Help is very appreciated, i know i didnt give much info but its so insanely hard to get started with this topic because of the lack of documentation i could find regarding uPyCraft and micropython...
Thanks in advance!
This is the error im getting:
Code: Select all
download ok
exec(open('./boot.py').read(),globals())
[0;31mE (477191) spi_master: spi_bus_initialize(108): host already in use[0m
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<string>", line 25, in <module>
OSError: SPI device already in use
Code: Select all
import gc
gc.collect()
import framebuf
gc.collect()
from machine import Pin, SPI
gc.collect()
import driver
gc.collect()
# SPIV on ESP32
sck = Pin(18)
miso = Pin(19)
mosi = Pin(23)
dc = Pin(17)
cs = Pin(5)
rst = Pin(16)
busy = Pin(4)
spi = SPI(2, baudrate=20000000, polarity=0, phase=0, sck=sck, miso=miso, mosi=mosi)
e = driver.EPD(spi, cs, dc, rst, busy)
e.init()
w = 320
h = 192
x = 0
y = 0
# --------------------
# use a frame buffer
# 400 * 300 / 8 = 15000 - thats a lot of pixels
gc.collect()
buf = bytearray(w * h // 8)
fb = framebuf.FrameBuffer(buf, w, h, framebuf.MONO_HLSB)
black = 0
white = 1
fb.fill(white)
# --------------------
Thanks in advance!