Skip to content

Cannot create SPI instance on ESP32 S3 #211

@MussabMehboob

Description

@MussabMehboob

I am using an ESP32 S3 with PSRAM 8 MB and flash 16 MB. I want to test the LVGL on ST 7789(240*240) but I am seeing this error when I am creating an SPI instance in thonny.

from machine import SPI, Pin
from micropython import const

import lcd_bus
import st7789
import lvgl


_WIDTH = const(240)
_HEIGHT = const(240)


_SPI_HOST = const(2)
_SPI_SCK = const(10)
_SPI_MOSI = const(11)
_SPI_MISO = const(12)

_LCD_FREQ = const(400_000)
_LCD_DC = const(8)
_LCD_CS = const(9)
_LCD_RST = const(14)
_LCD_BACKLIGHT = const(2)


spi_bus = SPI(
    _SPI_HOST,
    _LCD_FREQ,
    mosi=_SPI_MOSI,
    miso=_SPI_MISO,
    sck=_SPI_SCK,
    cs=_LCD_CS
)

display_bus = lcd_bus.SPIBus(
    spi_bus=spi_bus,
    freq=_LCD_FREQ,
    dc=_LCD_DC,
    cs=_LCD_CS
)

    
display = st7789.ST7789(
    data_bus=display_bus,
    display_width=_WIDTH,
    display_height=_HEIGHT,
    backlight_pin=_BL,
    color_space=lv.COLOR_FORMAT.RGB565,
    color_byte_order=st7796.BYTE_ORDER_RGB,
    rgb565_byte_swap=True,
)
MPY: soft reboot
Traceback (most recent call last):
  File "boot.py", line 30, in <module>
TypeError: can't create 'SPI' instances
Traceback (most recent call last):
  File "<stdin>", line 30, in <module>
TypeError: can't create 'SPI' instances

I am building with this command:

python3 make.py esp32 BOARD=ESP32_GENERIC_S3 BOARD_VARIANT=SPIRAM_OCT DISPLAY=st7789 INDEV=gt911 --flash-size=16

I even tried using SoftSPI that worked with the compilation but I started getting memory initialization errors.I have tried to resolve those issues as said in the issue#66(#66) but it didn't worked for me.
Thank you!

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