New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tutorial: Get a SPI Display working (Waveshare 320x240 using fbcp-ili9341) #23
Comments
thanks for this @HerrEurobeat Just to be clear, if we are using the pinouts mapped for the click well, we def have to change a few pins for this display. cmake -DST7789=ON -DGPIO_TFT_DATA_CONTROL=25 -DGPIO_TFT_RESET_PIN=27 -DSPI_BUS_CLOCK_DIVISOR=30 -DSTATISTICS=0 accounts for this correct? |
@nsier |
Thanks! Last question, do we need to wire up the Backlight? I bought the Adafruit version of this display and the wiring guide they show doesn't seem to require it https://learn.adafruit.com/2-2-tft-display/python-wiring-and-setup thanks |
No problem :) The script supports a display turnoff after 60sec but it wasn't working for me, probably because of the different display. But you could change it in the code to pull the GPIO pin to get it working. |
The BL pin is not driving the backlight directly, it drives a transistor base so it can be connected to a PWM signal to be able to dimmer the backlight. In other words, it is ok to connect it directly to a gpio (dont forget to activate it!!), this will not damage the RPI ports ;). |
I don't seem to have a build folder within my fbcp-ili9341 directory. is it Ok just to compile in fbcp-ili9341 ? |
@nsier here you can get some additional details about the installation: http://rsflightronics.com/spotifypod and here (Option 2) https://krystof.io/mirroring-raspberry-pi-hdmi-video-to-a-st7789-1-3-inch-lcd-display/ |
@nsier If I recall correctly you have to create the folder and I seem to have missed including it in the explanation. Just do a Edit: I edited my post and included the folder creation step. Thanks for pointing out that it was missing! |
You just saved me hours of tinkering to get this working. I just followed your perfect summary and in 15 min...boom....working from the first run. I did noticed though that the ratio of the python app is a bit off on the screen (narrower on the sides and taller). Did you notice the same thing? Vielen Dank! |
Kein Problem! :D |
I keep getting the message that it failed and to make sure I have hdmi_force_hotplug=1 in the /boot/config.txt whenever I run sudo ./fbcp-ili9341, and in the config file I have hdmi_force_hotplug=1 so what could be the problem? |
Hello when I run the make file I get an error telling me to add hdmi_force_hotplug=1 to the config file, and when I check it's there uncommented. Do any of you know a possible solution or at least whats wrong? |
Hey |
check that you have |
You are wondering on how to get a SPI display to work? Yeah me too so I hope this quick guide will help you.
I did this using a Waveshare 320x240 LCD IPS screen. This is the pinout I used which is provided by Waveshare themselves.
I'm sorry if an issue isn't the right place but I figured most people with this question would see it here first. If it fits into the README (as a shortened version) I would gladly open a pull request.
If I'm missing something or got something wrong please comment down below.
Stuff on your computer:
First of all open
config.txt
which is located in theboot
partition while having the SD card mounted on your computer.I didn't need to follow these few steps which tell you to remove any
dtoverlay
ordtparam=spi=on
parameter as I didn't have them in my config.As described here, add these lines to your
config.txt
(or uncomment and modify the existing ones buthdmi_cvt
didn't exist for me yet):Stuff on the pi:
You can now eject your SD card and boot the pi.
When you are in a terminal (for example using ssh), follow these steps as documented here:
Open
st7735r.h
using a text editor:nano st7735r.h
Go to line 18 which defines the values for the controller the display in this example uses:
ST7789
Change
DISPLAY_NATIVE_HEIGHT
from240
to320
as described here.Then save (CTRL+S) and exit (CTRL+X).
Now we need to compile the driver.
Create a build folder:
mkdir build
and open it:
cd build
If you have used the same pinout as in the image in the beginning then these values should be right.
If not then you need to change
TFT_DATA_CONTROL
andTFT_RESET_PIN
. Remember that these numbers are the GPIO pin names and not counted. Image to see which GPIO Pin has which numberSince I had to mount my display with the ribbon cable on the right side, so basically upside down from the original orientation the manufacturer intended, I had to flip the image by including this option before the two dots at the end:
-DDISPLAY_ROTATE_180_DEGREES=ON
Now wait for that to finish and then type:
make -j
When that is done we are almost done. You can test the driver now by running
sudo ./fbcp-ili9341
but since the driver should start automatically on boot we have to do one last change.Open
/etc/rc.local
with a text editor with sudo privileges:sudo nano /etc/rc.local
Add these lines before
exit
:Thats it!
I hope this helped you to figure out on how to get your display running. I had many questions for a few days but these were all the steps I had to take to get my display up and running. I credited every source where I got my information from in this post.
(I hope I didn't forget anything, wasn't the only one having this problem and that it works for you.)
The text was updated successfully, but these errors were encountered: