0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

LicheePi Nano で LCD/USB/内蔵 codec を使うためのメモ

Last updated at Posted at 2021-09-19

2022.11 現在、下記の手順ではリンク切れ等の理由でビルドが通らなくなっています。そのため https://github.com/mclewell/licheepi-nano-lcd をベースにして config や dts を調整したものを用意しました。


まず、LicheePi Nano については @aselectoworksさんの記事が参考になります。

これらの記事では SD ブート用イメージの作成から USB デバイスの認識までの手順が記されていますが、残念ながら現時点では dl.sipeed.com など一部リンクが途切れています。USB/LCD/内蔵codeあります。LCD に対応したカーネルについては下記ページで公開されています。

LCD は 480x272800x480 のものが使用でき、私は 480x272 のものを用いています。dts や X での設定を合わせる必要があり、ビルドが面倒な方向けにはこちらにイメージファイルなどもあります。

これに上記 MesihK さんのカーネルを組み合わせて内蔵 codec 対応を入れるのが良いと思います。


これらとは別に U-Boot、カーネル、ユーザランドをまとめて SD カードイメージを作成する buildroot を用意してみました。Mr-Bossmanさんのものに手を入れています。そちらでは U-Boot が LicheePi Nano に適合しないようなので、それだけを steward-fu さんのイメージから移せば動きます。他にちょっと余計なものが入っていたのを外したりしています。

注意

  • mpg123 などで 44.1kHz サンプルの mp3 データを内蔵 code で再生するとピッチが速くなってしまうため、-r 48000 オプションを付加します。USB オーディオ IF を使う分には問題ありません。これは内蔵 codec のドライバが 44.1kHz に対応していないためです。PLL の設定にも手を入れる必要があるようです。
  • USB デバイスを適切に認識できない場合があります。セルフパワーか否かに依らず USB ハブを介すると更に調子が悪くなります。また、カーネルコンフィグによって使用できるデバイスは異なります。Trackpoint Keyboard とオーディオインターフェースは動きました。Ethernet や WiFi は未確認です。
  • UART コンソールから startx で X Window が立ち上がります。自動起動するには /etc/init.d/S99displaysetupstartx & を追加します。
  • X Window を使用しないなら /etc/init.d/S40xorg を外して /ete/inittabgetty /dev/tty0 のエントリを追加すれば LCD と USB キーボードのコンソールが使えます。
  • U-Boot を steward-fu さんのイメージから取り出して使うと LCD に起動ロゴとメッセージが出せます。
