Raspberry Pi Zero Serial console
Raspberry Pi Serial
Raspberry Pi の40pin headerにserial/UART pin が出ている。
しかし、Zero W, Pi 3B+ではdefaultでBluetoothがシリアルに接続されるため、競合によりシリアルケーブルを接続しただけでは安定動作しない。
zero w及びPi3B+のシリアル設定
下記のファイルを編集する。
- /boot/config.txt
- /boot/cmdline.xt
config.txt
下記を追加。
dtoverlay=pi3-miniuart-bt
cmdline.txt
下記は不要がしれない。
dwc_otg.lpm_enable=0 console=tty1 console=serial0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
シリアルケーブル接続
シリアルケーブルを接続する。
pi | pi signal | cable siblgnal |
---|---|---|
2 | 5V | VCC |
6 | GND | GND |
8 | Tx | Rx |
10 | Rx | Tx |
pi pinは、GPIO Header pin 番号を示す。
なお、上記はシリアルケーブルから電力を供給する前提であり、USB microBコネクタから電力を供給する場合は、2pin/5Vを外す。
初回のid
- ID : pi
- PW : raspberry
Bluetoothを活かす方法
config.txtに core_freq=250を追加する。若干性能が落ちるらしい。
http://www.neko.ne.jp/~freewing/raspberry_pi/raspberry_pi_3_uart_with_bluetooth/
補足
Piには2つのシリアルがある。
- PL011 : 6 signal serialに対応。デフォルトで、上記シリアルピンに割当。
- mini uart : 簡易uart。
mini uartは、CPU Clockを元にシリアル周波数を設定しており、負荷によりクロックの変わるpiでは、baud rateが動的に変わり不安定になる。
dtoverlayでbluetoothにmini uartを割り当てており、そのままではbluetoothが使えない。そこで、Bluetoothを使うには前記のおまじないが必要になる。
ref
W のシリアル
http://akkagi.info/20161004_web/
https://learn.adafruit.com/raspberry-pi-zero-creation/give-it-life
PL011, miniuart and Bluetooth
https://www.raspberrypi.org/documentation/configuration/uart.md