adafruit / Adafruit_CircuitPython_ST7735R

ST7735R TFT LCD display driver
MIT License
17 stars 11 forks source link

Any way to disable junk/garbage on screen during initialization #34

Open u8915055 opened 8 months ago

u8915055 commented 8 months ago

Hello,

I am using a ST7755S based 1.7" display (160x128). When i go to setup the SPI bus in circuitpython and then initialize this ST7735R driver, the screen usually displays garbage, then wipes clean the display, and then carries on. Is there anyway to blank the display before the garbage display? My display does not have a separate LED pin so i cant use PWM dim the display so the garbage is not seen.

I looked at the initi sequence of commands for this driver and i wonder if there is any modification there like using the command 28h DISP_OFF to turn off the display before any of the other init commands are run? it would just be nice to start up my device to a black screen and then my program begins.

Unless someone knows a way to dim the screen with no dedicated LED pin.

here are the commands i am using to initialize the display:

display_bus = displayio.FourWire(tft_spi, command=tft_dc, chip_select=tft_cs, reset=tft_reset, baudrate=50000000)
display = ST7735R(display_bus, width=160, height=128, rotation=90, bgr=True)
group = displayio.Group()

Thanks all

u8915055 commented 8 months ago

So i got it a little better. I took the ST7735S init string out of the adafruit_Circuitpython_RGB_display module and added it to this ST7735R config. Its slightly different. this is what it looks like:

_INIT_SEQUENCE_2 = bytearray(
    b"\xb1\x03\x01\x2c\x2d" # _FRMCTR1
    b"\xb2\x03\x01\x2c\x2d" # _FRMCTR2
    b"\xb3\x06\x01\x2c\x2d\x01\x2c\x2d" # _FRMCTR3
    b"\xb4\x01\x07" # _INVCTR line inversion
    b"\xc0\x03\xa2\x02\x84" # _PWCTR1 GVDD = 4.7V, 1.0uA
    b"\xc1\x01\xc5" # _PWCTR2 VGH=14.7V, VGL=-7.35V
    b"\xc2\x02\x0a\x00" # _PWCTR3 Opamp current small, Boost frequency
    b"\xc3\x02\x8a\x2a"
    b"\xc4\x02\x8a\xee"
    b"\xc5\x01\x0e" # _VMCTR1 VCOMH = 4V, VOML = -1.1V
    b"\xe0\x10\x0f\x1a\x0f\x18\x2f\x28\x20\x22\x1f\x1b\x23\x37\x00\x07\x02\x10"
    b"\xe1\x10\x0f\x1b\x0f\x17\x33\x2c\x29\x2e\x30\x30\x39\x3f\x00\x07\x03\x10"
    b"\x3a\x01\x05" # COLMOD - 16bit color
    b"\x36\x01\x60"  # _MADCTL bottom to top refresh # set scan direction: up to down, right to left
    b"\x11\x00"
    b"\x29\x00"
)

I can tell there is still garbage displayed during the screen reset but since most of the delays are taken out, you hardly see it. Im still hoping there is a way to completely remove the garbage so the screen is essentially black, and then shows my first graphic - nice and clean. I am going to keep trying options here but im hoping someone knows how to fix it.

makermelissa commented 8 months ago

The garbage displayed is the random bits in display memory when it's initialized. Like you mentioned, you could try using the DISP OFF and ON init commands (ST7735_DISPOFF = 0x28, ST7735_DISPON = 0x29). If that doesn't work, then I don't think there's much more that can be done without a separate backlight pin.

u8915055 commented 8 months ago

Hi there, thank you for taking the time to respond to my question. I really appreciate it. I have since ordered a bunch of new displays, many with LED pins, to see what i can come up with. Im looking to create a product so having the garbage display at the beginning doesnt look great. I found that the DISP_OFF command doesnt really seem to do much. Or, there is some other command in the INIT that overrides it.

I did experiment with even further reducing the INIT sequence. Im guessing that many of them are the defaults so i was able to get the INIT sequence down to this:

    b"\x3a\x01\x05" # COLMOD - 16bit color
    b"\x11\x00" # SLPOUT
    b"\x29\x00" # _DISPON

With this, the display initializes properly and by removing commands from the INIT within this driver, i figure im speeding things up. I almost cannot see the garbage now when the init sequence runs.

Still goign to keep tweaking things but its definitely better.