LoginSignup
1
0

Raspberry Pi 5 の UART port を使ってみた

Posted at

Raspberry Pi 5 UART port

uart-connector.jpg

Raspberry Pi 5 には、これまでの Raspberry Pi には無かった UART connector がボード上に設置された。
このポートを使用することで、GPIO14, GPIO15を使うことなく、シリアルコンソールを出力できる。

1mmピッチ 3pin JST-SH オスヘッダー

この UART port を使用するためには、1mmピッチ 3pin JST-SH オスヘッダー が必要だ。純正品としては、Raspberry Pi Debug Probe にケーブルが付属する。
debug-probe.jpg
しかし、スイッチサイエンスでの販売価格は 2,302円、 秋月電子通商での販売価格は 2,380円とそこそこする。
すでにUSBシリアルを持っているなら、ケーブルだけ欲しいところである。

そこで、デンシ電気店でケーブルだけを購入した。396円とリーズナブル。
img58209.jpg
ただ一つ惜しいのが、ケーブルの先がオスである点。メスであれば、そのままUSBシリアルに挿すことができたのだが、オスであるため、ブレッドボードを経由するか、メスーメスのデュポンワイヤーで中継が必要となる。

config.txt 変更

uartとシリアルコンソールを使うパタメタを config.txt の最後に追加する。

/boot/firmware/config.txt
(略)

[all]

enable_uart=1
dtparam=uart0=on

接続

IMG_3045.png

下表の通り、UART port と USBシリアルを接続する。

pin# Raspi UART port ケーブル USBシリアル
1 TXD RXD
2 GND GND
3 RXD TXD
IMG_3047.png

シリアルコンソール

% screen /dev/cu.usbserial-120 115200

RPi: BOOTSYS release VERSION:4c845bd3 DATE: 2024/02/16 TIME: 15:28:41
BOOTMODE: 0x06 partition 0 build-ts BUILD_TIMESTAMP=1708097321 serial 2f0b1cb1 boardrev d04170 stc 1621846
AON_RESET: 00000003 PM_RSTS 00000020
RP1_BOOT chip ID: 0x20001927
PM_RSTS: 0x00000020
part 00000000 reset_info 00000000
PMIC reset-event 00000000 rtc 65e87207 alarm 00000000 enabled 0
uSD voltage 3.3V
Initialising SDRAM 'Micron' 32Gb x2 total-size: 64 Gbit 4267
DDR 4267 1 0 64 152
RP1_BOOT chip ID: 0x20001927

RP1_BOOT chip ID: 0x20001927
RP1_BOOT: fw size 25968
PCI2 init
PCI2 reset
PCIe scan 00001de4:00000001
RP1_CHIP_INFO 20001927

