RetroPie 3.5 inch SPI display HIGH FPS (FBCP - iLi9341)
So I have this 3.5 inch display which is a copy of the WaveShare 3.5 inch display that can connect to the Raspberry Pi thru the GPIO ports. I wanted to try out some gaming using RetroPie and this display. But as soon as I managed to get the display to work I noticed that games run very bad, FPS was bad, refresh rate were bad, so I started to mess around with the settings to get better performance, but I just could not get the result that I wanted until I came across project FBCD iLi9341. So ill share the full story of how this went, I will share some marks so you can jump to the paragraph that interests you if you don’t want to read thru the whole story.
- What is RetroPie ?
- WaveShare Drivers paragraph
- Project FBCP iLi9341
- Installing RetroPie ?
- Setting up RetroPie
- Project FBCP iLi9341 implementation
At first I installed the WaveShare drivers even though my display is not manufactured by WaveShare, these drivers did work. But as I stated before games were unplayable so I started to mess around with the settings. I opened up the config file with Nano
sudo nano /boot/config.txt
And inside I edited this line (this line wont be there unless you add it after you install the drivers)
I really tried a lot of different settings that I read of forums and tried my own trial and error values. At the end I did manage to get it to run a lot better than when I first started.
diskutil listwe list our drives and find the SD card drive path. We will need the path later ( see picture below). - From here since my SD card drive is
After successful unmount I ran this command
sudo dd bs=1m if=Downloads/retroPiImage.img of=/dev/rdisk2 conv=sync
if=Downloads/retroPiImage.img Here I’m passing in the path of the RetroPie image file. If you are on a MAC you can just drag and drop the file here and it will output the path (I don’t know if this works on Windows), and than here
of=/dev/rdisk2 you add your diskutil disk number.
After this the installation process will start. If you want to get more information you can press CMD+T to get the status of the process.
After the first boot-up you will be asked to configure your controller, the interface will ask you to press some of the buttons on your controller to set it up.
RASPI-CONFIGthan go to *interfacing options -> SSH* select and enable the SSH. Here we also need to enable the wi-fi so navigate to the WIFI menu and connect to your wi-fi network, if you are doing this first time it might ask you to input your country. Than just type your password and you are set. After this step I suggest rebooting the PI with
After the restart we’ll need the IP address of the pi, navigate to the SHOW IP menu and it will prompt you with the PI’s IP address, write this IP down since we will need it later.
Next we can connect thru SSH
sudo ssh [email protected]
Here you input the IP address of your PI, mine was
192.168.1.139 at the time. Next you’ll be asked to input a password default password is raspberry. Alright now that we have access to the PI it’s time to start installing.
First make sure you have Cmake installed.
sudo apt-get install cmake
Next clone the repository
git clone https://github.com/juj/fbcp-ili9341.git
Next CD in to the downloaded folder
And here we will make a new directory, you can call this anything you like but basically this will be the directory where we will store our Build for the driver.
Next we will run the Cmake command
cmake -DSPI_BUS_CLOCK_DIVISOR=20 -DADAFRUIT_ILI9341_PITFT=ON ..
-DSPI_BUS_CLOCK_DIVISOR=20 This option takes and even number and sets the clock divisor value, alongside with the PI core frequency (that you can find in boot/config.txt) specifies the speed that the SPI communication bus is driven at. You might need to experiment with this value if your display has corrupted output or doesn’t work at all. You can try a larger value if your display shows corrupted output or smaller value to get higher bandwidth. For me I found that 20 works best. than
-DWAVESHARE35B_ILI9486=ON this flag basically targets the WaveShare 3.5 inch display. If you have a different display I suggest reading thru the repository for the other options you can have. The repository is very well written so you should have no troubles finding your way around the documentation.
Next the two dots
.. mean that we will have the build inside the build folder but the tools are one folder up above.
And then we check if the display works.
Go ahead and run
After this command the display should work fine. But if for some reason it doesn’t work first make sure there is no other FBCP driver running on your pi, if there is you can kill it with
sudo pkill fbcp
If that doesn’t work than you can remove the Build directory and start this process once again with a different DSPI_BUS_CLOCK_DIVISOR value or some other flags depending on your display. Again check the repository for that.
So once you get your display working you’ll want to run the driver at startup, instead of running it manually we are going to add it to the start script. So run Nano
sudo nano /etc/rc.local
and before the
exit 0 add this line
sudo /home/pi/fbcp-ili9341/build/fbcp-ili9341 &
If you’re build is in a different place than change this
/home/pi/fbcp-ili9341/build/fbcp-ili9341 path with the one you have.
CMD+O will save the changes in Nano,
CMD+X will exit.
And that’s it your are pretty much set. Now you can just reboot and enjoy.
All in all this was a fun little project to try. But in my opinion gaming on the PI with this type of display is doable but it’s not the best. I would really opt for an HDMI display. In the video below at the end of it I do a little comparison between the HDMI and the WaveShare knockoff display running with the project FBCP-iLi9341 drivers. And for me gaming on a 3.5 inch display is not satisfying, I know of the fact that is very portable. But really I would opt for a bigger HDMI display like a 7 inch at least. Thanks and I’ll see you in the next one.