Download retropie and flash your SD card
Connect screen to Raspberry like that (from screen to raspberry) :
- VCC to 3.3 volt (pin 17
- GND to GND (pin 20)
- CS to CE0 (pin 24)
- RESET to GPIO 25 (pin 22)
- D/C to GPIO 24 (pin 18)
- SDI/MOSI to MOSI (pin 19)
- SCK to SCLk (pin 23)
- LED to GPIO18 (pin 12)
- SDO/MISO to MISO (pin 21)
Activate SPI :
Use raspi-config command to activate SPI
edit /etc/modprobe.d/raspi-blacklist.conf and remove or comment the line "blacklist spi-bcm2708".
Then, after a reboot, a dmesg | grep spi should return something like bcm2708_spi.
Load screen module :
from there, you can load the module via
sudo modprobe fbtft_device name=adafruit22a verbose=1
dmesg | tail
should return lines about fbtft_device
fbset -fb /dev/fb1
should return information about the screen.
You can then test the screen by sending random data to it via :
cat /dev/urandom > /dev/fb1
Screen should then show pixel of random colors.
Dupplicate HDMI output :
you can then duplicate the HDMI output to that screen by downloading rpi-fbcp (https://github.com/tasanakorn/rpi-fbcp) :
cd git clone https://github.com/tasanakorn/rpi-fbcp cd rpi-fbcp mkdir build cd build cmake .. make
You can test it by lanching the program freshly built
Then, you’ll need to add it at boot :
sudo nano /etc/rc.local
Then, go at the end of file (but before the exit 0) and add a line where to find fbcp :
If you reboot, the screen should reproduce what you see on the HDMI output.
Persist changes :
if previous steps were successful, you can then load the module at boot.
For that, add to /etc/modules following lines :
fbtft dma fbtft_device name=adafruit22a verbose=0 speed=48000000 rotate=90
That seems not working on latest RetroPie build (failed to load linux kernel modules at boot). In dmesg, it seems that SPI is loaded after that module which may be the source of the problem. It may be since systemd migration.
To fix it (not the cleanest way but it works), you can load the module at boot so edit your /etc/rc.local and add at the end (but before the exit 0) :
modprobe fbtft_device name=adafruit22a verbose=0 speed=48000000 rotate=90
To avoid screen to blank when showing console, add
consoleblank=0in /boot/config.txt as described here.