skerr92 / ILI9488_CiruitPython

CircuitPython library for the ILI9488 Display
MIT License
2 stars 0 forks source link

error in def _initialize(self, init_sequence): #1

Open lfg6000 opened 12 months ago

lfg6000 commented 12 months ago

display = ili9488.ILI9488(display_bus, width=480, height=320)

Questions

it would be very very nice to get this to work so any thoughts you can send may way would be really helpful

skerr92 commented 12 months ago

The driver is based on that for the 320x240 ILI9488 display. The unit sequence was pulled from TFT_eSPI’s Arduino driver. It was tested on circuitpython 8 with the following example:

import board, busio, ili9488

spi = busio.SPI(board.D2,board.D3,board.D4)
tft_dc = board.D0
tft_cs = board.D1
display_bus = displayio.FourWire(
    spi, command=tft_dc, chip_select=tft_cs, reset=board.D5
)
display = ili9488.ILI9488(display_bus, width=320, height=240)

for larger versions, I believe a different initialization sequence would be needed but I will look into it.

lfg6000 commented 12 months ago

Questions

Which raspberry pi are you using?

Thoughts

skerr92 commented 11 months ago

I just wanted to let you know I’m working on some changes that I’ll push up maybe tonight or tomorrow. I’ll let you know so you can try it out. Thanks for helping out on this :)

skerr92 commented 11 months ago

Hey, I added another file to the repo specifically for the 320x480 displays:

https://github.com/skerr92/ILI9488_CiruitPython/blob/main/ili9488_480x320.py

Try it using a basic init and let me know how it goes.


import board, busio, ili9488_480x320

