Due to high demand expect some shipping delays at this time, orders may not ship for 3-4 business days. On MLK Day no orders will be shipped.
0

Fixing lag on a ST7789
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Fixing lag on a ST7789

by Minefield47 on Sun Oct 31, 2021 12:27 am

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!

Minefield47
 
Posts: 9
Joined: Tue Sep 21, 2021 11:21 am

Re: Fixing lag on a ST7789

by mikeysklar on Tue Nov 02, 2021 5:21 pm

@Minefield47,

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

mikeysklar
 
Posts: 6515
Joined: Mon Aug 01, 2016 8:10 pm

Re: Fixing lag on a ST7789

by Minefield47 on Wed Nov 03, 2021 4:47 pm

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

Minefield47
 
Posts: 9
Joined: Tue Sep 21, 2021 11:21 am

Re: Fixing lag on a ST7789

by mikeysklar on Wed Nov 03, 2021 5:21 pm

@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

mikeysklar
 
Posts: 6515
Joined: Mon Aug 01, 2016 8:10 pm

Re: Fixing lag on a ST7789

by Minefield47 on Tue Nov 23, 2021 3:51 pm

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!

Minefield47
 
Posts: 9
Joined: Tue Sep 21, 2021 11:21 am

Re: Fixing lag on a ST7789

by mikeysklar on Tue Nov 23, 2021 8:00 pm

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.

mikeysklar
 
Posts: 6515
Joined: Mon Aug 01, 2016 8:10 pm

Re: Fixing lag on a ST7789

by Minefield47 on Tue Nov 23, 2021 9:57 pm

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.

Minefield47
 
Posts: 9
Joined: Tue Sep 21, 2021 11:21 am

Re: Fixing lag on a ST7789

by mikeysklar on Wed Nov 24, 2021 12:12 pm

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.

mikeysklar
 
Posts: 6515
Joined: Mon Aug 01, 2016 8:10 pm

Re: Fixing lag on a ST7789

by 55jr55 on Wed Nov 24, 2021 10:13 pm

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.

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

Re: Fixing lag on a ST7789

by Minefield47 on Tue Nov 30, 2021 1:08 pm

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.

Minefield47
 
Posts: 9
Joined: Tue Sep 21, 2021 11:21 am

Re: Fixing lag on a ST7789

by Minefield47 on Tue Nov 30, 2021 1:19 pm

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 443 times
AdafruitPINOUT.png
AdafruitPINOUT.png (58.01 KiB) Viewed 443 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?

Minefield47
 
Posts: 9
Joined: Tue Sep 21, 2021 11:21 am

Re: Fixing lag on a ST7789

by mikeysklar on Tue Nov 30, 2021 4:24 pm

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.

mikeysklar
 
Posts: 6515
Joined: Mon Aug 01, 2016 8:10 pm

Re: Fixing lag on a ST7789

by Minefield47 on Sat Dec 11, 2021 6:29 pm

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 185 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 185 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 185 times

Minefield47
 
Posts: 9
Joined: Tue Sep 21, 2021 11:21 am

Please be positive and constructive with your questions and comments.