GAMEPI20に純なLinux(RaspberryPi OS)を入れる

基本的な情報源

https://github.com/darrenliew96/gamepi20_drivers

RaspberryPi OS を焼く

Updateする

sudo apt update
sudo apt full-upgrade
audo apt dist-update

gamepi20.dtsを作る

nano gamepi20.dts

/dts-v1/;
/plugin/;

/ {
        compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709";

        fragment@0 {
                target = <&spi0>;
                __overlay__ {
                        status = "okay";

                        spidev@0{
                                status = "disabled";
                        };

                        spidev@1{
                                status = "disabled";
                        };
                };
        };

        fragment@1 {
                target = <&gpio>;
                __overlay__ {
                        gamepi20_pins: gamepi20 {
                                brcm,pins = <25 27 >;
                                brcm,function = <1 1>; /* out */
                                brcm,pull = <0>; /* none */
                        };
                };
        };

        fragment@2 {
                target = <&spi0>;
                __overlay__ {
                        /* needed to avoid dtc warning */
                        #address-cells = <1>;
                        #size-cells = <0>;

                        gamepi20: gamepi20@0{
                		compatible = "sitronix,st7789v";
                                reg = <0>;
                                pinctrl-names = "default";
                                pinctrl-0 = <&gamepi20_pins>;
                                
								spi-max-frequency = <96000000>;
                                
								rotate = <90>;
                                width = <240>;
                                height = <320>;
								fps = <60>;
                                buswidth = <8>;
								spi-cpol;
                                spi-cpha;
								custom = <1>;
								bgr;
								
                                reset-gpios = <&gpio 27 1>;
								dc-gpios = <&gpio 25 0>;
                                led-gpios = <&gpio 24 1>;
								/*cs-gpios = <&gpio 8 0>;*/
								
                                debug = <0>;
					
								init = <0x1000011
										0x20000ff
										0x1000036 0xA0
										0x100003a 0x05
										0x1000021 
										0x100002a 0x00 0x01 0x00 0x3f
										0x100002b 0x00 0x00 0x00 0xef
										0x10000b2 0x0c 0x0c 0x00 0x33 0x33
										0x10000b7 0x35
										0x10000bb 0x1f
										0x10000c0 0x0c
										0x10000c2 0x01
										0x10000c3 0x12
										0x10000c4 0x20
										0x10000c6 0x0f
										0x10000d0 0xa4 0xa1
										0x10000e0 0xd0 0x08 0x11 0x08 0x0C 0x15 0x39 0x33 0x50 0x36 0x13 0x14 0x29 0x2d
										0x10000e1 0xd0 0x08 0x10 0x08 0x06 0x06 0x39 0x44 0x51 0x0b 0x16 0x14 0x2f 0x31
										0x1000029>;
                        };
                };
        };


        __overrides__ {
                speed =   <&gamepi20>,"spi-max-frequency:0";
                rotate =  <&gamepi20>,"rotate:0";
                width =   <&gamepi20>,"width:0";
                height =  <&gamepi20>,"height:0";
                fps =     <&gamepi20>,"fps:0";
                debug =   <&gamepi20>,"debug:0";
        };
};

gamepi20.dtsを登録する

pi@raspberry:~ $ sudo dtc -@ -I dts -O dtb -o /boot/overlays/gamepi20.dtbo gamepi20.dts

config.txtを編集

# Uncomment some or all of these to enable the optional hardware interfaces
dtparam=i2c_arm=on
dtparam=i2s=on
dtparam=spi=on
#dtoverlay=i2c-dev=spi_bcm2835

# Automatically load overlays for detected cameras
camera_auto_detect=0

# Automatically load overlays for detected DSI displays
display_auto_detect=0

# Enable DRM VC4 V3D driver
#dtoverlay=vc4-kms-v3d
#max_framebuffers=2

# Disable compensation for displays with overscan
disable_overscan=1

[cm4]
# Enable host mode on the 2711 built-in XHCI USB controller.
# This line should be removed if the legacy DWC2 controller is required
# (e.g. for USB device mode) or if USB support is not required.
#otg_mode=1

[all]
#dtoverlay=pi3-disable-bt
#dtoverlay=pi3-miniuart-bt
#enable_uart=1
dtoverlay=gamepi20
hdmi_force_hotplug=1
hdmi_cvt=640 480 60 1 0 0 0
hdmi_group=2
hdmi_mode=1
hdmi_mode=87
audio_pwm_mode=2
dtoverlay=audremap,pins_18_19

fbcpを作る

sudo apt-get install cmake git
cd ~
git clone https://github.com/tasanakorn/rpi-fbcp
cd rpi-fbcp/
mkdir build
cd build/
cmake ..
make
sudo install fbcp /usr/local/bin/fbcp

/etc/X11/xorg.conf.d/99-fbdev.confを作る
sudo nano /etc/X11/xorg.conf.d/99-fbdev.conf
Section "Device"  
  Identifier "myfb"
  Driver "fbdev"
  Option "fbdev" "/dev/fb1"
EndSection

/etc/modulesに追記

sudo nano /etc/modulesに追記
i2c-dev
spi-bcm2835 
flexfb
fbtft_device

fbtft.conf fileを作る(2行)

sudo nano /etc/modprobe.d/fbtft.conf
options fbtft_device name=flexfb gpios=reset:27,dc:25,cs:8,led:24 speed=96000000 bgr=1 fps=60 custom=1 height=240 width=320
options flexfb setaddrwin=0 width=320 height=240 init=-1,0x11,-2,120,-1,0x36,0xA0,-1,0x3A,0x05,-1,0x21,-1,0x2A,0x00,0x01,0x00,0x3F,-1,0x2B,0x00,0x00,0x00,0xEF,-1,0xB2,0x0C,0x0C,0x00,0x33,0x33,-1,0xB7,0x35,-1,0xBB,0x1F,-1,0xC0,0x2C,-1,0xC2,0x01,-1,0xC3,0x12,-1,0xC4,0x20,-1,0xC6,0x0F,-1,0xD0,0xA4,0xA1,-1,0xE0,0xD0,0x08,0x11,0x08,0x0C,0x15,0x39,0x33,0x50,0x36,0x13,0x14,0x29,0x2D,-1,0xE1,0xD0,0x08,0x10,0x08,0x06,0x06,0x39,0x44,0x51,0x0B,0x16,0x14,0x2F,0x31,-1,0x29,-3

/etc/rc.localを編集

fbcp &
exit 0

トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS