Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
network_protocol_programming_lab:3_preparedebian [2020/03/23 11:20] – [Test] rathkenetwork_protocol_programming_lab:3_preparedebian [2022/04/14 16:51] (current) – [Final Test] fangenoorth
Line 1: Line 1:
 ====== Debian Preparation for PPL ====== ====== Debian Preparation for PPL ======
  
-===== Get Package Updates =====+===== Get PPL Files for BeagleBone Black =====
  
-All of the following commands assume to be the superuserTo become superuseryou have to enter the command:+First you need to download all the stuff for the PPL on the BeagleBone Black 
 +In the home directoryexecute the following command:
  
 <code bash> <code bash>
-sudo --H+wget http://kn-pr.tkn.tu-berlin.de/ppl/Beaglebone.tar.gz
 </code> </code>
  
-after booting the BeagleBone Black and logging in into the //debian// account.+If you are unsure in which directory you currently are, execute the ''cd'' command first. This will change into the home directory.
  
-Otherwise you have to prefix every command with the word //sudo//. E.g. instead entering the command //apt-get update// enter the command //sudo apt-get update//.+Now extract the archive by executing the command:
  
-Now, after you have become superuser, ist is good advice to update the operation system with new packages by entrain the command+<code bash> 
 +tar -xzf Beaglebone.tar.gz 
 +</code> 
 + 
 +You will see a new directory called Beaglebone, containing additional directories:
  
 <code bash> <code bash>
-apt-get update+ls Beaglebone 
 +dts  spi  SPI_test
 </code> </code>
  
-and+We will need these later. For now let's focus on the proper setup and configuration of the Debian operating system that is required for this lab. 
 + 
 + 
 +===== Update Packages ===== 
 + 
 +All of the following commands assume to be executed by the superuser. To become superuser, you have to enter the command:
  
 <code bash> <code bash>
-apt-get upgrade+sudo -s -H
 </code> </code>
  
-This ensured the the operation system is up do date.+after booting the BeagleBone Black and logging in into the //debian// account, whose default password is //temppwd//
 + 
 +Otherwise you have to prefix every command with the word //sudo//. E.g. instead entering the command //apt-get update// enter the command //sudo apt-get update//.
  
-Looking carefully at the output of the //apt-get upgrade// command, you will recognize that an error occurs upgrading the dnsmasq package. This will resultthat communication via the USB interface will not work correctly. To fix the error enter the following commands:+Nowafter you have become superuserit is a good advice to update the operating system with new packages by entering the commands:
  
 <code bash> <code bash>
-systemctl enable dnsmasq.service  +apt-get update 
-systemctl restart dnsmasq.service+apt-get upgrade
 </code> </code>
  
-If you have forgotten to enable the dnsmasq deamon, your host system will not obtain an IP address automatically after the next restart of the BeagleBone Black. In this case you have to assign an IP address manually.+This ensures the the operation system is up do date.
  
 ===== Install additional Packages ===== ===== Install additional Packages =====
Line 44: Line 57:
 </code> </code>
  
 +
 +===== Set Time Zone =====
 +
 +You may set the timezone to German standard time using the following command:
 +
 +<code bash>
 +timedatectl set-timezone Europe/Berlin
 +</code>
 +
 +Issue the ''timedatectl'' command without parameters to verify your system time. If it's not synchronized correctly, don't worry, it will eventually synchronize later.
  
 ===== Kernel Upgrade ===== ===== Kernel Upgrade =====
  
-at the time of writing this memo, the lastest kernel version of the Debian distribution was //4.4.68-ti-r112//. +At the time of writing this memo, the  kernel version included in the Debian image was //4.19.94-ti-r42//. 
-To get the latest stable kernel release, that mostly is a newer kernel than the kernel of the Debian distribution, do the following:+To update to the latest stable kernel release, that most likely is a newer kernel than the kernel of the Debian image, do the following:
  
 <code bash> <code bash>
Line 56: Line 79:
 </code> </code>
  