LicheePi Nano
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 5.2.0-F1C100s (masato@hp800) (gcc version 8.3.0 (Buildroot 2019.05.1)) #1 Sun Sep 1
9 15:23:04 JST 2021
[    0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=0005317f
[    0.000000] CPU: VIVT data cache, VIVT instruction cache
[    0.000000] OF: fdt: Machine model: Lichee Pi Nano
[    0.000000] Memory policy: Data cache writeback
[    0.000000] On node 0 totalpages: 8192
[    0.000000]   Normal zone: 64 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 8192 pages, LIFO batch:0
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0 
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 8128
[    0.000000] Kernel command line: fbcon=map:10 fbcon=font:MINI4x6 console=ttyS0,115200 panic=5 rootwait root=/
dev/mmcblk0p2 rw
[    0.000000] Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.000000] Memory: 22692K/32768K available (6144K kernel code, 246K rwdata, 1532K rodata, 1024K init, 228K b
ss, 10076K reserved, 0K cma-reserved, 0K highmem)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000] random: get_random_bytes called from start_kernel+0x254/0x42c with crng_init=0
[    0.000048] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[    0.000129] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[    0.000653] Console: colour dummy device 80x30
[    0.000747] Calibrating delay loop... 203.16 BogoMIPS (lpj=1015808)
[    0.070259] pid_max: default: 32768 minimum: 301
[    0.070679] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.070720] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.072358] CPU: Testing write buffer coherency: ok
[    0.074252] Setting up static identity map for 0x80100000 - 0x80100058
[    0.076455] devtmpfs: initialized
[    0.082704] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.082767] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.083053] pinctrl core: initialized pinctrl subsystem
[    0.085173] NET: Registered protocol family 16
[    0.086609] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.088624] cpuidle: using governor menu
[    0.138120] SCSI subsystem initialized
[    0.138497] usbcore: registered new interface driver usbfs
[    0.138647] usbcore: registered new interface driver hub
[    0.138833] usbcore: registered new device driver usb
[    0.139311] pps_core: LinuxPPS API ver. 1 registered
[    0.139337] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.139830] Advanced Linux Sound Architecture Driver Initialized.
[    0.141708] clocksource: Switched to clocksource timer
[    0.170649] NET: Registered protocol family 2
[    0.172329] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes)
[    0.172406] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.172459] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.172508] TCP: Hash tables configured (established 1024 bind 1024)
[    0.172793] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.172855] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.173348] NET: Registered protocol family 1
[    0.175867] NetWinder Floating Point Emulator V0.97 (double precision)
[    0.177942] Initialise system trusted keyrings
[    0.178468] workingset: timestamp_bits=30 max_order=13 bucket_order=0
[    0.205839] Key type asymmetric registered
[    0.205879] Asymmetric key parser 'x509' registered
[    0.206055] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
[    0.206085] io scheduler mq-deadline registered
[    0.206105] io scheduler kyber registered
[    0.208582] sun4i-usb-phy 1c13400.phy: Couldn't request ID GPIO
[    0.219336] suniv-f1c100s-pinctrl 1c20800.pinctrl: initialized sunXi PIO driver
[    0.415191] Serial: 8250/16550 driver, 8 ports, IRQ sharing disabled
[    0.420742] suniv-f1c100s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pe not found, using dummy regul
ator
[    0.422565] printk: console [ttyS0] disabled
[    0.442811] 1c25000.serial: ttyS0 at MMIO 0x1c25000 (irq = 23, base_baud = 6250000) is a 16550A
[    0.820839] printk: console [ttyS0] enabled
[    0.829089] suniv-f1c100s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pd not found, using dummy regul
ator
[    0.847965] SCSI Media Changer driver v0.25 
[    0.853662] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    0.860193] ehci-platform: EHCI generic platform driver
[    0.865817] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    0.872125] ohci-platform: OHCI generic platform driver
[    0.877758] usbcore: registered new interface driver usb-storage
[    0.884842] i2c /dev entries driver
[    0.890127] suniv-f1c100s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pf not found, using dummy regul
ator
[    0.928178] sunxi-mmc 1c0f000.mmc: initialized, max. request size: 16384 KB
[    0.937572] usbcore: registered new interface driver usbhid
[    0.943261] usbhid: USB HID core driver
[    0.960937] usbcore: registered new interface driver snd-usb-audio
[    0.974050] sun4i-codec 1c23c00.codec: Codec <-> 1c23c00.codec mapping ok
[    0.989767] NET: Registered protocol family 17
[    0.994454] Key type dns_resolver registered
[    1.001147] Loading compiled-in X.509 certificates
[    1.017650] suniv-f1c100s-pinctrl 1c20800.pinctrl: 1c20800.pinctrl supply vcc-pd not found, using dummy regul
ator
[    1.029026] sun4i-backend 1e60000.display-backend: Couldn't find matching frontend, frontend features disable
d
[    1.039874] sun4i-drm display-engine: bound 1e60000.display-backend (ops 0xc07385d4)
[    1.048948] sun4i-drm display-engine: bound 1c0c000.lcd-controller (ops 0xc073722c)
[    1.056729] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[    1.063386] [drm] No driver support for vblank timestamp query.
[    1.071109] [drm] Initialized sun4i-drm 1.0.0 20150629 for display-engine on minor 0
[    1.129075] Console: switching to colour frame buffer device 60x34
[    1.129548] mmc0: host does not support reading read-only switch, assuming write-enable
[    1.133503] mmc0: new high speed SDHC card at address aaaa
[    1.137021] mmcblk0: mmc0:aaaa SL16G 14.8 GiB 
[    1.161218]  mmcblk0: p1 p2
[    1.177320] sun4i-drm display-engine: fb0: sun4i-drmdrmfb frame buffer device
[    1.186129] usb_phy_generic usb_phy_generic.0.auto: usb_phy_generic.0.auto supply vcc not found, using dummy 
regulator
[    1.198239] musb-hdrc musb-hdrc.1.auto: MUSB HDRC host driver
[    1.204166] musb-hdrc musb-hdrc.1.auto: new USB bus registered, assigned bus number 1
[    1.214704] hub 1-0:1.0: USB hub found
[    1.218621] hub 1-0:1.0: 1 port detected
[    1.224929] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[    1.243288] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[    1.250059] ALSA device list:
[    1.253169]   #0: Loopback 1
[    1.256054]   #1: F1C100s Audio Codec
[    1.260788] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
[    1.269514] cfg80211: failed to load regulatory.db
[    1.439547] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[    1.447950] VFS: Mounted root (ext4 filesystem) on device 179:2.
[    1.455782] devtmpfs: mounted
[    1.461561] random: fast init done
[    1.467097] Freeing unused kernel memory: 1024K
[    1.471829] Run /sbin/init as init process
[    1.679259] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[    2.064669] udevd[103]: starting version 3.2.7
[    2.113284] random: udevd: uninitialized urandom read (16 bytes read)
[    2.140151] random: udevd: uninitialized urandom read (16 bytes read)
[    2.160916] random: udevd: uninitialized urandom read (16 bytes read)
[    2.190509] udevd[103]: specified group 'kvm' unknown
[    2.274016] udevd[104]: starting eudev-3.2.7
[    9.433349] urandom_read: 1 callbacks suppressed
[    9.433374] random: dd: uninitialized urandom read (512 bytes read)
[   14.043457] random: crng init done
[   27.761815] usb 1-1: new low-speed USB device number 2 using musb-hdrc
[   27.974506] input: Lite-On Technology Corp. ThinkPad USB Keyboard with TrackPoint as /devices/platform/soc/1c
13000.usb/musb-hdrc.1.auto/usb1/1-1/1-1:1.0/0003:17EF:6009.0001/input/input0
[   28.059915] hid-generic 0003:17EF:6009.0001: input: USB HID v1.10 Keyboard [Lite-On Technology Corp. ThinkPad
 USB Keyboard with TrackPoint] on usb-musb-hdrc.1.auto-1/input0
[   28.115717] input: Lite-On Technology Corp. ThinkPad USB Keyboard with TrackPoint Mouse as /devices/platform/
soc/1c13000.usb/musb-hdrc.1.auto/usb1/1-1/1-1:1.1/0003:17EF:6009.0002/input/input1
[   28.135849] input: Lite-On Technology Corp. ThinkPad USB Keyboard with TrackPoint System Control as /devices/
platform/soc/1c13000.usb/musb-hdrc.1.auto/usb1/1-1/1-1:1.1/0003:17EF:6009.0002/input/input2
[   28.223122] input: Lite-On Technology Corp. ThinkPad USB Keyboard with TrackPoint Consumer Control as /device
s/platform/soc/1c13000.usb/musb-hdrc.1.auto/usb1/1-1/1-1:1.1/0003:17EF:6009.0002/input/input3
[   28.252473] hid-generic 0003:17EF:6009.0002: input,hiddev0: USB HID v1.10 Mouse [Lite-On Technology Corp. Thi
nkPad USB Keyboard with TrackPoint] on usb-musb-hdrc.1.auto-1/input1
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?