Getting the screen working in retropie
using raspi-config, enable spi, enale ssh, disable overscan
in /etc/modules, add
in /etc/modprobe.d/fbtft.conf add
options fbtft_device name=fb_ili9163 gpios=reset:25,dc:24 speed=40000000 bgr=1 rotate= custom=1fps=60
reboot and its all done!
The screen by default wont actually run retropie on its own. So we need to run some code which copies the current screen into the tft. we need to download and install the code
sudo apt-get install cmake git clone https://github.com/tasanakorn/rpi-fbcp cd rpi-fbcp/ mkdir build cd build/ cmake .. make sudo install fbcp /usr/local/bin/fbcp
now we just need to add into /etc/rc.local (just make sure its before the exit)
now when you reboot, you will have a screen working!
So you may notice that things are not perfect with the screen! The ili9163 driver is hard coded to work with the chip at the top of the screen (upside down compared to mine) and using the rotation adds corruption into the screen. I have mentioned it to notro and he mentioned that it is a known issue, so once i get chance to play with the fbflex driver, i might have a change to this step.
Other than the screen being upside down, the pi is actiually trying to run on a standard 4:3 aspect ratio, so when things start on the screen, they wont look right. So we need to add some code into the config.txt. Firstly to force the resolution, and secondly to rotate the screen from the pi front
so if we edit config.txt, and add in
hdmi_force_hotplug=1 hdmi_cvt=128 128 60 1 0 0 0 hdmi_group=2 hdmi_mode=1 hdmi_mode=87 display_rotate=2
that should now give us a nice working screen :)