-Unfortunately, the is a bug in the kernel update script, resulting that the configuration file of dnsmasq server is wrong. To continue to use the USB interfaces for Internet access enter the following command: +Now boot the BeagleBone Black once again.
- +
-<code bash> +
-touch /etc/dnsmasq.d/.SoftAp0 +
-</code> +
- +
-This //touch// command creates an empty file, indicating not to change the dnsmasq configuration file at the boot process. Now boot the BeagleBone Black once again.+
  
 <code bash> <code bash>
Line 68: Line 85:
 </code> </code>
  
-After the reboot von in again. The cost of the command+After the reboot, let's check our new upgraded kernel:
  
 <code bash> <code bash>
 uname -a uname -a
-Linux beaglebone 4.4.155-ti-r155 #SMP Thu May 23 05:22:53 UTC 2019 armv7l GNU/Linux+Linux beaglebone 4.19.94-ti-r72 #1buster SMP PREEMPT Tue Mar 8 22:13:06 UTC 2022 armv7l GNU/Linux
 </code> </code>
  
-Now the kernel version //4.4.155-ti-r155// is installed.+Now the kernel version //4.19.94-ti-r72// is installed. 
 ===== Device tree modifications ===== ===== Device tree modifications =====
  
 ==== Device tree compiler and overlays ==== ==== Device tree compiler and overlays ====
  
-In PPL, we need an device tree overlay to enable the SPI controller and the PRU. Therefore a patched  device tree compiler is needed. An addition the device tree overlay blobs for the peripheral is helpful.+In PPL, we need to configure the device tree of the system. A device tree dynamically((dynamically in this context means without having to recompile the kernel)) describes which and how hardware is connected to the system. As we use the SPI protocol to communicate with the CC1200, we need to configure our hardware in a way that the kernel is able to communicate with the SPI controller and the PRU in the first placeThis can be done by loading so called device tree overlays which overwrite the default configuration done by the master device tree, which gets shipped by the kernel.
  
-To install these things go to directory:+In the following we will instruct the bootloader (called U-Boot) to load some device tree overlays during boot, which are required to configure the hardware peripherals to fit our needs. You will also compile and install a custom device tree overlay, which represents the actual wiring of the CC1200 to the BeagleBone's pins. This is required because there are multiple pins we could connect the CC1200 to and the kernel is unable to automatically discover these
 + 
 +In first versions the wiring was made by hand. Today an adapter card is used. The wiring is shown in Fig. 1 and described [[network_protocol_programming_lab:wiring_beaglebone_cc1200|here]]. 
 + 
 +<imgcaption image1 | Wireing of BeagleBone Black with CC1200>{{:network_protocol_programming_lab:beaglebone-cc1200.png}}</imgcaption> 
 + 
 +==== Disable HDMI ==== 
 +The pins of HDMI port are multiplexed with the pins of the SPI bus. In order to use the SPI bus, the HDMI pins must be disabled by uncommenting the following line in the file ///boot/uEnv.txt//:
  
 <code bash> <code bash>
-cd /opt/source/bb.org-overlays+disable_uboot_overlay_video=1
 </code> </code>
  
-Nowtest if the device tree compiler is installed:+==== Disable default pin configuration ==== 
 + 
 +Per default the pins of the BeagleBone Black are wired for universal usemeaning the pins are connected to the commonly used devices. This will result in an error, if loading your own device tree overlay. 
 + 
 +To disable universal use, comment out the following line in the file ///boot/uEnv.txt//
  
 <code bash> <code bash>
-dtc --version +enable_uboot_cape_universal=1
-Version: DTC 1.4.4+
 </code> </code>
  
-Update dtc by executing:+==== Reboot  and Test ==== 
 + 
 +To make the changes effective, reboot. 
 + 
 +To test that HDMI is disabled, execute the following command:
  
 <code bash> <code bash>
-./dtc-overlay.sh+grep "pin 41" /sys/kernel/debug/pinctrl/44e10800.pinmux-pinctrl-single/pins
 </code> </code>
  
-Install the device tree overlay blobs:+and look, that the output matches the following:
  
 <code bash> <code bash>
-./install.sh+pin 41 (PIN41) 44e108a4 0000002f pinctrl-single
 </code> </code>
  
