Fixing lag on a ST7789

EL Wire/Tape/Panels, LEDs, pixels and strips, LCDs and TFTs, etc products from Adafruit

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
Minefield47
 
Posts: 10
Joined: Tue Sep 21, 2021 11:21 am

Fixing lag on a ST7789

Post by Minefield47 »

Hi,
I am currently running the ST7789 with a raspberry pi and I currently have an issue where the LCD screen loads the image I am drawing on the screen with a lag of loading across the screen (with each column of pixels being loaded across the screen as it displays them, creating a wave effect). However, for the project I am working on I need it to display the image either all at once or with almost no lag. Is there a fix for this or am I going to have to look at other options to solve this issue?

Thank you!

User avatar
mikeysklar
 
Posts: 13824
Joined: Mon Aug 01, 2016 8:10 pm

Re: Fixing lag on a ST7789

Post by mikeysklar »

@Minefield47,

Which specific make/model of ST7789 display are you using?

User avatar
Minefield47
 
Posts: 10
Joined: Tue Sep 21, 2021 11:21 am

Re: Fixing lag on a ST7789

Post by Minefield47 »

mikeysklar wrote:@Minefield47,

Which specific make/model of ST7789 display are you using?
Adafruit 1.54" 240x240 Wide Angle TFT LCD Display with MicroSD
https://www.adafruit.com/product/3787

User avatar
mikeysklar
 
Posts: 13824
Joined: Mon Aug 01, 2016 8:10 pm

Re: Fixing lag on a ST7789

Post by mikeysklar »

@Minefield47,

There is a non-addafruit github repo for the Pi that claims 60fps for ST7789 displays.

https://www.youtube.com/watch?v=KciKqGX8g94
https://github.com/juj/fbcp-ili9341

User avatar
Minefield47
 
Posts: 10
Joined: Tue Sep 21, 2021 11:21 am

Re: Fixing lag on a ST7789

Post by Minefield47 »

Thank you so much for the help! I have been working on this on and off since and I got the video you provided me to work at a much better framerate with the 1.5" LCD screen being treated as the main screen. However, I still need some form of program that can create rectangles/boxes on the screen that I can randomize the position of. With the new code running, the previous working libraries now crash and I am unable to run them. I have been searching around the internet for solutions and I haven't been able to find any. I either need to up the framerate on the previous adafruit libraries, or a new program that allows me to create the same effect on the new framebuffer.

Thanks!

User avatar
mikeysklar
 
Posts: 13824
Joined: Mon Aug 01, 2016 8:10 pm

Re: Fixing lag on a ST7789

Post by mikeysklar »

I can see this being the incompatibility being a downside with the non-adafruit fbcp lib.

Can you post some of the errors you are seeing? Maybe they can be resolved to some degree.

User avatar
Minefield47
 
Posts: 10
Joined: Tue Sep 21, 2021 11:21 am

Re: Fixing lag on a ST7789

Post by Minefield47 »

If I could I would but I am not getting any errors. I attempt to run the code using adafruit lib and the entire screen freezes and I cannot move my cursor. I have waited ten minutes plus and the screen is completely frozen.

User avatar
mikeysklar
 
Posts: 13824
Joined: Mon Aug 01, 2016 8:10 pm

Re: Fixing lag on a ST7789

Post by mikeysklar »

If it makes sense to drill down I would sprinkle in Serial.print() statements and try to find the first function or specific line of code where the hang occurs.

User avatar
55jr55
 
Posts: 4
Joined: Sun Nov 21, 2021 1:03 pm

Re: Fixing lag on a ST7789

Post by 55jr55 »

When you call the constructor for the 7789, what value are you using for spi_speed_hz? I use spi_speed_hz=160000000. I can create the effect you're describing by using a much lower value.

User avatar
Minefield47
 
Posts: 10
Joined: Tue Sep 21, 2021 11:21 am

Re: Fixing lag on a ST7789

Post by Minefield47 »

55jr55 wrote:When you call the constructor for the 7789, what value are you using for spi_speed_hz? I use spi_speed_hz=160000000. I can create the effect you're describing by using a much lower value.

