8-bit parallel TFT driver for micropython ?

Discuss development of drivers for external hardware and components, such as LCD screens, sensors, motor drivers, etc.
Target audience: Users and developers of drivers.
Hugh-maingauche
Posts: 15
Joined: Sun Aug 15, 2021 9:34 pm

Re: 8-bit parallel TFT driver for micropython ?

Post by Hugh-maingauche » Tue Sep 07, 2021 7:57 pm

Hello,

I finally succeeded in implementing a "fillscreen" method. The difference when using the mem32 or viper code is just huge:

using mem32, the screen is filled in 34s ( :shock: )

using a bit of viper code : 63 ms ( :D ) -> almost instantly for human eye

here is my piece of viper code :

Code: Select all

@micropython.viper
def balayage(h:int,end:int,w:int,D_mask:int,hi_value:int,lo_value:int,WR_value:int):
    GPIO_OUT_TC = ptr32(GPIO_OUT_W1TC_REG) # GPIO Output W1TC register
    GPIO_OUT_TS = ptr32(GPIO_OUT_W1TS_REG) # GPIO Output W1TS register
    while (h>0):
        end = w
        while(end!=0):
            GPIO_OUT_TC[0] = D_mask         #pin mask -> data pins set to 1
            GPIO_OUT_TS[0] = hi_value       #color hi bits sent to data pins
            GPIO_OUT_TC[0] = WR_value       #WR pin mask
            GPIO_OUT_TS[0] = 0              #WR pin strobe (off)
            GPIO_OUT_TC[0] = WR_value       #WR pin mask
            GPIO_OUT_TS[0] = WR_value       #WR pin strobe (on)
            GPIO_OUT_TC[0] = D_mask         #pin mask -> data pins set to 1
            GPIO_OUT_TS[0] = lo_value       #color lo bits sent to data pins
            GPIO_OUT_TC[0] = WR_value       #WR pin mask
            GPIO_OUT_TS[0] = 0              #WR pin strobe (on)
            GPIO_OUT_TC[0] = WR_value       #WR pin mask
            GPIO_OUT_TS[0] = WR_value       #WR pin strobe (off)
            end-=1
        h-=1
Thank you Robert for all the pieces of code you posted on this forum, it helped me a lot !

Hugh-maingauche
Posts: 15
Joined: Sun Aug 15, 2021 9:34 pm

Re: 8-bit parallel TFT driver for micropython ?

Post by Hugh-maingauche » Sun Sep 12, 2021 12:49 pm

Well, viper is really fast !

in the video posted here, you'll see a speed test of graphics drawing and screen filling.

corresponding results on the video are:

Code: Select all

Figures Drawn in  488  ms
Faded blue screen in  103  ms
Faded green screen in  104  ms
Faded red screen in  99  ms 
and this is still not fully optimized, since i'm calling non-viper functions in the process.
Last edited by Hugh-maingauche on Sun Sep 26, 2021 10:45 pm, edited 1 time in total.

Hugh-maingauche
Posts: 15
Joined: Sun Aug 15, 2021 9:34 pm

Re: 8-bit parallel TFT driver for micropython ?

Post by Hugh-maingauche » Sun Sep 26, 2021 10:40 pm

I'm answering myself here just to let you know that I finished the job.

I implemented all the major features including the touch capability and a few fonts.

See the calibration procedure in the video here. I lost quite a few hours before I realized that with micropython on ESP32 you only have 2 pins that have ADC AND can bet set as outputs (Pins 32 and 33). You have to use both ADC and output for RS and CS pins if you want to have LCD gaphics and Touch.

I guess my developpement is only limited for those who need to use micropython on an ESP32 with this very specific 8-bit parallel ILI9341 driver Touchscreen... but if you are in this situation, the code is here.

I learned quite a few things in the process ! :D

Hugh

Jackli
Posts: 80
Joined: Thu Apr 29, 2021 9:11 am

Re: 8-bit parallel TFT driver for micropython ?

Post by Jackli » Tue Oct 12, 2021 7:17 am

Although I don't know if you have found a screen that works for you, I have done some projects using a serial screen with ESP32 and using the micropython language. If you are interested you can take a look at it.

viewtopic.php?f=5&t=11026

Hugh-maingauche
Posts: 15
Joined: Sun Aug 15, 2021 9:34 pm

Re: 8-bit parallel TFT driver for micropython ?

Post by Hugh-maingauche » Sat Oct 16, 2021 9:27 pm

Thank you Jackli, but I finally made it with my "parralel only" TFT screen, I even succeded in having the touchscreen to work.

Have a nice day !

Hugh

leonllr
Posts: 2
Joined: Mon Dec 27, 2021 8:06 am

8-bit parallel TFT driver for micropython

Post by leonllr » Mon Dec 27, 2021 8:08 am

Hey, I need a driver for the same screen did you finished it ?

Hugh-maingauche
Posts: 15
Joined: Sun Aug 15, 2021 9:34 pm

Re: 8-bit parallel TFT driver for micropython ?

Post by Hugh-maingauche » Mon Dec 27, 2021 10:47 pm

I posted this library on Github, for ESP32 and RPI microcontrollers.

You'll find also a dedicated help in the Github Readme page.

https://github.com/HughMaingauche/ILI93 ... icropython

I hope it can be usefull for you

Hugh-maingauche
Posts: 15
Joined: Sun Aug 15, 2021 9:34 pm

Re: 8-bit parallel TFT driver for micropython ?

Post by Hugh-maingauche » Mon Jan 03, 2022 4:31 pm

New version using assembly code with the asm_pio decorator.

Replaced 3 micropython_viper functions by pio statemachines. A bit of improvement in terms of speed (mostly for the fillscreen and fillrect methods) but nothing spectacular. Use of the assembly code does not allow complex operations for drawing purposes.

Scaron
Posts: 2
Joined: Sun Mar 27, 2022 11:20 am

Re: 8-bit parallel TFT driver for micropython ?

Post by Scaron » Sun Mar 27, 2022 11:38 am

Hello Hugh,
first of all thanks for sharing you work. As a micropython beginner I can only imagine the amount of time spent into this. I really like that your Github code works out of the Box and the LCD operations being understandable. I hooked up a Pico and the TFT display and eveything works fine. However I am planning to use an other Display wich should be similar in manny aspects. Unfortunatly just appying your library doest simply fit and my knoledge on Communication protocols is to limitated. Could you point me in some direction how I can still make this work ?

The Display would be this one https://www.electrodragon.com/product/3 ... -parallel/

Hugh-maingauche
Posts: 15
Joined: Sun Aug 15, 2021 9:34 pm

Re: 8-bit parallel TFT driver for micropython ?

Post by Hugh-maingauche » Mon Mar 28, 2022 9:13 pm

Hello scaron,

I see that your device is using an ILI9486 driver, the driver i coded only works with IL9341.

In order for you to adapt my library to your device, I suggest you to start with the library writen in c here, just as I did, and see what are the commands specific to this driver. You can also try to find any working driver written in c, see if you can have it to work with you device, and then narrow down the c code to the specific 8bits command related to this driver.

Hugh

Post Reply