ESP32-S3 + ST7796s #172
Lenergy1982-droid
started this conversation in
General
Replies: 1 comment 3 replies
-
because you are using a wired connection to the display you might want to try lowering the SPI frequency down to 20mhz and see if that solves the issue. You also want to use the hardware SPI pins for a given host. host 0 (SPI1) is reserved for SPIRAM and flash and host 1 (SPI2) has hardware pins defined for it. host 2 (SPI3) uses the GPIO matrix and can have any pins assigned.
connect the pins from the display to these pins on the ESP32-S3 from machine import SPI, Pin
import sys
import lcd_bus
import st7796
import lvgl as lv
from micropython import const
lv.init()
spi_bus = SPI.Bus(host = 1, mosi=11, miso=13, sck=12)
display_bus = lcd_bus.SPIBus(
spi_bus=spi_bus,
dc=4,
cs=10,
freq=20000000 # increase this onmce you have it up and running
)
display = st7796.ST7796(
data_bus=display_bus,
display_width=480,
display_height=320,
#backlight_pin=_BL,
reset_pin=5,
power_pin=3,
reset_state=st7796.STATE_LOW,
color_space=lv.COLOR_FORMAT.RGB565,
color_byte_order=st7796.BYTE_ORDER_BGR,
rgb565_byte_swap=True
)
display.set_power(True)
display.init()
scrn = lv.screen_active()
scrn.set_style_bg_color(lv.color_hex(0x000000), 0)
slider = lv.slider(scrn)
slider.set_size(300, 50)
slider.center()
label = lv.label(scrn)
label.set_text('HELLO WORLD!')
label.align(lv.ALIGN.CENTER, 0, -50)
import task_handler
task_handler.TaskHandler() # this is what updated the frame buffer. Without this it's not going to display anything. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello!

Is it possible to use a ST7796s display in this project?
Trying to do ESP32-S3 with PSRAM + ST7796s, but the best I achieved is this RGB pattern on the display:
Here is the complete code:
"DISPLAY = ST7796" was added to the build string.
What I have tried:
host = 2 in spi_bus = SPI.Bus()
color_byte_order=st7796.BYTE_ORDER_RGB,
rgb565_byte_swap=False
Changing pins to which display is attached.
Please, help! How to make this setup work? Can ST7796S and ST7796 use the same driver?
Beta Was this translation helpful? Give feedback.
All reactions