User Tools

Site Tools


hardwarerelated:raspberry_pi_4

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
hardwarerelated:raspberry_pi_4 [2019/11/24 08:51]
chris
hardwarerelated:raspberry_pi_4 [2020/05/31 03:26] (current)
chris [Which OS to run?]
Line 1: Line 1:
-==== Sensors/​addon list ==== +===== Which OS to run? ===== 
-  * Raspberry Pi USB-C power supply 5,1V / 3,0A, EU +  * **Raspbian** 
-  Micro HDMI Adaptercable D-Stecker -A-Buchse 15cm schwarz +    is easiest to setup, and most widely used 
-  4 teiliges Kühlkörper Set für Raspberry Pi 4, silber ([[https://​www.amazon.de/dp/B07VFYHCJZ|amazon]]) +    * [[https://​www.raspberrypi.org/forums/viewtopic.php?​f=117&​t=275370|Raspberry Pi OS (64 bit) beta test version]] 
-  * Raspberry Pi 4 B2GB RAM +  * **Fedora32** 
-  HC-SR501 PIR Sensor -Infrarot Bewegungsmelder ​[[https://www.berrybase.de/raspberry-pi-co/​raspberry-pi/module-sensoren/hc-sr501-pir-sensor-infrarot-bewegungsmelder|link]] +    * Runs nicely[[/​software/​fedora/​fedora32_on_raspi4|here is how to setup]] 
-  * Feuchtigkeitssensor mit digitalem und analogem Ausgang ​[[https://www.berrybase.de/raspberry-pi-co/raspberry-pi/module-sensoren/​feuchtigkeitssensor-mit-digitalem-und-analogem-ausgang|link]] +    * This provides the pure 64bit aarch userland, ontop of the RaspiOS kernel. The RaspiOS kernel can be recompiled on Fedora64. 
-  * Lichtsensor mit digitalem Ausgang ​[[https://www.berrybase.de/raspberry-pi-co/​raspberry-pi/module-sensoren/​lichtsensor-mit-digitalem-ausgang|link]] +    ​* [[https://fedoraproject.org/​wiki/​Architectures/​ARM/​Raspberry_Pi#​Raspberry_Pi_4|official Fedora/pi4 status]] 
-  RFID Lesegerät mit SPI Schnittstelle inklKarte Dongle ([[https://www.berrybase.de/raspberry-pi-co/raspberry-pi/module-sensoren/rfid-leseger-228-t-mit-spi-schnittstelle-inkl.-karte-dongle|link]]) +    * [[https://​medium.com/ironhaul/​installing-64-bit-fedora-on-the-raspberry-pi-4-d4a665ea65d3|creating a Fedora32 image for raspi4, Ansible playbook based]] 
-  PCF8591 ADDA Konverter Modul [[https://​www.berrybase.de/raspberry-pi-co/raspberry-pi/module-sensoren/pcf8591-ad/da-konverter-modul|link]] +  * **Centos** images exist 
-  * 2.9" 296×128 ePaper Display Modul mit SPI Interfacedreifarbig ​(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]]+    * [[https://people.centos.org/pgreco/CentOS-Userland-7-aarch64-RaspberryPI-Minimal-4-1908/|Centos 7 userland 4raspi4 image]] [[https://people.centos.org/pgreco/​CentOS-Userland-8-stream-aarch64-RaspberryPI-Minimal-4/|Centos 8 userland 4raspi4 image]] 
 +    [[https://​wiki.centos.org/​SpecialInterestGroup/​AltArch/​armhfp?​action=show&redirect=SpecialInterestGroup%2FAltArch%2FArm32|setup details 1]], [[https://forums.centos.org/viewtopic.php?​f=49&​t=71407|setup details 2]] 
 +  * **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|Android]] ​it's flagged "for devs"​ 
 + 
 +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 availablethere is Linux support.  
 +    * [[https://​mzyy94.com/​blog/​2020/​04/​10/​raspberrypi-hdmi-input/​|Project idea (Japanese)]], [[https://world.taobao.com/item/602390051699.htm|the board I ordered]] 
 +  * 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]] 
 +  * [[https://​www.suse.com/media/article/​UEFI_on_Top_of_U-Boot.pdf|Doc from Andreas Färber, Alexander Graf, on what SuSE is doing regarding raspi4 boot]] 
 + 
 +===== 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.
  
-==== First steps after booting ====+Measuring size of your I/O requests:
 <​code>​ <​code>​
-ssh pi@<​ip>​+https://​github.com/​iovisor/​bcc 
 +dnf -y install bcc 
 +/​usr/​share/​bcc/​tools/​bitesize'​
  
-useradd -m chris +# Then perform your I/O intensive operation, for example: 
-passwd chris+dnf -y update
  
-sudo su +# Evaluation of my I/O for 'dnf update',​ computed over all processes:​ 
-echo "alias ll='ls -al'" >>/​etc/​bash.bashrc +         ​0 ​-> 1          : 2487         ​(7%) 
-echo "alias su='sudo su -'" ​>>/​etc/​bash.bashrc+         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 
 +</​code>​ 
 + 
 +===== Raspbian cheatsheet ===== 
 +<​code>​ 
 +### Installation,​ with sdcard in /​dev/​mmcblk0 
 +dd bs=4M if=2020-05-27-raspios-buster-lite-armhf.img of=/​dev/​mmcblk0 conv=fsync 
 +mount /​dev/​mmcblk0p1 /mnt/tmp 
 +touch /​mnt/​tmp/​SSH 
 +umount /mnt/tmp 
 + 
 +# Put the card into the raspi, boot it 
 +nmap -sP 192.168.0.0/​24 # find out IP 
 +# ssh <ip> / user pi / password raspberry 
 + 
 +cat >>​~/​.bashrc<<​EOT 
 +# extend prompt to have temperature 
 +export PS1='​[\u@\h \$(cut -b 1,2 /​sys/​devices/​virtual/​thermal/​thermal_zone0/​temp)°C \W]\$ ' 
 +# colored iostat output 
 +export S_COLORS=always 
 +alias ll='ls -al' 
 +export LC_ALL=en_GB.UTF-8 
 +EOT 
 + 
 +# I like gkrellm 
 +apt install ​ gkrellmd 
 +echo 'allow-host 192.168.0.2' >>/​etc/​gkrellmd.conf  
 +systemctl enable gkrellmd 
 +systemctl restart gkrellmd
  
 ### check cpu temperature ### check cpu temperature
Line 47: Line 117:
 apt install rpi-eeprom ​ apt install rpi-eeprom ​
 rpi-eeprom-update rpi-eeprom-update
 +
 +# If you want to try kernel 5.4
 +BRANCH=master rpi-update
 +# BRANCH=next rpi-update
 </​code>​ </​code>​
  
-==== Overheating issues ==== +===== Overheating issues ====
-  * My first use of the pi4 was in 32°C environment temperature,​ without passive or active cooling. After some minutes, the pi4 was no longer reachable via SSH. +Table below: 
-  * I had directly ordered a set of passive coolers with the pi4, I placed these 4 on the chips, but things got not much better+  * Raspbian, updates and firmware as of 2020-05-02 
-  * There is a firmware update (labelled 'alpha status'​),​ which enables apparently ASPM and lowers temperature by 3-5°C. ​[[https://​www.raspberrypi.org/​forums/viewtopic.php?​f=28&​t=243500&​p=1490467#​p1490467|Details are here]]+  * cpu temp: '​vcgencmd measure_temp'​ output 
 +  * cpu temp with load: 4x '​md5sum /​dev/​urandom'​ 
 + 
 +^cooling method ​                                               ^ambient air temp ^cpu temp idle ^cpu temp with load ^ 
 +|[[https://​www.amazon.de/​dp/​B07VFYHCJZ|passive heat spreader]] |28°C ​            ​|52°C ​         |78°C ​              | 
 +|[[https://​www.amazon.de/​dp/​B07VFYHCJZ|passive heat spreader]] |24°C ​            ​|47°C ​         |73°C ​              | 
 +|none                                                          |26°C ​            ​|47°C ​         |78°C ​              | 
 +|[[https://​www.amazon.co.jp/​gp/​product/​B07X47L6DD/​|Geekworm Raspberry pi 4]]|26°C |39°C ​        ​|45°C ​              |  
 + 
 +  * My first use of the pi4 was in 32°C environment temperature,​ without passive or active cooling. After some minutes, the pi4 was no longer reachable via SSH. Firmware updates improved the situation
 +  * [[https://​www.martinrowan.co.uk/​2019/​06/​raspberry-pi-4-hot-new-release-too-hot-to-use-enclosed/​|hints]] 
 +  * [[https://​www.raspberrypi.org/​documentation/configuration/​config-txt/​overclocking.md|boot option details]]
   * Underclocking could be an option:   * Underclocking could be an option:
 <​code>​ <​code>​
Line 64: Line 149:
 # then reboot # then reboot
 </​code>​ </​code>​
-  * [[https://​www.martinrowan.co.uk/​2019/​06/​raspberry-pi-4-hot-new-release-too-hot-to-use-enclosed/​|hints]] 
-  * [[https://​www.raspberrypi.org/​documentation/​configuration/​config-txt/​overclocking.md|boot option details]] 
- 
-==== benchmarking ==== 
-  * microsd-cards [[https://​www.jeffgeerling.com/​blog/​2018/​raspberry-pi-microsd-card-performance-comparison-2018|comparison 2019]] [[https://​www.jeffgeerling.com/​blog/​2019/​raspberry-pi-microsd-card-performance-comparison-2019|comparison 2019]] 
-  * https://​www.cnx-software.com/​2019/​06/​24/​raspberry-pi-4-benchmarks-mini-review/​ 
  
-==== benchmark results ​==== +===== Using 2.9“ 296×128 ePaper Display Modue/SPI Interface ​===== 
-^                        ^raspberry pi 4^Nintendo switch ​    ​^Thinkpad L480 ^percentages^ +My initial ​issue: ​I did not get any output from the device. After recompiling the demo-app with DEBUG, I got this:
-|ram                     ​|2GB ​          ​|4GB ​                ​|8GB ​          ​| ​          | +
-|price ​                  ​|50€ ​          ​|300€ ​               |950€ ​         |           | +
-|distro ​                 |raspbian ​     |Fedora 30           ​|Fedora 30     ​| ​          | +
-|kernel ​                 |4.19.58-v7l+ ​ |4.9.109+ (L4T kernel)|5.2.5-200.fc30| ​         | +
-|cpu                     |ARM Cortex-A72|ARM Cortex-A57 ​     |Intel i5-8250U| ​          | +
-|cpu frequency ​          ​|500-1500Mhz ​  ​|200-2000Mhz ​        ​|400-3400Mhz ​  ​| ​          | +
-|sbc memcopy ​            ​|2470.8 MB/s   ​|2503.6 MB/s         ​|7274.4 MB/s   ​|34/​34/​100 ​ | +
-|sbc memset ​             |3330.4 MB/s   ​|3573.5 MB/s         ​|16014.3 MB/s  |21/​22/​100 ​ | +
-|7-zip score             ​|5728 ​         |6170                |11330 ​        ​|51/​54/​100 ​ | +
-|openssl aes-128-cbc 16b |62533k ​       |347783k ​            ​|776987k ​      ​|8/​45/​100 ​  | +
-|openssl aes-128-cbc 16kb|85235k ​       |912414k ​            ​|1263839k ​     |7/​72/​100 ​  | +
-|openssl aes-256-cbc 16kb|64918k ​       |642777k ​            ​|913708k ​      ​|7/​70/​100 ​  | +
- +
-  * I used [[https://​github.com/​ThomasKaiser/​sbc-bench|sbc-bench]],​ a nice benchmark for small boards, focusing on memory and cpu. sbc result details: [[http://​ix.io/​1RmS|raspi4]] [[http://​ix.io/​1Rnj|nintendo switch]] +
-  * percentages:​ this assumes the Thinkpad values as 100%, and computes the other values on base of that. +
-  * RAM size is not important for the tests which were performed, less than 2GB were used. +
-  * [[https://​fluxcoil.net/​project_ideas#​raspi4nintendo_switch_benchmarking|Further benchmarking ideas]] +
-  * sbc execution:​ +
-<​code>​ +
-wget https://​raw.githubusercontent.com/​ThomasKaiser/​sbc-bench/​master/​sbc-bench.sh +
-sudo /bin/bash ./​sbc-bench.sh -c +
-</​code>​ +
- +
-==== benchmarking future ==== +
-  * power: need a usb-c power meter for that +
-    * then compute how much electrical power is required for certain operations. +
-  * GPU: +
-    * would be especially interesting to also compare various 3D driver implementations. For example, 3D benchmarks running on horizon (Nintendos OS) and also on Linux/​switch. +
-    * It's hard to only measure the GPU. It's also a question of how good the 3D drivers are. +
-    * Benchmarks should include retro game emulation. Simply because it's a common use case for pi4 and switch/​Linux. bsnes and snes9x? +
-      * free snes rom? +
-    * geekbench +
- +
-==== using 2.9“ 296×128 ePaper Display Modue/SPI Interface ==== +
-My initial ​problem, ​I did not get any output from the device. After recompiling the demo-app with DEBUG, I got this:+
 <​code>​ <​code>​
 chris@raspberrypi:​~/​rpi/​RaspberryPi/​bcm2835 $ sudo ./epd  chris@raspberrypi:​~/​rpi/​RaspberryPi/​bcm2835 $ sudo ./epd 
Line 138: Line 182:
 </​code>​ </​code>​
  
-==== further ​==== +===== Sensors/​addon list ===== 
-  * [[http://retroflag.com/|retroflag]] cases do not support raspi4 as of 2019-09+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 
 +  * HC-SR501 PIR Sensor -Infrarot Bewegungsmelder [[https://​www.berrybase.de/​raspberry-pi-co/​raspberry-pi/​module-sensoren/​hc-sr501-pir-sensor-infrarot-bewegungsmelder|link]] 
 +  * Feuchtigkeitssensor mit digitalem und analogem Ausgang [[https://​www.berrybase.de/​raspberry-pi-co/​raspberry-pi/​module-sensoren/​feuchtigkeitssensor-mit-digitalem-und-analogem-ausgang|link]] 
 +  * Lichtsensor mit digitalem Ausgang [[https://​www.berrybase.de/​raspberry-pi-co/​raspberry-pi/​module-sensoren/​lichtsensor-mit-digitalem-ausgang|link]] 
 +  * 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 ===== 
 +<​code>​ 
 +# 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 
 +</​code>​ 
 + 
 +^                 ​^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) 
 + 
hardwarerelated/raspberry_pi_4.1574581914.txt · Last modified: 2019/11/24 08:51 by chris