Sorry for the long reply due to Thanksgiving break. I am not too familiar with this kind of project and am not sure where to locate the constructor for the 7789. I looked through the files and I do not see this in the main python code, I thought maybe it was in the boot/config.txt but I am not seeing it there either. I was thinking it might be in the libraries folder but the files are in .mpy and I cannot find a software on my pi that allows me to open micropython files.

User avatar
Minefield47
 
Posts: 10
Joined: Tue Sep 21, 2021 11:21 am

Re: Fixing lag on a ST7789

Post by Minefield47 »

mikeysklar wrote:If it makes sense to drill down I would sprinkle in Serial.print() statements and try to find the first function or specific line of code where the hang occurs.
I was thinking about it over break and remembered that the wiring for the framebuffer and adafruit are different. My only hesitation as to why this would not be the problem is that I turned the framebuffer off and ran the code from my monitor (the framebuffer forces the only display to be the SPI as I have a resolution of 240x240) and no errors occurred. I attached the Pinouts for the two below.
Framebuffer.png
Framebuffer.png (150.43 KiB) Viewed 774 times
AdafruitPINOUT.png
AdafruitPINOUT.png (58.01 KiB) Viewed 774 times
I don't think it should be difficult to change the framebuffer to match but could the fact that the Adafruit library is treating the LCD as a secondary monitor of sorts while the framebuffer is treating the LCD as the only monitor be the issue?

User avatar
mikeysklar
 
Posts: 13824
Joined: Mon Aug 01, 2016 8:10 pm

Re: Fixing lag on a ST7789

Post by mikeysklar »

Are you seeing any errors when you run the dmesg command after a hang occurs? If the OS is fighting over a resource it should get logged to the driver messages.

User avatar
Minefield47
 
Posts: 10
Joined: Tue Sep 21, 2021 11:21 am

Re: Fixing lag on a ST7789

Post by Minefield47 »

mikeysklar wrote:Are you seeing any errors when you run the dmesg command after a hang occurs? If the OS is fighting over a resource it should get logged to the driver messages.
I was going to attempt to see if I can replicate the error screen after I configured the pinouts to be identical. However, after changing the fbcp pins in the build file, I get the error screen below. This only flashes on the screen for a second during boot before returning to a black screen.
Screenshot 2021-12-11 172608.png
Screenshot 2021-12-11 172608.png (417.93 KiB) Viewed 516 times
The only thing I changed was the -DGPIO_TFT_DATA_CONTROL=5 to -DGPIO_TFT_DATA_CONTROL=25 and -DGPIO_TFT_RESET_PIN=6 to -DGPIO_TFT_RESET_PIN=24. I copied the exact code line I used below.

cmake -DST7789=ON -DGPIO_TFT_DATA_CONTROL=25 -DGPIO_TFT_RESET_PIN=24 -DSPI_BUS_CLOCK_DIVISOR=8 -DSTATISTICS=0
I also included the pinout on my board here
IMG_8051.jpg
IMG_8051.jpg (182.52 KiB) Viewed 516 times
*edit: for some reason the forum will not let me put the other image here, it just duplicates 8051 and puts 8053 in the attachments pane so the other side of the wiring is there.

Do I have to keep the fbcp pinout the same and change every adafruit library to match (I would prefer to not have to do this as I am going to be running a variety of scripts and I do not want this to get too complicated with each new script).
Attachments
IMG_8053.jpg
IMG_8053.jpg (875.93 KiB) Viewed 516 times

User avatar
Minefield47
 
Posts: 10
Joined: Tue Sep 21, 2021 11:21 am

Re: Fixing lag on a ST7789

Post by Minefield47 »

I wanted to follow up on this as I am back from winter break and in my spring semester. I couldn't figure out anything further on the spi_speed_hz and was wondering if anyone knew about this and how I could possibly go about solving this issue?

Thanks!

Locked
Please be positive and constructive with your questions and comments.

Return to “Glowy things (LCD, LED, TFT, EL) purchased at Adafruit”