Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| network_protocol_programming_lab:3_preparedebian [2020/03/23 11:23] – [Test] rathke | network_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 | + | First you need to download all the stuff for the PPL on the BeagleBone Black. | 
| + | In the home directory, execute | ||
| <code bash> | <code bash> | ||
| - | sudo -s -H | + | wget http://kn-pr.tkn.tu-berlin.de/ | 
| </ | </ | ||
| - | after booting the BeagleBone Black and logging | + | If you are unsure | 
| - | Otherwise you have to prefix every command with the word //sudo//. E.g. instead entering the command //apt-get update// enter the command | + | Now extract | 
| - | Now, after you have become superuser, ist is a good advice to update the operation system with new packages by entrain the command | + | <code bash> | 
| + | tar -xzf Beaglebone.tar.gz | ||
| + | </ | ||
| + | |||
| + | You will see a new directory called Beaglebone, containing additional directories: | ||
| <code bash> | <code bash> | ||
| - | apt-get update | + | ls Beaglebone | 
| + | dts spi SPI_test | ||
| </ | </ | ||
| - | 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 | 
| </ | </ | ||
| - | This ensured | + | after booting | 
| + | |||
| + | 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 result, that communication via the USB interface will not work correctly. To fix the error enter the following | + | Now, after you have become superuser, it is a good advice to update | 
| <code bash> | <code bash> | ||
| - | systemctl enable dnsmasq.service | + | apt-get update | 
| - | systemctl restart dnsmasq.service | + | apt-get upgrade | 
| </ | </ | ||
| - | If you have forgotten to enable | + | This ensures | 
| ===== Install additional Packages ===== | ===== Install additional Packages ===== | ||
| Line 44: | Line 57: | ||
| </ | </ | ||
| + | |||
| + | ===== Set Time Zone ===== | ||
| + | |||
| + | You may set the timezone to German standard time using the following command: | ||
| + | |||
| + | <code bash> | ||
| + | timedatectl set-timezone Europe/ | ||
| + | </ | ||
| + | |||
| + | Issue the '' | ||
| ===== Kernel Upgrade ===== | ===== Kernel Upgrade ===== | ||
| - | at the time of writing this memo, the lastest | + | At the time of writing this memo, the  kernel version | 
| - | To get the latest stable kernel release, that mostly | + | To update to the latest stable kernel release, that most likely | 
| <code bash> | <code bash> | ||
| Line 56: | Line 79: | ||
| </ | </ | ||
| - | Unfortunately, | + | Now boot the BeagleBone Black once again. | 
| - | + | ||
| - | <code bash> | + | |
| - | touch / | + | |
| - | </ | + | |
| - | + | ||
| - | This //touch// command creates an empty file, indicating not to change the dnsmasq configuration file at the boot process. | + | |
| <code bash> | <code bash> | ||
| Line 68: | Line 85: | ||
| </ | </ | ||
| - | After the reboot | + | 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 #1 SMP Thu May 23 05:22:53 UTC 2019 armv7l GNU/Linux | + | Linux beaglebone 4.19.94-ti-r72 #1buster | 
| </ | </ | ||
| - | 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 | + | In PPL, we need to configure the device tree of the system. A device tree dynamically((dynamically in this context means without having | 
| - | To install | + | 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 | 
| - | <code bash> | + | 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: | 
| - | cd / | + | |
| - | </ | + | |
| - | Now, test if the device tree compiler is installed: | + | < | 
| + | |||
| + | ==== 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 /// | ||
| <code bash> | <code bash> | ||
| - | dtc --version | + | disable_uboot_overlay_video=1 | 
| - | Version: DTC 1.4.4 | + | |
| </ | </ | ||
| - | Update dtc by executing: | + | ==== Disable default pin configuration ==== | 
| + | |||
| + | Per default the pins of the BeagleBone Black are wired for universal use, meaning 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 /// | ||
| <code bash> | <code bash> | ||
| - | ./ | + | enable_uboot_cape_universal=1 | 
| </ | </ | ||
| - | Install | + | ==== Reboot | 
| + | |||
| + | To make the changes effective, reboot. | ||
| + | |||
| + | To test that HDMI is disabled, execute the following command: | ||
| <code bash> | <code bash> | ||
| - | ./install.sh | + | grep "pin 41" | 
| </ | </ | ||
| - | ==== Disable HDMI ==== | + | and look, that the output matches | 
| - | The pins of HDMI are multiplexed with the pins of the SPI. In order to use the SPI, the HDMI pins must be disabled by uncommenting | + | |
| <code bash> | <code bash> | ||
| - | ## | + | pin 41 (PIN41) 44e108a4 0000002f pinctrl-single | 
| - | dtb=am335x-boneblack-emmc-overlay.dtb | + | |
| </ | </ | ||
| - | ==== Disable default pin configuration ==== | ||
| - | Per default | + | If the Hex-code is not // | 
| - | To disable universal use, change the following line in the file /// | + | ==== PRU Driver ==== | 
| - | <code bash> | + | ((original source: https:// | 
| - | cmdline=coherent_pool=1M net.ifnames=0 quiet cape_universal=enable | + | |
| - | </code> | + | |
| - | to | + | The communication between the ARM host processor and the PRU (Programmable Realtime Unit) is implemented either by the Remoteproc-Driver or the UIO PRU driver. Per default the Remoteproc driver is used. In this memo, it will be described, how to enable the UIO PRU driver. | 
| + | |||
| + | After booting a fresh Debian image and executing the command: | ||
| <code bash> | <code bash> | ||
| - | cmdline=coherent_pool=1M net.ifnames=0 quiet | + | lsmod | 
| - | </ | + | |
| - | ==== Reboot | + | |
| - | To make the changes effective, reboot. | + | Module | 
| + | pru_rproc | ||
| + | irq_pruss_intc | ||
| + | pruss 16384 1 pru_rproc | ||
| + | pm33xx | ||
| + | wkup_m3_ipc | ||
| + | wkup_m3_rproc | ||
| + | remoteproc | ||
| + | virtio | ||
| + | pvrsrvkm | ||
| + | virtio_ring | ||
| + | pruss_soc_bus | ||
| + | usb_f_acm | ||
| + | u_serial | ||
| + | usb_f_ncm | ||
| + | usb_f_mass_storage | ||
| + | uio_pdrv_genirq | ||
| + | uio 20480 1 uio_pdrv_genirq | ||
| + | usb_f_rndis | ||
| + | u_ether | ||
| + | libcomposite | ||
| + | </ | ||
| + | |||
| + | Looking at the output, it seems the UIO PRU driver (uio_pdrv_genirq) is already enabled, but this Assumption is wrong. It needs several steps to enable the driver. | ||
| + | |||
| + | === Enable UIO PRU driver === | ||
| - | To test, that the HDMI is disables execute | + | We need to instruct the bootloader to load the device tree overlay blob which enables the UIO driver. This can be done by uncommenting | 
| <code bash> | <code bash> | ||
| - | grep "pin 41" | + | uboot_overlay_pru=/lib/firmware/AM335X-PRU-UIO-00A0.dtbo | 
| </ | </ | ||
| - | and look, that the output matches | + | We should also disable | 
| <code bash> | <code bash> | ||
| - | pin 41 (44e108a4.0) 0000002f pinctrl-single | + | uboot_overlay_pru=/ | 
| </ | </ | ||
| - | If the Hex-code is not // | ||
| - | ===== Enable UIO PRU Driver ===== | + | === Disable the Remoteproc drivers | 
| - | ((original source: http://catch22.eu/beaglebone/beaglebone-pru-uio/)) | + | Finally the Remoteproc driver must be disabled by editing the file ///etc/modprobe.d/ | 
| - | 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 memo, it will be described, how to enable the UIO PRU Driver. | + | Remove | 
| - | After booting an fresh Debian image an executing | + | <code bash> | 
| + | blacklist pruss | ||
| + | blacklist pruss_intc | ||
| + | blacklist pru-rproc | ||
| + | blacklist spidev | ||
| + | </ | ||
| + | |||
| + | Afterward reboot | ||
| <code bash> | <code bash> | ||
| - | lsmod | grep uio | + | reboot | 
| - | uio_pdrv_genirq | + | |
| - | uio 10972 1 uio_pdrv_genirq | + | |
| </ | </ | ||
| - | and looking at the output, it seems, the UIO PRU Driver (uio_pdrv_genirq) is already been enabled. But this Assumption is wrong. It needs several steps to enable the driver: | + | === Test UIO driver === | 
| - | ==== Device tree modifications to enable | + | |
| - | Go to the directory: | + | To verify that the device tree modifications have been loaded correctly, execute: | 
| <code bash> | <code bash> | ||
| - | cd / | + | lsmod | 
| + | |||
| + | Module | ||
| + | pm33xx | ||
| + | wkup_m3_ipc | ||
| + | wkup_m3_rproc | ||
| + | remoteproc | ||
| + | virtio | ||
| + | virtio_ring | ||
| + | pvrsrvkm | ||
| + | uio_pruss | ||
| + | usb_f_acm | ||
| + | u_serial | ||
| + | uio_pdrv_genirq | ||
| + | usb_f_ncm | ||
| + | uio                    20480  2 uio_pruss, | ||
| + | usb_f_mass_storage | ||
| + | usb_f_rndis | ||
| + | u_ether | ||
| + | libcomposite | ||
| </ | </ | ||
| - | Now, modify the file //src/arm/am335x-boneblack-emmc-overlay.dts// by uncommenting the UIO PRU part and commenting the the remoterpc part: | + | Now only //UIO PRU// drivers are loaded and no //rproc// drivers. | 
| - | <code bash> | ||
| - | /* #include " | ||
| - | #include " | ||
| - | </ | ||
| - | After editing | + | ==== Install the PPL Device Tree Overlay ==== | 
| + | |||
| + | For PPL the CC1200 | ||
| + | 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> | ||
| - | make | + | cd ~/ | 
| - | </ | + | </ | 
| - | and install | + | Directory //dts// contains the file // | 
| <code bash> | <code bash> | ||
| - | make install | + | dtc -O dtb -o BB-BONE-CC1200-00A0.dtbo -b 0 -@ BB-BONE-CC1200-00A0.dts | 
| </ | </ | ||
| - | In the last step, the binary device tree must be enables in the file /// | + | During | 
| - | If not already done look at [[network_protocol_programming_lab: | + | <code bash> | 
| + | BB-BONE-CC1200-00A0.dtbo: Warning (unit_address_vs_reg): | ||
| + | </code> | ||
| - | ==== Disabling | + | //dtc// is the device tree compiler, which produces the bizarre overlay file // | 
| - | Finally the UIO PRU driver must be enables and the Remoteproc driver must be disables by | + | <code bash> | 
| - | editing the file ///etc/modprobe.d/ | + | cp BB-BONE-CC1200-00A0.dtbo | 
| + | </code> | ||
| - | Remove | + | Now that we have compiled | 
| <code bash> | <code bash> | ||
| - | blacklist pruss | + | ###Custom Cape | 
| - | blacklist pruss_intc | + | # | 
| - | blacklist pru-rproc | + | |
| - | blacklist spidev | + | |
| </ | </ | ||
| - | Afterward reboot the Beaglebone Black. | + | Uncomment this line and edit it so that it loads our own device tree overlay blob: | 
| <code bash> | <code bash> | ||
| - | reboot | + | dtb_overlay=/ | 
| </ | </ | ||
| - | ==== Test ==== | + | After that, reboot. | 
| - | To check, if the device tree file has been loaded | + | ===== Final Test ===== | 
| + | |||
| + | After all that is done we can do a final test to verify that all the hardware is configured | ||
| + | |||
| + | Execute the command as root and inspect its output: | ||
| <code bash> | <code bash> | ||
| - | lsmod | + | / | 
| - | Module | + | </ | 
| - | pvrsrvkm | + | |
| - | uio_pruss | + | |
| - | evdev 14151 1 | + | |
| - | uio_pdrv_genirq | + | |
| - | uio                    10972  2 uio_pruss, | + | |
| - | usb_f_acm | + | |
| - | u_serial | + | |
| - | usb_f_ecm | + | |
| - | 8021q 24428 0 | + | |
| - | garp 7497 1 8021q | + | |
| - | mrp | + | |
| - | stp | + | |
| - | llc | + | |
| - | usb_f_mass_storage | + | |
| - | usb_f_rndis | + | |
| - | u_ether | + | |
| - | libcomposite | + | |
| - | tieqep | + | |
| + | It should look like the following: | ||
| + | |||
| + | < | ||
| + | UBOOT: Booted Device-Tree: | ||
| + | UBOOT: Loaded Overlay: | ||
| + | UBOOT: Loaded Overlay: | ||
| + | UBOOT: Loaded Overlay: | ||
| + | uboot_overlay_options: | ||
| + | uboot_overlay_options: | ||
| + | uboot_overlay_options: | ||
| + | uboot_overlay_options: | ||
| + | cmdline: | ||
| </ | </ | ||
| - | Now only //UIO PRU// drivers are loaded and no // | + | If you see any of the following lines in the output, something went wrong. Redo the above steps in this case. | 
| + | |||
| + | < | ||
| + | UBOOT: Booted Device-Tree: | ||
| + | UBOOT: Loaded Overlay: | ||
| + | UBOOT: Loaded Overlay: | ||
| + | uboot_overlay_options: | ||
| + | uboot_overlay_options: | ||
| + | </ | ||