spi = busio.SPI(board.D2,board.D3,board.D4)
tft_dc = board.D0
tft_cs = board.D1
display_bus = displayio.FourWire(
    spi, command=tft_dc, chip_select=tft_cs, reset=board.D5
)
display = ili9488_480x320.ILI9488(display_bus, width=320, height=480)```
lfg6000 commented 11 months ago

Hi Seth,

first of all thanks for working on this.

took ili9488_480x320.py for a spin and it did not work for me.

i tried all 3 displays today: ili9341 320x240 and it works fine hx8357 480x320 and it works fine ili9488 480x320 and it does not work

Thanks, Louie

skerr92 commented 11 months ago

I’m still working to figure the issues out. I’m hoping to know soon though.

bablokb commented 2 months ago

When I look at your INIT_SEQUENCE, you are missing the second (length) byte. First byte is command, second byte is the argument length followed by the argument-bytes.

skerr92 commented 2 months ago

When I look at your INIT_SEQUENCE, you are missing the second (length) byte. First byte is command, second byte is the argument length followed by the argument-bytes.

Would you mind putting up a PR to fix this?

If not, I can take care of it 🙂

bablokb commented 2 months ago

I tried to change this, but it still does not work. I also tried various other ILI9488 init-sequences (from C, MicroPython, a second CircuitPython-ILI9488 driver and whatever else I found on the net), but no success so far.

skerr92 commented 2 months ago

@bablokb I saw your issue on Circuitpython and will be tracking closely the changes. I also looked over the data sheet and there is some inconsistencies with the init sequence that other drivers use compared to what the data sheet wants. I'll be pushing those changes up today in preparation for the circuitpython changes.

bablokb commented 2 months ago

I have a working version here: https://github.com/bablokb/circuitpython-examples/blob/master/waveshare-3.5/ili9488_waveshare35.py

This is for the specific Waveshare hardware, but swapping in the _INIT_SEQUENCE instead of the _INIT_SEQUENCE_16 in the constructor might also work on normal SPI-attached ILI9488 displays (with a standard 9.x.x-CircuitPython). Since I don't own the hardware, I cannot test it.

skerr92 commented 2 months ago

Thanks! I'll give it a go on the SPI display 👍🏻

jerryau commented 1 month ago

hi, did anyone manage to get this going with a 480x320 screen? I'm using CircuitPython 9, with this library, but it doesn't work for me.

import board
import displayio
import terminalio
import ili9488
from adafruit_display_text.label import Label
from adafruit_display_shapes.triangle import Triangle

displayio.release_displays()

spi = board.SPI()
tft_cs = board.D41
tft_dc = board.D40

display_bus = displayio.FourWire(
    spi, command=tft_dc, chip_select=tft_cs, reset=board.D42
)

display = ili9488.ILI9488(display_bus, width=480, height=320)

my_display_group = displayio.Group()
display.root_group = my_display_group

triangle = Triangle(170, 50, 120, 140, 210, 160, fill=0x00FF00, outline=0xFF00FF)
my_display_group.append(triangle)

my_label = Label(terminalio.FONT, text="My Label Text", color=0x00FF00)
my_display_group.append(my_label)

while True:
    pass
skerr92 commented 1 month ago

hi, did anyone manage to get this going with a 480x320 screen? I'm using CircuitPython 9, with this library, but it doesn't work for me.


import board

import displayio

import terminalio

import ili9488

from adafruit_display_text.label import Label

from adafruit_display_shapes.triangle import Triangle

displayio.release_displays()

spi = board.SPI()

tft_cs = board.D41

tft_dc = board.D40

display_bus = displayio.FourWire(

    spi, command=tft_dc, chip_select=tft_cs, reset=board.D42

)

display = ili9488.ILI9488(display_bus, width=480, height=320)

my_display_group = displayio.Group()

display.root_group = my_display_group

triangle = Triangle(170, 50, 120, 140, 210, 160, fill=0x00FF00, outline=0xFF00FF)

my_display_group.append(triangle)

my_label = Label(terminalio.FONT, text="My Label Text", color=0x00FF00)

my_display_group.append(my_label)

while True:

    pass

Hi, so I have plans to get to this hopefully this weekend. I've been running around like a chicken with its head cut off and I haven't made it back yet.

It's on the docket though.

bablokb commented 1 month ago

hi, did anyone manage to get this going with a 480x320 screen? I'm using CircuitPython 9, with this library, but it doesn't work for me.

What library exactly? Is "this library" my version I linked from above or the version here? Please also check your hardware. Is your display directly attached to SPI, or does it use serial to parallel shift ICs? In the latter case, you also need to build a special CircuitPython version to make it work.

jerryau commented 1 month ago

@bablokb I've tried the waveshare one you've linked, but had no success... also tried the ones in this repo, specifically ili9488_480x320.py, which I was hoping I could get going, but after spending hours on this couldn't get anything to show up on the screen at all -- I'm very new to all this, and have no idea what I'm doing...

The screen I have is https://www.aliexpress.com/item/32954240862.html. With the ProS3 microcontroller by Unexpected Maker. I've connected the display directly to SPI on the microcontroller.

bablokb commented 1 month ago

This seems to be a SPI connected display. When you tried my driver, did you replace _INIT_SEQUENCE_16 with _INIT_SEQUENCE?

skerr92 commented 1 month ago

I'm fairly sure most SPI Connected versions of this display won't work without the patch you made for bus core. I think that an option needs to be added to bus core to allow people to enable clocking each byte.

bablokb commented 1 month ago

I am not sure about that. Many displays just connect the MCU-SPI directly to the ILI9488 chip, so they operate in 8bit serial mode. The display linked above by @jerryau definitely does not use the 16bit parallelbus input to the ILI9488. Unless of course the images that aliexpress uses are not correct. You never know.

@jerryau : can you confirm that the back side of your display is identical to the images from your aliexpress-link?

jerryau commented 1 month ago

@bablokb , yes, the back side is exactly as pictured in the aliexpress listing

agesome commented 3 weeks ago

I have the same display as linked above on aliexpress. One interesting finding is that it does not support 16 bits/pixel. In practice for me it refuses to initialize when 0x3a = 0x05 (16-bit). Is alive when 0x3a = 0x01 / 0x06 (3-bit / 18-bit).

I am getting some image from it, however pixel format is wrong. In 18-bit mode, using color_depth=24 fills display black, and using color_depth=16 there is text visible but clear that rows are not filled due to display expecting 3 bytes and us sending only 2. For now I am not sure what to do since displayio.Display does not expose much controls.

Basic working example:

class ILI9488(displayio.Display):
    _INIT_SEQUENCE = (
        b"\x3A\x01\x01" # pixel format
        b"\x36\x01\x28" # rotation
        b"\x11\x80\x78" # exit sleep
        b"\x29\x80\x78" # display on
    )

    def __init__(self, bus: displayio.FourWire, **kwargs):
        super().__init__(bus, self._INIT_SEQUENCE, **kwargs)

displayio.release_displays()
display_spi = busio.SPI(board.GP2, board.GP3, board.GP4)
bus = fourwire.FourWire(display_spi, command=board.GP6, chip_select=board.GP5, reset=board.GP7)
display = ILI9488(bus, width=480, height=320, rotation=180, color_depth=8)

display.root_group = displayio.CIRCUITPYTHON_TERMINAL
skerr92 commented 3 weeks ago

So the issue comes down to circuitpython not supporting RGB666. If your display was using parallel input, you wouldn't have issues. I'm working on bringing RGB666 support to circuitpython but the timeline on that is unclear. Maybe the next month or two based on how much time I can put into it.

bablokb commented 3 weeks ago

If you have something to test, please let me know. There are other display chips that support RGB666, so testing it would be possible even without that specific display.