Current-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
raspberry pi zero W serial port overlay fun
[I posted this to port-arm around 4th July, but hasn't made it. Reposting
here in case useful...]
tl;dr On a raspberry pi zero W, updating the firmware allows the disable-bt
overlay to function resulting in a stable serial console.
Experimental method(!)
- grab https://nycdn.netbsd.org/pub/NetBSD-daily/HEAD/202207031950Z/evbarm-earmv6hf/binary/gzimg/rpi.img.gz
- gunzip / dd to card / remove "console=fb" from first line of cmdline.txt
- connect raspberry pi zero W 1.1 to serial port via pins 4,6,8,10 which boots
- watch output with tip & baud rate 115200
- all is well until /etc/rc.local is run, changing the cpu frequency,
which messes up the baud rate because the raspberry pi zero w, by
default, reserves its real UART for bluetooth, and attaches a "mini"
UART to the console, and this "mini" UART doesn't appear to have its
own clock:
...
[ 1.0000000] simplebus0 at armfdt0: Raspberry Pi Zero W Rev 1.1
...
[ 1.0000000] plcom0 at simplebus1: ARM PL011 UART
...
[ 1.0000000] com0 at simplebus1: BCM AUX UART, 1-byte FIFO
[ 1.0000000] com0: console
...
Starting local daemons:.
JRQ
܊VP�҇KZ�� � ���Q
At this point, we can either:
1) delete /etc/rc.local
2) try to make use of the "real" UART by disabling bluetooth
1) works, 2) would be nice.
2):
- create overlays directory in SD card's /boot partition:
mount /dev/sd0e /mnt
cd /mnt
mkdir overlays
cp /tmp/firmware/boot/overlays/disable-bt.dtbo overlays
- add "dtoverlay=disable-bt" to config.txt
- boot, but no change:
[ 1.0000000] com0 at simplebus1: BCM AUX UART, 1-byte FIFO
[ 1.0000000] com0: console
- Grab precompiled raspberry pi firmware:
cd /tmp
git clone --depth=1 https://github.com/raspberrypi/firmware.git
Compare disable-bt.dtb0 to rpi.img dtb using file:
/tmp/firmware/boot/overlays/disable-bt.dtbo: Device Tree Blob version 17, size=1073, boot CPU=0, string block size=145, DT structure block size=872
/mnt/dtb/bcm2835-rpi-zero-w.dtb: Device Tree Blob version 17, size=19566, boot CPU=0, string block size=1770, DT structure block size=16700
Same version, so looking hopeful.
- replace firmware:
mount /dev/sd0e /mnt
cd /mnt
for sfx in elf bin dat; do
rm *.${sfx}
cp /tmp/firmware/boot/*.${sfx} .
done;
rm dtb/*
cp /tmp/firmware/boot/bcm2708-rpi-zero-w.dtb dtb
NB in rpi.img.gz was called: bcm2835-rpi-zero-w.dtb, bcm2708, yet
dtc -I dtb -O dts ./boot/overlays/disable-bt.dtbo
shows
/dts-v1/;
/ {
compatible = "brcm,bcm2835";
...
Now, boot, and success!
[ 1.0000000] plcom0 at simplebus1: ARM PL011 UART
[ 1.0000000] plcom0: txfifo disabled
[ 1.0000000] plcom0: console
rpi# sysctl machdep.cpu.frequency
machdep.cpu.frequency.target = 1000
machdep.cpu.frequency.current = 1000
machdep.cpu.frequency.min = 700
machdep.cpu.frequency.max = 1000
machdep.cpu.frequency.available = 700 1000
and that is read over the working serial console.
BTW my impression is there is no bluetooth support, so we are not
missing anything by disabling it? (as opposed to miniuart-bt).
Cheers,
Patrick
Home |
Main Index |
Thread Index |
Old Index