5 802 octets ajoutés
, 14 décembre 2013 à 22:56
{{RASP-PiTFT-NAV}}
== Introduction ==
{{ADF-Image|RASP-PiTFT-Soft-Install-01.jpg|480px}}
In order to add support for the 2.8" TFT and touchscreen, we'll need to install a new Linux Kernel. Lucky for you, we created a kernel package that you can simply install over your current Raspbian (or Raspbian-derived) install instead of needing a whole new image. This makes it easier to keep your install up-to-date.
To use our kernel .deb files you must be using Raspbian or derivative. This wont work with Arch or other Linux flavors. As Raspbian is the official OS for the Pi, that's the only Linux we will support! [http://adafruit-download.s3.amazonaws.com/adafruit-ts.zip Others can recompile their own kernel using our patchfile], but we have no tutorial or support or plans for such.
== Avant de commencer ==
You'll need a working install of Raspbian with network access. [http://learn.adafruit.com/adafruit-raspberry-pi-lesson-1-preparing-and-sd-card-for-your-raspberry-pi If you need help getting that far, check out our collection of Pi tutorials].
We'll be doing this from a console cable connection, but you can just as easily do it from the direct HDMI/TV console or by SSH'ing in. Whatever gets you to a shell will work!
Also, run '''sudo apt-get update''' !
== Téléchargement et installation ==
Download the multiple files you'll need by running the following commands:
<nowiki>cd ~
wget http://adafruit-download.s3.amazonaws.com/libraspberrypi-bin-adafruit.deb
wget http://adafruit-download.s3.amazonaws.com/libraspberrypi-dev-adafruit.deb
wget http://adafruit-download.s3.amazonaws.com/libraspberrypi-doc-adafruit.deb
wget http://adafruit-download.s3.amazonaws.com/libraspberrypi0-adafruit.deb
wget http://adafruit-download.s3.amazonaws.com/raspberrypi-bootloader-adafruit-112613.deb</nowiki>
{{ADF-Image|RASP-PiTFT-Soft-Install-02.jpg|480px}}
Next install the new kernel with
<nowiki>sudo dpkg -i -B *.deb</nowiki>
This will take a few minutes so go make a sandwich or coffee
{{ADF-Image|RASP-PiTFT-Soft-Install-03.jpg|480px}}
{{ADF-Image|RASP-PiTFT-Soft-Install-03b.jpg|480px}}
Now we'll just reboot to let it all sink in.
If you don't have the TFT installed, shutdown, place the TFT on the Pi and re-power
<nowiki>sudo shutdown -h now</nowiki>
else (if you have the TFT plate installed already)
<nowiki>sudo reboot</nowiki>
Now that you're rebooted, log back in on the console/TV/SSH. There's no screen yet, we'll do a test to make sure everything is perfect first!
Run the following commands to install the screen driver. Note that the screen will go from white to black indicating the commands succeeded.
<nowiki>sudo modprobe spi-bcm2708
sudo modprobe fbtft_device name=adafruitts rotate=90
export FRAMEBUFFER=/dev/fb1
startx</nowiki>
{{ADF-Image|RASP-PiTFT-Soft-Install-04.jpg|480px}}
You should see the Pi desktop show up on the TFT! Congrats, you've completed the first test perfectly. Now we'll make the TFT kernel modules automatically install on boot.
Hit Control-C in the console to quit the X server so we can continue configuration
== Auto-chargement du module ==
We'll now make the modules auto-load. Lets edit the /etc/modules list with
<nowiki>sudo nano /etc/modules</nowiki>
add two lines
<nowiki>spi-bcm2708
fbtft_device</nowiki>
Then Control-X Y [return] to save
{{ADF-Image|RASP-PiTFT-Soft-Install-10.jpg|480px}}
You're not done yet! Now we have to add the configuration details in a new modprobe file:
<nowiki>sudo nano /etc/modprobe.d/adafruit.conf</nowiki>
add the following line
<nowiki>options fbtft_device name=adafruitts rotate=90 frequency=32000000</nowiki>
and save like you did before.
The '''rotate=''' variable tells the driver to rotate the screen '''0 90 180''' or '''270''' degrees.
'''0''' is portrait, with the bottom near the "Adafruit Logo"
'''90''' is landscape, with the bottom of the screen near the buttons.
'''180''' is portrait, with the top near the "Adafruit Logo"
'''270''' is landscape, with the top of the screen near the buttons.
You can change this file with '''nano''' and reboot to make the change stick.
The frequency= variable tells the driver how to fast to drive the display. 32MHz ('''32000000''') is a pretty nice 20 FPS rate but if your screen is acting funny, try taking it down to 16MHz ('''16000000''')
{{ADF-Image|RASP-PiTFT-Soft-Install-11.jpg|480px}}
'''sudo reboot''' and look at the console output (or run '''dmesg''' in the console window after logging in) you will see the modules install. Look in particular for the STMPE610 detection and the ILI9340 screen frequency as highlighted here
{{ADF-Image|RASP-PiTFT-Soft-Install-12.jpg|480px}}
We can set up the touchscreen for '''rotate=90''' configuration by doing the following (for more delicate calibration or for other rotate=XX values, see the next section)
Create the directory and new calibration configuration file:
<nowiki>sudo mkdir /etc/X11/xorg.conf.d
sudo nano /etc/X11/xorg.conf.d/99-calibration.conf</nowiki>
and enter in the following lines, then save.
<nowiki> Section "InputClass"
Identifier "calibration"
MatchProduct "stmpe-ts"
Option "Calibration" "3800 200 200 3800"
Option "SwapAxes" "1"
EndSection</nowiki>
{{ADF-Image|RASP-PiTFT-Soft-Install-13.jpg|480px}}
You can now try to run X again with
<nowiki>FRAMEBUFFER=/dev/fb1 startx</nowiki>
Type Control-C to quit X
If you don't ever want to have to type FRAMEBUFFER=/dev/fb1 before startx, you can make it a default state by editing your profile file: '''sudo nano ~/.profile''' and adding
<nowiki>export FRAMEBUFFER=/dev/fb1</nowiki>
near the top and saving the file. If you log out or reboot it will be in place from then on.
{{ADF-Image|RASP-PiTFT-Soft-Install-14.jpg|480px}}
{{RASP-PiTFT-TRAILER}}