So, you are a proud owner of new Raspberry pi? Lets play with it a little bit. How about to add a spi LCD color display?
In order to use the spi display connected to the GPIO pins on raspberry, we need to have access to the raspberry pi. This can be easily achieved by following steps in my previous article. Once we have the connection over ssh, we can install the driver by following steps in this article. However, before we can start, make sure that the display is connected properly to correct GPIO pins. Specifically SCLK and MOSI pins must be connected to correct GPIO pins (SCLK->GPIO11 and MOSI->GPIO09). Also make note of where are connected pins RESET, DC and CS. Once we have this info, we can start installing the driver.
- ssh to the Pi using your favorite ssh client – connect to the IP you have found in previous part – most likely, the Pi keeps the IP address forever, but it might not be your case. In case you are not able to connect to the Pi after reboot, just try to find the IP on your router again
- once you are in Pi, enter following command „sudo raspi-config„
- navigate to „Interfacing Options“ and then select „SPI“
- on the next screen confirm that you want to enable the SPI interface – just select YES
- exit raspi-config
- enter following command „sudo nano /etc/modules„
- once the file is open, add these two lines at the very end of file:
spi-bcm2835 fbtft_device
- Install fbcp driver (one command per line you have to enter every line)
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
- enter following command „sudo nano /etc/rc.local„
- once the file is open, enter this text before line that says „exit„:
fbcp&
- create a new file by entering this command: „sudo nano /etc/modprobe.d/fbtft.conf„
- when the file is created and opened, enter following line(replace XX with your actual pins):
options fbtft_device name=fb_ili9341 gpios=reset:XX,dc:XX,cs:XX speed=40000000 rotate=90 fps=60 bgr=1 width=240 height=320 custom=1
- reboot the pi by typing following comand: „sudo reboot„