您的位置: 首页 » 技术小记 » orangpi_one备忘

orangpi_one备忘

作者:liyangyijie / 时间:February 23, 2020 /分类:技术小记 / 标签:none /阅览次数:3,207

备忘

git clone https://github.com/orangepi-xunlong/WiringOP

选择h3
gpio readall

 +------+-----+----------+------+---+OrangePiH3+---+------+----------+-----+------+
 | GPIO | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | GPIO |
 +------+-----+----------+------+---+----++----+---+------+----------+-----+------+
 |      |     |     3.3v |      |   |  1 || 2  |   |      | 5v       |     |      |
 |   12 |   0 |    SDA.0 |  OFF | 0 |  3 || 4  |   |      | 5V       |     |      |
 |   11 |   1 |    SCL.0 |  OFF | 0 |  5 || 6  |   |      | 0v       |     |      |
 |    6 |   2 |      PA6 |  OFF | 0 |  7 || 8  | 0 | OFF  | TxD3     | 3   | 13   |
 |      |     |       0v |      |   |  9 || 10 | 0 | OFF  | RxD3     | 4   | 14   |
 |    1 |   5 |     RxD2 |  OFF | 0 | 11 || 12 | 0 | OFF  | PD14     | 6   | 110  |
 |    0 |   7 |     TxD2 |  OUT | 1 | 13 || 14 |   |      | 0v       |     |      |
 |    3 |   8 |     CTS2 |  OUT | 1 | 15 || 16 | 0 | OFF  | PC04     | 9   | 68   |
 |      |     |     3.3v |      |   | 17 || 18 | 0 | OFF  | PC07     | 10  | 71   |
 |   64 |  11 |     MOSI | ALT3 | 0 | 19 || 20 |   |      | 0v       |     |      |
 |   65 |  12 |     MISO | ALT3 | 0 | 21 || 22 | 0 | OFF  | RTS2     | 13  | 2    |
 |   66 |  14 |     SCLK | ALT3 | 0 | 23 || 24 | 0 | ALT3 | CE0      | 15  | 67   |
 |      |     |       0v |      |   | 25 || 26 | 1 | OUT  | PA21     | 16  | 21   |
 |   19 |  17 |    SDA.1 |  OFF | 0 | 27 || 28 | 0 | OFF  | SCL.1    | 18  | 18   |
 |    7 |  19 |     PA07 |  OFF | 0 | 29 || 30 |   |      | 0v       |     |      |
 |    8 |  20 |     PA08 |  OFF | 0 | 31 || 32 | 0 | OFF  | RTS1     | 21  | 200  |
 |    9 |  22 |     PA09 |  OFF | 0 | 33 || 34 |   |      | 0v       |     |      |
 |   10 |  23 |     PA10 |  OFF | 0 | 35 || 36 | 0 | OFF  | CTS1     | 24  | 201  |
 |   20 |  25 |     PA20 |  OFF | 0 | 37 || 38 | 0 | OFF  | TxD1     | 26  | 198  |
 |      |     |       0v |      |   | 39 || 40 | 0 | OFF  | RxD1     | 27  | 199  |
 |    4 |  28 |     PA04 | ALT2 | 0 | 41 || 42 | 0 | ALT2 | PA05     | 29  | 5    |
 +------+-----+----------+------+---+----++----+---+------+----------+-----+------+
 | GPIO | wPi |   Name   | Mode | V | Physical | V | Mode | Name     | wPi | GPIO |
 +------+-----+----------+------+---+OrangePiH3+---+------+----------+-----+------+

 
 RPi LCD

 PIN NO.    SYMBOL    DESCRIPTION
1, 17    3.3V    Power positive (3.3V power input)
2, 4    5V    Power positive (5V power input)
3, 5, 7, 8, 10    NC    NC
6, 9, 14, 20, 25    GND    Ground
11    TP_IRQ    Touch Panel interrupt, low level while the Touch Panel detects touching
12    KEY1    Key
13    RST    Reset
15    LCD_RS    LCD instruction control, Instruction/Data Register selection
16    KEY2    Key
18    KEY3    Key
19    LCD_SI / TP_SI    SPI data input of LCD/Touch Panel
21    TP_SO    SPI data output of Touch Panel
22    KEY4    Key
23    LCD_SCK / TP_SCK    SPI clock of LCD/Touch Panel
24    LCD_CS    LCD chip selection, low active
26    TP_CS    Touch Panel chip selection, low active

 13==RST 15==RS

==================================

You can use BOTH LCD and TOUCH

1) Enable overlays for spi and cs1

sudo nano /boot/armbianEnv.txt
add the following to the bottom

overlays=spi-spidev spi-add-cs1 
param_spidev_spi_bus=0 
param_spidev_spi_cs=1
2) Reboot your device

==================================
https://github.com/notro/fbtft/blob/master/fbtft_device.c
找到驱动对于名字fb_ili9341
LCD

