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!
Fixing lag on a ST7789
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- mikeysklar
- Posts: 14194
- Joined: Mon Aug 01, 2016 8:10 pm
Re: Fixing lag on a ST7789
@Minefield47,
Which specific make/model of ST7789 display are you using?
Which specific make/model of ST7789 display are you using?
- Minefield47
- Posts: 10
- Joined: Tue Sep 21, 2021 11:21 am
Re: Fixing lag on a ST7789
Adafruit 1.54" 240x240 Wide Angle TFT LCD Display with MicroSDmikeysklar wrote:@Minefield47,
Which specific make/model of ST7789 display are you using?
https://www.adafruit.com/product/3787
- mikeysklar
- Posts: 14194
- Joined: Mon Aug 01, 2016 8:10 pm
Re: Fixing lag on a ST7789
@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
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
- Minefield47
- Posts: 10
- Joined: Tue Sep 21, 2021 11:21 am
Re: Fixing lag on a ST7789
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!
Thanks!
- mikeysklar
- Posts: 14194
- Joined: Mon Aug 01, 2016 8:10 pm
Re: Fixing lag on a ST7789
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.
Can you post some of the errors you are seeing? Maybe they can be resolved to some degree.
- Minefield47
- Posts: 10
- Joined: Tue Sep 21, 2021 11:21 am
Re: Fixing lag on a ST7789
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.
- mikeysklar
- Posts: 14194
- Joined: Mon Aug 01, 2016 8:10 pm
Re: Fixing lag on a ST7789
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.
- 55jr55
- Posts: 4
- Joined: Sun Nov 21, 2021 1:03 pm
Re: Fixing lag on a ST7789
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.
- Minefield47
- Posts: 10
- Joined: Tue Sep 21, 2021 11:21 am
Re: Fixing lag on a ST7789
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: 10
- Joined: Tue Sep 21, 2021 11:21 am
Re: Fixing lag on a ST7789
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. 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?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.
- mikeysklar
- Posts: 14194
- Joined: Mon Aug 01, 2016 8:10 pm
Re: Fixing lag on a ST7789
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.
- Minefield47
- Posts: 10
- Joined: Tue Sep 21, 2021 11:21 am
Re: Fixing lag on a ST7789
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.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.
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 *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 (875.93 KiB) Viewed 552 times
- Minefield47
- Posts: 10
- Joined: Tue Sep 21, 2021 11:21 am
Re: Fixing lag on a ST7789
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!
Thanks!
Please be positive and constructive with your questions and comments.