===== Which OS to run? =====
* **Raspbian**
* is easiest to setup, and most widely used
* [[https://www.raspberrypi.com/software/operating-systems/|Raspberry Pi OS (64 bit)]]
* https://dietpi.com/ -- DietPi, streamlines Raspberry Pi OS, over/underclock options, logging to ram-fs by default and hourly sync
* **Fedora**
* [[/software/fedora/fedora_on_raspi4|Howto setup Fedora36 or rawhide]]
* [[https://fedoraproject.org/wiki/Architectures/ARM/Raspberry_Pi#Raspberry_Pi_4|official Fedora/pi4 status]]
* **Centos** images exist
* [[https://people.centos.org/pgreco/CentOS-Userland-8-stream-aarch64-RaspberryPI-Minimal-4/|Centos 8 userland 4raspi4 image]]
* **Debian**
* [[https://david.wragg.org/blog/2020/01/installing-64-bit-debian-on-rpi.html|Installing 64-bit Debian/Raspbian dualboot]] on a Raspberry Pi 4.
* Images can boot with kernel 5.5 and 5.6
* https://wiki.debian.org/RaspberryPi4 -- Debian status
* **Android**
* [[https://www.raspberrypi.org/forums/viewtopic.php?f=73&t=261228|Android9]] - it's flagged "for devs"
* [[https://forum.xda-developers.com/raspberry-pi/orig-development/omnirom-android-r-11-pi-4-t4183121?__cf_chl_jschl_tk__=fa65a5e876cd5aeb2ec1d994e795daee19027c26-1604566549-0-AQhGP6JhyEg5bjczrn6XuTshxUTr8jsaLb_A3yK6WVUa4Abzvoo5L20rr7w5ReVneUlvgNxCnTJtSQdW0amzIhVd7gxGs5vyVrCD3pSwkqDcbsV_1d-G7F4E5RWROLxlfIOWo_WoBB2jOp0SCWaNDFoJ0X6qR_0Sdr3ZAisxNNHy9YB7FNrfBrXlD-aCrj50MZ0mjyaLkl2k2orwmifMB7RM80aBT3UWepqmZ2EA7yXTnPjVDOpibr6e1786r8KykceASIgrq24vaAOiYWcqEN3nw8OaH5YamcSo5U3CHR3cMuESfCc5mdkhlWDRJxdedoRshzVypSa_xeMdQVX58ZYmIs2gh4WdMi5yDquhoE7clpJIE111W3IFoOjN54BkB2s9BmSrYOtraFsD7Wc87XWR5vKb46aWR2foDogrScki|Android11]] image
You can also put multiple OS's on one card, for example RaspiOS/Fedora32/Debian all together.
===== Links =====
* [[/software/benchmark/raspberry_pi_4|Some pi4 benchmarks]]
* Building a HDMI signal grabber with the raspi would be nice
* Toshiba TC358743 based addon boards for the raspi are available, there is Linux support.
* [[https://mzyy94.com/blog/2020/04/10/raspberrypi-hdmi-input/|Project idea (Japanese)]]
* How to [[https://www.hardill.me.uk/wordpress/2019/11/02/pi4-usb-c-gadget/#|run power/ethernet over a sincle usb-c cable to the raspi4]]
===== It feels slow! =====
How to distinguish which resource is under pressure? Measure. 'iostat' can show I/O load, vmstat/htop load on CPU.
* **CPU:**
* Buy good case/cooler
* consider overclocking
* 32bit or 64bit kernel? Depends on your application. Some results are [[https://github.com/ThomasKaiser/sbc-bench/blob/master/Results.md|better on the 32bit kernel]].
* **Network:**
* Verify gbit mode is properly set, with ethtool
* **I/O:** My first 'its slow' impression was from 'dnf -y update' updating 120 packages in ~40 minutes. CPUs not loaded, but storage was the issue: sdcards are optimized for big sequential load, not small random access. [[/software/benchmark/sdcards|Here]] are details. Just using a different sdcard, this went to 15minutes. Approaches to fix:
* Move the partition to USB3 connected devices (but USB flash can be as slow as sdcards. SSD are an option.)
* Move the part where I/O is done to NFS via ethernet, for example if kernel compilation is causing the load these directories can be moved.
* Buy sdcards doing well with random 4k access.
Measuring size of your I/O requests:
# https://github.com/iovisor/bcc
dnf -y install bcc
/usr/share/bcc/tools/bitesize'
# Then perform your I/O intensive operation, for example:
dnf -y update
# Evaluation of my I/O for 'dnf update', computed over all processes:
0 -> 1 : 2487 (7%)
2 -> 3 : 2327 (6%)
4 -> 7 : 19501 (54%)
8 -> 15 : 4443 (12%)
16 -> 31 : 3687 (10%)
32 -> 63 : 1979 (5%)
64 -> 127 : 371 (1%)
128 -> 255 : 223 (1%)
256 -> 511 : 514 (1%)
512 -> 1023 : 327 (1%)
1024 -> 2047 : 497 (1%)
=> So when looking at benchmarks, 4k random access is most interesting
===== Raspberry Pi OS cheatsheet =====
### Installation, with sdcard in /dev/mmcblk0,
### or usb3 connected nvme-enclosure
# https://www.raspberrypi.com/software/operating-systems/
xzcat 2023-05-03-raspios-bullseye-arm64-lite.img.xz | \
dd bs=4M of=/dev/mmcblk0 conv=fsync
mount /dev/mmcblk0p1 /mnt/tmp
# if the raspi should activate sshd
touch /mnt/tmp/SSH
vi /mnt/tmp/userconf.txt
# add here user + hashed password
# pattern: user:hashedpassword
# password hashing:
# echo 'mypassword' | openssl passwd -6 -stdin
# if resizing of the partition should be disabled
vi /mnt/tmp/cmdline.txt
# remove init=/usr/lib/raspi-config/init_resize.sh
umount /mnt/tmp
# Put the card into the raspi, boot it
nmap -sP 192.168.0.0/24 # find out IP
# ssh / user /password from userconf.txt
cat >>~/.bashrc<
===== Overheating issues =====
* cpu temp: 'vcgencmd measure_temp' output
* cpu temp with load: 4x 'md5sum /dev/urandom'
* [[https://www.amazon.co.jp/gp/product/B07X47L6DD/|Geekworm Raspberry pi 4]] is recommended
* [[https://www.raspberrypi.org/documentation/configuration/config-txt/overclocking.md|boot option details]]
* Underclocking could be an option:
vi /boot/config.txt
# in section [pi4] add
over_voltage=-1 # or "-2"
arm_freq=1250 # default is 1500Mhz
arm_freq_min=150 # also worth trying, default is 600Mhz
# then reboot
===== Using 2.9“ 296×128 ePaper Display Modue/SPI Interface =====
My initial issue: I did not get any output from the device. After recompiling the demo-app with DEBUG, I got this:
chris@raspberrypi:~/rpi/RaspberryPi/bcm2835 $ sudo ./epd
2.9inch e-Paper demo
bcm2835 init success !!!
Debug: e-Paper busy
^C
Handler:Goto Sleep mode
chris@raspberrypi:~/rpi/RaspberryPi/bcm2835 $
Tried out:
* Ensure that spi devices are activated in /boot/config.txt: "dtparam=spi=on"
* running rpi-update
* updating kernel and system with "apt-get update; apt-get dist-upgrade"
* doublechecking the connected pins
* running raspi-config, to activate SPI
* https://www.waveshare.com/wiki/2.9inch_e-Paper_Module https://www.waveshare.com/w/upload/9/98/2.9inch-e-paper-module-user-manual-en.pdf
* The code from the upstream git repo works for me:
git clone https://github.com/waveshare/e-Paper
cd e-Paper/RaspberryPi&JetsonNano/c
vi examples/main.c
# // EPD_2in9_test();
# // EPD_2in9bc_test();
# EPD_2in9d_test();
# and then run 'epd'
sudo ./epd
# this finally works for me
===== Sensors/addon list =====
List of the hardware/sensors I got.
* Raspberry Pi USB-C power supply 5,1V / 3,0A, EU
* Micro HDMI Adaptercable D-Stecker -A-Buchse 15cm schwarz
* 4 teiliges Kühlkörper Set für Raspberry Pi 4, silber ([[https://www.amazon.de/dp/B07VFYHCJZ|amazon]])
* Raspberry Pi 4 B, 2GB RAM
* RFID Lesegerät mit SPI Schnittstelle inkl. Karte & Dongle ([[https://www.berrybase.de/raspberry-pi-co/raspberry-pi/module-sensoren/rfid-leseger-228-t-mit-spi-schnittstelle-inkl.-karte-dongle|link]])
* PCF8591 AD/ DA Konverter Modul [[https://www.berrybase.de/raspberry-pi-co/raspberry-pi/module-sensoren/pcf8591-ad/da-konverter-modul|link]]
* 2.9" 296×128 ePaper Display Modul mit SPI Interface, dreifarbig (rot, schwarz, weiß) [[https://www.berrybase.de/raspberry-pi-co/raspberry-pi/module-sensoren/2.9-296-215-128-epaper-display-modul-mit-spi-interface-dreifarbig-40-rot-schwarz-wei-223-4|link]] [[https://www.waveshare.com/wiki/2.9inch_e-Paper_Module|docs]]
===== Configuring network over usb-c =====
# https://www.raspberrypi.org/forums/viewtopic.php?t=245810
vi /boot/config.txt
# add: dtoverlay=dwc2
vi /boot/cmdline.txt
# add: modules-load=dwc2,g_ether
reboot
ifconfig -a # should show interface usb0
ip addr add 192.168.1.4/24 dev usb0
ip link set up dev usb0
# on the opposite system
ip addr add 192.168.1.4/24 dev enp0s20f0u1i1
ip link set up dev enp0s20f0u1i1
^ ^latency: ICMP RTT^bandwidth ^
|usb-c network |0.2-0.3ms |down 140mbit/s / up 187mbit/s|
|pi4 gbit ethernet|0.24-0.3ms |down 764mbit/s / up 914mbit/s|
* latency, ICMP RTT: 0.2-0.3ms (gbit ethernet: 0.24-0.3ms)
* bandwidth: 16mbyte/sec down / 22mbyte/sec up (gbit ethernet: 90mbyte/sec down / 50mbyte/sec up)