RPi: BOOTLOADER release VERSION:4c845bd3 DATE: 2024/02/16 TIME: 15:28:41
BOOTMODE: 0x06 partition 0 build-ts BUILD_TIMESTAMP=1708097321 serial 2f0b1cb1 boardrev d04170 stc 4613294
AON_RESET: 00000003 PM_RSTS 00000020
usb_pd_init status 3
USB_PD CONFIG 0 43
XHCI-STOP
xHC0 ver: 272 HCS: 03000440 140000f1 07ff000a HCC: 0240fe6d
USBSTS 1
xHC0 ver: 272 HCS: 03000440 140000f1 07ff000a HCC: 0240fe6d
xHC0 ports 3 slots 64 intrs 4
XHCI-STOP
xHC1 ver: 272 HCS: 03000440 140000f1 07ff000a HCC: 0240fe6d
USBSTS 1
xHC1 ver: 272 HCS: 03000440 140000f1 07ff000a HCC: 0240fe6d
xHC1 ports 3 slots 64 intrs 4
USB-PD: src-cap PDO object1 0x0a0191f4
Current 3000 mA
Voltage 5000 mV
USB-PD: src-cap PDO object2 0x0002d12c
Current 3000 mA
Voltage 9000 mV
USB-PD: src-cap PDO object3 0x0003c0e1
Current 2250 mA
Voltage 12000 mV
USB-PD: src-cap PDO object4 0x0004b0b4
Current 1800 mA
Voltage 15000 mV
Boot mode: SD (01) order f46
SD HOST: 200000000 CTL0: 0x00800000 BUS: 400000 Hz actual: 390625 HZ div: 512 (256) status: 0x1fff0000 delay: 276
SD HOST: 200000000 CTL0: 0x00800f00 BUS: 400000 Hz actual: 390625 HZ div: 512 (256) status: 0x1fff0000 delay: 276
EMMC
SD retry 1 oc 0
SD HOST: 200000000 CTL0: 0x00800000 BUS: 400000 Hz actual: 390625 HZ div: 512 (256) status: 0x1fff0000 delay: 276
SD retry 2 oc 0
SD HOST: 200000000 CTL0: 0x00800000 BUS: 400000 Hz actual: 390625 HZ div: 512 (256) status: 0x1fff0000 delay: 276
SDV1
SD CMD: 0x371a0010 (55) 0x0 0x1fff0001
Failed to open device: 'sdcard' (cmd 371a0010 status 1fff0001)
Retry SD 1
SD HOST: 200000000 CTL0: 0x00800000 BUS: 400000 Hz actual: 390625 HZ div: 512 (256) status: 0x1fff0000 delay: 276
SD HOST: 200000000 CTL0: 0x00800f00 BUS: 400000 Hz actual: 390625 HZ div: 512 (256) status: 0x1fff0000 delay: 276
EMMC
SD retry 1 oc 0
SD HOST: 200000000 CTL0: 0x00800000 BUS: 400000 Hz actual: 390625 HZ div: 512 (256) status: 0x1fff0000 delay: 276
SD retry 2 oc 0
SD HOST: 200000000 CTL0: 0x00800000 BUS: 400000 Hz actual: 390625 HZ div: 512 (256) status: 0x1fff0000 delay: 276
SDV1
SD CMD: 0x371a0010 (55) 0x0 0x1fff0001
Failed to open device: 'sdcard' (cmd 371a0010 status 1fff0001)
Boot mode: NVME (06) order f4
PCI1 init
PCI1 reset
PCIe scan 00001cc1:0000624a
VID 0x1cc1 MN ADATA LEGEND 700                       
NVME on
MBR: 0x00002000, 1048576 type: 0x0c
MBR: 0x00102000,499061424 type: 0x83
MBR: 0x00000000,       0 type: 0x00
MBR: 0x00000000,       0 type: 0x00
Trying partition: 0
type: 32 lba: 8192 'mkfs.fat' ' bootfs     ' clusters 130812 (8)
rsc 32 fat-sectors 1024 root dir cluster 2 sectors 0 entries 0
FAT32 clusters 130812
[nvme] autoboot.txt not found
Select partition rsts 0 C(boot_partition) 0 EEPROM config 0 result 0
Trying partition: 0
type: 32 lba: 8192 'mkfs.fat' ' bootfs     ' clusters 130812 (8)
rsc 32 fat-sectors 1024 root dir cluster 2 sectors 0 entries 0
FAT32 clusters 130812
Read config.txt bytes     1357 hnd 0x49fe
[nvme] pieeprom.upd not found
usb_max_current_enable default 0 max-current 5000
Read bcm2712-rpi-5-b.dtb bytes    76676 hnd 0x318
dt-match: compatible: raspberrypi,5-model-b match: brcm,bcm2712
dt-match: compatible: brcm,bcm2712 match: brcm,bcm2712

NOTICE:  BL31: v2.6(release):v2.6-239-g2a9ede0bd
NOTICE:  BL31: Built : 14:26:57, Jun 22 2023
[    9.256207] rc.local[1660]: My IP address is 192.168.21.135

Debian GNU/Linux 12 raspberrypi5 ttyAMA10

raspberrypi5 login: pi5
パスワード:
Linux raspberrypi5 6.1.0-rpi8-rpi-2712 #1 SMP PREEMPT Debian 1:6.1.73-1+rpt1 (2024-01-25) aarch64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
最終ログイン: 2024/03/06 (水) 22:39:39 JST 日時 tty1
pi5@raspberrypi5:~$ ps
    PID TTY          TIME CMD
   1771 ttyAMA10 00:00:00 bash
   1895 ttyAMA10 00:00:00 ps
pi5@raspberrypi5:~$ sudo poweroff
pi5@raspberrypi5:~$ [   63.725051] reboot: Power down

RPi: BOOTSYS release VERSION:4c845bd3 DATE: 2024/02/16 TIME: 15:28:41
BOOTMODE: 0x06 partition 63 build-ts BUILD_TIMESTAMP=1708097321 serial 2f0b1cb1 boardrev d04170 stc 1621846
AON_RESET: 00000003 PM_RSTS 00000575
RP1_BOOT chip ID: 0x20001927
Halt: power_off: 0

10秒足らずで起動します。さすがに Raspberry Pi 5 & SSD は早いですね。

1
0
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
1
0