-==== Disable HDMI ==== +If the Hex-code is not //0000002f// HDMI is still enabled. 
-The pins of HDMI are multiplexed with the pins of the SPIIn order to use the SPIthe HDMI pins must be disabled by uncommenting the following line in the file ///boot/uEnv.txt//:+ 
 +==== PRU Driver ==== 
 + 
 +((original source: https://elinux.org/Beagleboard:BeagleBoneBlack_Debian#U-Boot_PRU_Options)) 
 + 
 +The communication between the ARM host processor and the PRU (Programmable Realtime Unit) is implemented either by the Remoteproc-Driver or the UIO PRU driverPer default the Remoteproc driver is used. In this memoit will be described, how to enable the UIO PRU driver. 
 + 
 +After booting a fresh Debian image and executing the command:
  
 <code bash> <code bash>
-##BeagleBone Black: HDMI (Audio/Video) disabled: +lsmod 
-dtb=am335x-boneblack-emmc-overlay.dtb+ 
 +Module                  Size  Used by 
 +pru_rproc              28672  0 
 +irq_pruss_intc         20480  1 pru_rproc 
 +pruss                  16384  1 pru_rproc 
 +pm33xx                 16384 
 +wkup_m3_ipc            16384  1 pm33xx 
 +wkup_m3_rproc          16384  1 
 +remoteproc             57344  3 pru_rproc,wkup_m3_rproc,wkup_m3_ipc 
 +virtio                 16384  1 remoteproc 
 +pvrsrvkm              421888 
 +virtio_ring            28672  1 remoteproc 
 +pruss_soc_bus          16384  0 
 +usb_f_acm              16384  2 
 +u_serial               20480  3 usb_f_acm 
 +usb_f_ncm              28672  2 
 +usb_f_mass_storage     53248 
 +uio_pdrv_genirq        16384  0 
 +uio                    20480  1 uio_pdrv_genirq 
 +usb_f_rndis            32768  4 
 +u_ether                20480  2 usb_f_ncm,usb_f_rndis 
 +libcomposite           65536  18 usb_f_acm,usb_f_ncm,usb_f_mass_storage,usb_f_rndis
 </code> </code>
-==== Disable default pin configuration ==== 
  
-Per default the pins of the BeagleBone Black are wired for universal usemeaning the pins are connected to the common used devices. This will result in an error, if loading your own device tree overlay.+Looking at the output, it seems the UIO PRU driver (uio_pdrv_genirq) is already enabledbut this Assumption is wrong. It needs several steps to enable the driver.
  
-To disable universal use, change the following line in the file ///boot/uEnv.txt//+=== Enable UIO PRU driver === 
 + 
 +We need to instruct the bootloader to load the device tree overlay blob which enables the UIO driver. This can be done by uncommenting the the following line in the file ///boot/uEnv.txt//:
  
 <code bash> <code bash>
-cmdline=coherent_pool=1M net.ifnames=0 quiet cape_universal=enable+uboot_overlay_pru=/lib/firmware/AM335X-PRU-UIO-00A0.dtbo
 </code> </code>
  
-to+We should also disable the overlay for the unused rproc driver by commenting out the following line in the same file:
  
 <code bash> <code bash>
-cmdline=coherent_pool=1M net.ifnames=0 quiet +uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-19-TI-00A0.dtbo 
-</code>  +</code>
-==== Reboot  and Test ====+
  
-To make the changes effective, reboot. 
  
-To test, that the HDMI is disables execute the following command:+=== Disable the Remoteproc drivers === 
 + 
 +Finally the Remoteproc driver must be disabled by editing the file ///etc/modprobe.d/pruss-blacklist.conf// (create the file if it's not there). 
 + 
 +Remove the line '//blacklist uio_pruss//' and add the following lines:
  
 <code bash> <code bash>
-grep "pin 41"  /sys/kernel/debug/pinctrl/44e10800.pinmux/pins+blacklist pruss 
 +blacklist pruss_intc 
 +blacklist pru-rproc 
 +blacklist spidev
 </code> </code>
  
-and look, that the output matches the following:+Afterward reboot the Beaglebone Black.
  
 <code bash> <code bash>
-pin 41 (44e108a4.0) 0000002f pinctrl-single+reboot
 </code> </code>
  
-If the Hex-code is not //0000002f// the HDMI is still enabled.+=== Test UIO driver ===
  
-===== Enable UIO PRU Driver =====+To verify that the device tree modifications have been loaded correctly, execute:
  
-((original source: http://catch22.eu/beaglebone/beaglebone-pru-uio/))+<code bash> 
 +lsmod
  
-The communication between ARM host processor an the PRU (Programmable Realtime Unit) is implemented either by the Remoteproc-Driver or the UIO PRU Driver. Per default the Remoreproc-Driver is enabled. In this memoit will be describedhow to enable the UIO PRU Driver.+Module                  Size  Used by 
 +pm33xx                 16384 
 +wkup_m3_ipc            16384  1 pm33xx 
 +wkup_m3_rproc          16384  1 
 +remoteproc             57344  2 wkup_m3_rproc,wkup_m3_ipc 
 +virtio                 16384  1 remoteproc 
 +virtio_ring            28672  1 remoteproc 
 +pvrsrvkm              421888 
 +uio_pruss              16384  0 
 +usb_f_acm              16384  2 
 +u_serial               20480  3 usb_f_acm 
 +uio_pdrv_genirq        16384  0 
 +usb_f_ncm              28672  2 
 +uio                    20480  2 uio_pruss,uio_pdrv_genirq 
 +usb_f_mass_storage     53248 
 +usb_f_rndis            32768  4 
 +u_ether                20480  2 usb_f_ncm,usb_f_rndis 
 +libcomposite           65536  18 usb_f_acm,usb_f_ncm,usb_f_mass_storage,usb_f_rndis 
 +</code>
  
-After booting an fresh Debian image an executing the command:+Now only //UIO PRU// drivers are loaded and no //rproc// drivers. 
 + 
 + 
 +==== Install the PPL Device Tree Overlay ==== 
 + 
 +For PPL the CC1200 is connected to the SPI bus of the BeagleBone Black and the SPI bus is controlled by the PRU. 
 +Therefore we have to tell the Linux kernel how exactly the CC1200 is wired with the PRU and the system. This is described in a device tree overlay file which you have downloaded in the very first step of this chapter. Change to the directory where you have downloaded the ppl files to, e.g.:
  
 <code bash> <code bash>
-lsmod | grep uio +cd ~/Beaglebone/dts
-uio_pdrv_genirq         4243  0  +
-uio                    10972  1 uio_pdrv_genirq+
 </code> </code>
  
-and looking at the output, it seems, the UIO PRU Driver (uio_pdrv_genirq) is already been enabledBut this Assumption is wrong. It needs several steps to enable the driver: +Directory //dts// contains the file //BB-BONE-CC1200-00A0.dts//In this file the device tree modifications are included. To compile it to a binary file enter:
-==== Device tree modifications to enable UIO PRU driver ====+
  
-Go to the directory:+<code bash> 
 +dtc -O dtb -o  BB-BONE-CC1200-00A0.dtbo -b 0 -@ BB-BONE-CC1200-00A0.dts 
 +</code>
  
 +During the compilation you can safely ignore warnings like
 <code bash> <code bash>
-cd /opt/source/dtb-4.4-ti/+BB-BONE-CC1200-00A0.dtbo: Warning (unit_address_vs_reg): Node /fragment@0 has a unit name, but no reg property
 </code> </code>
  
-Nowmodify the file //src/arm/am335x-boneblack-emmc-overlay.dts// by uncommenting the UIO PRU part and commenting the the remoterpc part:+//dtc// is the device tree compilerwhich produces the bizarre overlay file //BB-BONE-CC1200-00A0.dtbo//. Next copy this file to the system firmware directory:
  
 <code bash> <code bash>
-/* #include "am33xx-pruss-rproc.dtsi" */ /* line 22 */ +cp BB-BONE-CC1200-00A0.dtbo /lib/firmware
-#include "am33xx-pruss-uio.dtsi"         /* line 32 *+</code>
-</code> +
  
-After editing is finished, compile the device tree files by+Now that we have compiled the device tree overlay and placed it in the right location, we have to instruct the bootloader to load this custom overlay. To do so open the file ///boot/uEnv.txt// and find the line:
  
 <code bash> <code bash>
-make +###Custom Cape 
-</code> +#dtb_overlay=/lib/firmware/<file8>.dtbo 
 +</code>
  
-and install the device tree binary by+Uncomment this line and edit it so that it loads our own device tree overlay blob:
  
 <code bash> <code bash>
-make install+dtb_overlay=/lib/firmware/BB-BONE-CC1200-00A0.dtbo
 </code> </code>
  
-In the last stepthe binary device tree must be enables in the file ///boot/uEnv.txt//+After thatreboot.
-If not already done look at [[network_protocol_programming_lab:3_preparedebian#Disable HDMI|Disable HDMI]].+
  
-==== Disabling the Remoteproc drivers ====+===== Final Test =====
  
-Finally the UIO PRU driver must be enables and the Remoteproc driver must be disables by +After all that is done we can do a final test to verify that all the hardware is configured correctly.
-editing the file ///etc/modprobe.d/pruss-blacklist.conf//.+
  
-Remove the line '//blacklist uio_pruss//' and add the following lines:+Execute the command as root and inspect its output:
  
 <code bash> <code bash>
-blacklist pruss +/opt/scripts/tools/version.sh | grep -i uboot
-blacklist pruss_intc +
-blacklist pru-rproc +
-blacklist spidev+
 </code> </code>
  
-Afterward reboot the Beaglebone Black.+It should look like the following:
  
-<code bash+<code> 
-reboot+UBOOT: Booted Device-Tree:[am335x-boneblack-uboot.dts] 
 +UBOOT: Loaded Overlay:[AM335X-PRU-UIO-00A0] 
 +UBOOT: Loaded Overlay:[BB-ADC-00A0.bb.org-overlays] 
 +UBOOT: Loaded Overlay:[BB-BONE-eMMC1-01-00A0.bb.org-overlays] 
 +uboot_overlay_options:[enable_uboot_overlays=1] 
 +uboot_overlay_options:[disable_uboot_overlay_video=1] 
 +uboot_overlay_options:[uboot_overlay_pru=/lib/firmware/AM335X-PRU-UIO-00A0.dtbo] 
 +uboot_overlay_options:[dtb_overlay=/lib/firmware/BB-BONE-CC1200-00A0.dtbo] 
 +cmdline:[console=ttyO0,115200n8 bone_capemgr.uboot_capemgr_enabled=1 root=/dev/mmcblk0p1 ro rootfstype=ext4 rootwait coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_quality=100 quiet]
 </code> </code>
  
-==== Test ==== +If you see any of the following lines in the outputsomething went wrong. Redo the above steps in this case.
- +
-To checkif the device tree file has been loaded correctly, execute  +
- +
-<code bash> +
-lsmod +
-Module                  Size  Used by +
-pvrsrvkm              445708  0  +
-uio_pruss               4387  0  +
-evdev                  14151  1  +
-uio_pdrv_genirq         4243  0  +
-uio                    10972  2 uio_pruss,uio_pdrv_genirq +
-usb_f_acm               8681  2  +
-u_serial               14137  3 usb_f_acm +
-usb_f_ecm              11448  2  +
-8021q                  24428  0  +
-garp                    7497  1 8021q +
-mrp                     9351  1 8021q +
-stp                     2622  1 garp +
-llc                     6287  2 stp,garp +
-usb_f_mass_storage     50793  2  +
-usb_f_rndis            26505  4  +
-u_ether                14733  2 usb_f_ecm,usb_f_rndis +
-libcomposite           54424  18 usb_f_acm,usb_f_ecm,usb_f_rndis,usb_f_mass_storage +
-tieqep                 10365 +
  
 +<code>
 +UBOOT: Booted Device-Tree:[am335x-boneblack-uboot-univ.dts]
 +UBOOT: Loaded Overlay:[AM335X-PRU-RPROC-4-19-TI-00A0]
 +UBOOT: Loaded Overlay:[BB-HDMI-TDA998x-00A0]
 +uboot_overlay_options:[uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-19-TI-00A0.dtbo]
 +uboot_overlay_options:[enable_uboot_cape_universal=1]
 </code> </code>
network_protocol_programming_lab/3_preparedebian.1584958850.txt.gz · Last modified: 2020/03/23 11:20 by rathke
CC Attribution-Noncommercial-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0