勇闖新世界︰ 《 Kernel 4.X 》之整裝蓄勢‧PiTFT‧一

起初樹莓派上並沒有以 SPI 匯流排為界面的 TFT LCD 之 Framebuffer 驅動程式。許多的發展與貢獻來自 notro 先生,如今這個驅動程式已經合併於官方板的核心內,從

/fbtft

Home

notro edited this page · 142 revisions

Linux Framebuffer drivers for small TFT LCD display modules.

For a list of all wikipages see Pages

FBTFT development has moved
The FBTFT drivers are now in the Linux kernel: drivers/staging/fbtft (details).

Install

The FBTFT drivers are now included in the Raspberry Pi Foundation kernel and can be installed with plain rpi-update.
There is one piece missing and that is a DMA capable SPI controller driver to get max performance. So for fbcp and showing movies, the FBTFT kernel still has to be used.

See /boot/overlays/README and FBTFT RPI overlays for information about Device Tree overlays.

To use fbtft_device instead of a DT overlay, add to /boot/config.txt:

dtparam=spi=on

FBTFT kernel with SPI DMA

sudo REPO_URI=https://github.com/notro/rpi-firmware rpi-update

2015-07-11

2015-03-27

  • FBTFT support is now in raspberrypi/linux. This release only adds SPI DMA support on top of that.
  • pitft overlay changed name to pitft28-resistive
  • These modules are no longer present:
    • gpio_keys_device – DT overlay example
    • ads7846_device – Use ads7846 DT overlay instead. See /boot/overlays/README
    • gpio_mouse_device
    • stmpe_device
    • gpio_backlight_device
    • rpi_power_switch
    • spi-config
  • Builtin console fonts are not enabled (fbcon=font:XX).
  • Other kconfig options no longer enabled:
    • MOUSE_GPIO
    • GPIO_MCP23S08
    • DYNAMIC_DEBUG
  • 2015-02-07
    • Add Raspberry Pi 2 support

……

網頁日誌來看,已經大功告成,或將功成身退的了。

一個小型的顯示器對於許多應用十分重要,甚至不可或缺。假使要考察『新世界物品』,不得不及於此物之介紹,在此選擇介紹最早成名且聽聞銷售很好的『PiTFT』顯示器之安裝設定以饗讀者,也許可當成一般性的範例的吧。為了更貼近即將到來的樹莓派硬體界面之『 HATs 』Hardware Attached on Top 規範,我們將採用 40 pins 的

PiTFT Plus Assembled 320×240 2.8″ TFT + Resistive Touchscreen – Pi 2 and Model A+ / B+

Description

Is this not the cutest little display for the Raspberry Pi? It features a 2.8″ display with 320×240 16-bit color pixels and a resistive touch overlay. The plate uses the high speed SPI interface on the Pi and can use the mini display as a console, X window port, displaying images or video etc. Best of all it plugs right in on top!This updated design fits perfectly onto the Pi Model A+, B+, or Pi 2! Works just like the Model B version, but now matches the outline of the Raspberry Pi 2 and Model B+. It also has all 40 pins GPIO pins brought out so you can connect a 40-pin GPIO cable underneath. Now that it’s the same outline as a Pi 2/B+ it fits well on top of a Pi in our Raspberry Pi Enclosure base.The display and touchscreen uses the hardware SPI pins (SCK, MOSI, MISO, CE0, CE1) as well as GPIO #25 and #24. All other GPIO are unused. Since we had a tiny bit of space, there’s 4 slim tactile switches wired to four GPIOs, that you can use if you want to make a basic user interface. For example, you can use one as a power on/off button. See below for the link to get the optional tact switches, they’re not included.

Use it for console access or easily pop up X11 onto the PiTFT for a mini monitor, although its rather small at 320×240. Instead, we recommend using PyGame or other SDL-drawing programs to write onto the frame buffer.

作為討論範本。

無論讀者是否安裝過這個顯示器,首先請詳細閱讀

Adafruit PiTFT – 2.8″ Touchscreen Display for Raspberry Pi 》 之說明文件,應當很容易將此顯示器安裝而且設定好。我們將在此基礎上,談談如何修改設定檔使之適合樹莓派基金會官方板 raspbian 之 Kernel 4.X 升級。為了避免冗長重複,此處說明極為減省,尚祈讀者體諒。一般 raspbian 版本上的安裝 PiTFT 概要︰※必須有網際網路

加載 Adafruit 網路程式庫

curl -SLs https://apt.adafruit.com/add | sudo bash

 

安裝 Adafruit 編譯的 Kernel 與 顯示器安裝程式

sudo apt-get install raspberrypi-bootloader
sudo apt-get install adafruit-pitft-helper

 

安裝 2.8″ 電阻式觸控 PiTFT

sudo adafruit-pitft-helper -t 28r

 

選擇 Y 啟動開機顯示

At the end you will be prompted on whether you want the text console to appear on the PiTFT. Answer Y or N depending on your personal desires!

 

就是這麼簡單就已經完成的了。請經過開機驗證後,將

升級核心

sudo rpi-update

 

然後將『Adafruit /boot/config.txt』

[pi1]
device_tree=bcm2708-rpi-b-plus.dtb
[pi2]
device_tree=bcm2709-rpi-2-b.dtb
[all]
dtparam=spi=on
dtparam=i2c1=on
dtparam=i2c_arm=on
dtoverlay=pitft28r,rotate=90,speed=32000000,fps=20

 

更改為

# --- added by adafruit-pitft-helper 五  7月 24 15:22:47 CST 2015 ---
# [pi1]
# device_tree=bcm2708-rpi-b-plus.dtb
# [pi2]
# device_tree=bcm2709-rpi-2-b.dtb
# [all]
dtparam=spi=on
dtparam=i2c1=on
dtparam=i2c_arm=on

# 修改成 Kernel 4.X 內提供的 pitft28-resistive-overlay.dtb overlay
dtoverlay=pitft28-resistive-overlay.dtb,rotate=90,speed=32000000,fps=20
# --- end adafruit-pitft-helper 五  7月 24 15:22:47 CST 2015 ---

 

再次啟動後

sudo reboot

你已擁有 Kernel 4.X 版的 PiTFT 平台的了。

 

 

※ 註記︰ rpi-update 的核心已更新至 4.1.4 ,是否有問題待驗證!