MicroPython on the Elecrow 2.13"

I have a problem, using the Elecrow 2.13" e-ink display with MicroPython.
According to some digging, the SSD1680 chipset is not officially supported by MicroPython on ESP32-S3. Adafruit's CircuitPython has a driver. However, I can't get it to work - the screen is blank and it doesn't even flicker when initializing.
CircuitPython have this example, but it throws a runtime error, stating that SPI() is not a part of the board-module - and yes, it is used by the busio-module instead.

The example can be seen here: docs.circuitpython.org/projects/ssd1680/en/stable/examples.html (this forum fails when inserting links, so please copy-paste)

I made some modifications to the code, which can be seen here:

    import adafruit_ssd1680
    import board
    import busio
    import displayio
    import time

    # Always release displays first
    displayio.release_displays()

    # --- SPI setup ---
    #spi = busio.SPI(clock=board.SCK, MOSI=board.MOSI, MISO=board.MISO)
    #spi = busio.SPI(board.EPD_CLK, MOSI=board.TF_MOSI, MISO=board.TF_MISO)
    #spi = busio.SPI(board.EPD_CLK, board.EPD_MOSI)
    spi = busio.SPI(clock=board.TF_CLK, MISO=board.TF_MISO, MOSI=board.TF_MOSI) # Unsure if TF- or EDB prefix should be used

    # Control pins (adjust these to your wiring!)
    epd_cs = board.EPD_CS       # Chip select
    epd_dc = board.EPD_DC       # Data/command
    epd_reset = board.EPD_RES    # Reset
    epd_busy = board.EPD_BUSY    # Busy

    # --- FourWire bus for the display ---
    display_bus = displayio.FourWire(
        spi,
        command=epd_dc,
        chip_select=epd_cs,
        reset=epd_reset,
        baudrate=4000000,   # 4 MHz is safe for eInk
    )

    # --- Display setup ---
    display = adafruit_ssd1680.SSD1680(
        display_bus,
        width=250,   # check your panel resolution
        height=122,
        busy_pin=epd_busy,
        rotation=270,
    )
    time.sleep(1)

    g = displayio.Group()
    # Note: Check the name of the file. Sometimes the dash is changed to an underscore

    # Yes, this image exists:
    pic = displayio.OnDiskBitmap("/apps/ec8d838607528268a4e435628ea9f709/250x122_test.bmp")
    t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
    g.append(t)
    display.root_group = g
    display.refresh()
    print("refreshed")
    time.sleep(display.time_to_refresh + 5)
    print("waited correct time")

    # Keep the display the same
    while True:
        time.sleep(10)

I suspect, the pins are not correctly set. Anyone...?

It works in Arduino. These are the pins, defined in spi.h (part of the example, provided by Elecrow). However, **busio **in CircuitPython doesn't take pin definitions as integers, but objects of class "pin":

#define SCK 12
#define MOSI 11
#define RES 10
#define DC 13
#define CS 14
#define BUSY 9

Why not just use Arduino, then? Because I need the flexibility that Python offers when executing scripts.

Tagged:
Sign In or Register to comment.