1) Load fbtft and fbtft_device on boot

sudo nano /etc/modules-load.d/fbtft.conf 
fbtft
fbtft_device
2) Load fbtft_device options

nano /etc/modprobe.d/fbtft.conf 
options fbtft_device rotate=90 name=piscreen speed=16000000 gpios=reset:2,dc:71 txbuflen=32768 fps=25
3) Since there is no GUI in mainline, lets enable the console to be displayed to LCD instead

# ll /dev/spidev*
crw------- 1 root root 153, 0 Dec  6 18:16 /dev/spidev0.1

常用的模块参数有:
gpios用于指定reset,  dc, led等具体使用哪个io口
mode用于指定spi使用哪种时序
busnum用于指定使用第几个spi控制器
rotate用于指定翻转角度
name用于指定设备名
===============================================================
modinfo fbtft_device
filename:       /lib/modules/4.19.62-sunxi/kernel/drivers/staging/fbtft/fbtft_device.ko
license:        GPL
author:         Noralf Tronnes
description:    Add a FBTFT device.
depends:        fbtft
staging:        Y
intree:         Y
name:           fbtft_device
vermagic:       4.19.62-sunxi SMP mod_unload ARMv7 thumb2 p2v8
parm:           name:Devicename (required). name=list => list all supported devices. (charp)
parm:           rotate:Angle to rotate display counter clockwise: 0, 90, 180, 270 (uint)
parm:           busnum:SPI bus number (default=0) (uint)
parm:           cs:SPI chip select (default=0) (uint)
parm:           speed:SPI speed (override device default) (uint)
parm:           mode:SPI mode (override device default) (int)
parm:           gpios:List of gpios. Comma separated with the form: reset:23,dc:24 (when overriding the default, all gpios must be specified) (charp)
parm:           fps:Frames per second (override driver default) (uint)
parm:           gamma:String representation of Gamma Curve(s). Driver specific. (charp)
parm:           txbuflen:txbuflen (override driver default) (int)
parm:           bgr:BGR bit (supported by some drivers). (int)
parm:           startbyte:Sets the Start byte used by some SPI displays. (uint)
parm:           custom:Add a custom display device. Use speed= argument to make it a SPI device, else platform_device (bool)
parm:           width:Display width, used with the custom argument (uint)
parm:           height:Display height, used with the custom argument (uint)
parm:           buswidth:Display bus width, used with the custom argument (uint)
parm:           init:Init sequence, used with the custom argument (array of short)
parm:           debug:level: 0-7 (the remaining 29 bits is for advanced usage) (ulong)
parm:           verbose:0 silent, >0 show gpios, >1 show devices, >2 show devices before (default=3) (uint)
==================================
sudo nano /etc/rc.local
con2fbmap 1 1
==================================
FRAMEBUFFER=/dev/fb0 startx
fbset -si
mplayer -nolirc -vo fbdev2:/dev/fb0  test.mp4
fbi -d /dev/fb0 -T 1 -noverbose -a

==================================
https://wiki.archlinux.org/index.php/Getty#Automatic_login_to_virtual_console
systemctl start getty@tty1
systemctl enable getty@tty1

[Service]
ExecStart=
ExecStart=-/sbin/agetty --autologin root --noclear %I $TERM

cat /etc/systemd/system/getty.target.wants/getty@tty1.service
vim /lib/systemd/system/getty@.service
========================================
otg to usb

cd /boot/dtb
sudo cp sun8i-h3-orangepi-one.dtb sun8i-h3-orangepi-one.dtb.old
sudo dtc -I dtb -O dts -o sun8i-h3-orangepi-one.dts sun8i-h3-orangepi-one.dtb
sudo sed -i -e 's/dr_mode = "peripheral";/dr_mode = "host";/g' sun8i-h3-orangepi-one.dts
sudo dtc -I dts -O dtb -o sun8i-h3-orangepi-one.dtb sun8i-h3-orangepi-one.dts

========================================
#!/bin/sh
# turn on microusb otg port in armbian (work as host)
# solution from https://forum.armbian.com/topic/4814-orange-pi-one-usb-otg/

FILE=$1
BACKUP=$FILE.bak
SRC="tmp.dts"

cp "$FILE" "$BACKUP"
dtc -I dtb -O dts -o "$SRC" "$FILE"
sed -i -e 's/dr_mode = "otg";/dr_mode = "host";/g' "$SRC"
dtc -I dts -O dtb -o "$FILE" "$SRC"
rm "$SRC"
========================================
iptraf 流量监测工具
========================================
armbian 名字变成wlan0
Add this
extraargs=net.ifnames=0
to /boot/armbianEnv.txt

上一篇 : 静态编译shadowsocks-libev 3.3.4 下一篇 : Tunsafe 静态编译x64备忘

添加新评论