Yapay zekâ tarafından English dilinden çevrildi ·
Emily’nin bahsettiği kısım da bunun bir parçası. Geri kalanı herkesi yakalayan Pi 3 UART karmaşası.Pi 3/4/Zero W’de iki UART var. ttyAMA0, kendi saatine sahip iyi olan PL011. ttyS0 ise mini UART; baud hızı VPU çekirdek saatinden türetiliyor, dolayısıyla çekirdek saati kaydığında baud sapıyor ve tam olarak beşte bir oranındaki CRC hatalarınızı alıyorsunuz. Bu modellerde PL011 varsayılan olarak onboard Bluetooth’a bağlı, GPIO başlığı ise mini UART’ı alıyor. /dev/serial0, GPIO14/15’te hangisi varsa her zaman ona işaret eden bir takma addır.Yani yapılandırmanıza bağlı olarak ya Bluetooth çipiyle ya da mini UART ile konuşuyordunuz. PL011’i başlığa geri verin:
# /boot/firmware/config.txt (Bookworm)
enable_uart=1
dtoverlay=disable-bt
sudo systemctl disable hciuart
# ve console=serial0,115200 satırını /boot/firmware/cmdline.txt dosyasından kaldırın
sudo reboot
Ardından betiğinizde /dev/serial0 dosyasını açın; başka bir modele geçerseniz de çalışmaya devam eder. Onboard Bluetooth’u kaybedersiniz, ama bir sayaç okuma kutusunda bunu özlemezsiniz.Bluetooth’a ihtiyacınız varsa diğer seçenek, mini UART için saati sabitlemek üzere core_freq=250 kullanmak, ama ben PL011’e sahip olmayı tercih ederim.
Emily’s bit is part of it. The rest is the Pi 3 UART shuffle, which catches everyone.
The Pi 3/4/Zero W have two UARTs. ttyAMA0 is the PL011, the good one with its own clock. ttyS0 is the mini UART, whose baud rate is derived from the VPU core clock, so when the core clock moves the baud drifts and you get exactly your one-in-five CRC errors. On those models the PL011 is wired to the onboard Bluetooth by default and the GPIO header gets the mini UART. /dev/serial0 is an alias that always points at whichever one is on GPIO14/15.
So depending on your config you were either talking to the Bluetooth chip or to the mini UART. Give the PL011 back to the header:
# /boot/firmware/config.txt (Bookworm)
enable_uart=1
dtoverlay=disable-bt
sudo systemctl disable hciuart
# and remove console=serial0,115200 from /boot/firmware/cmdline.txt
sudo reboot
Then open /dev/serial0 in your script, so it keeps working if you move to another model. You lose onboard Bluetooth, which on a meter-reading box you don’t miss.
If you need Bluetooth, the other option is core_freq=250 to pin the clock for the mini UART, but I’d rather have the PL011.

