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 [2021/04/26 09:34] – [Device tree compiler and overlays] 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 | 
| - | Looking carefully at the output of the // | + | Otherwise you have to prefix every command with the word //sudo//. E.g. instead entering | 
| + | |||
| + | 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 | 
| - | The device tree overlay | + | 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 | 
| + | 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: | ||
| - | < | + | < | 
| - | + | ==== Disable HDMI ==== | |
| - | To install these things go to directory: | + | 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> | ||
| - | cd / | + | disable_uboot_overlay_video=1 | 
| </ | </ | ||
| - | Now, test if the device tree compiler is installed: | + | ==== Disable default pin configuration ==== | 
| + | |||
| + | Per default the pins of the BeagleBone Black are wired for universal use, meaning | ||
| + | |||
| + | To disable universal use, comment out the following line in the file /// | ||
| <code bash> | <code bash> | ||
| - | dtc --version | + | enable_uboot_cape_universal=1 | 
| - | Version: DTC 1.4.4 | + | |
| </ | </ | ||
| - | Update dtc by executing: | + | ==== Reboot | 
| + | |||
| + | 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" | 
| </ | </ | ||
| - | Install | + | and look, that the output matches the following: | 
| <code bash> | <code bash> | ||
| - | ./ | + | pin 41 (PIN41) 44e108a4 0000002f pinctrl-single | 
| </ | </ | ||
| - | ==== Disable HDMI ==== | + | If the Hex-code is not // | 
| - | 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 | + | |
| + | ==== PRU Driver | ||
| + | |||
| + | ((original source: https:// | ||
| + | |||
| + | The communication between | ||
| + | |||
| + | After booting a fresh Debian image and executing the command: | ||
| <code bash> | <code bash> | ||
| - | ## | + | lsmod | 
| - | dtb=am335x-boneblack-emmc-overlay.dtb | + | |
| + | 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 | ||
| </ | </ | ||
| - | ==== Disable default pin configuration ==== | ||
| - | Per default | + | 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 | 
| - | To disable universal use, change | + | === 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 /// | ||
| <code bash> | <code bash> | ||
| - | cmdline=coherent_pool=1M net.ifnames=0 quiet cape_universal=enable | + | uboot_overlay_pru=/ | 
| </ | </ | ||
| - | 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=/ | 
| - | </ | + | </ | 
| - | ==== Reboot | + | |
| - | To make the changes effective, reboot. | ||
| - | To test, that the HDMI is disables execute | + | === Disable | 
| + | |||
| + | Finally the Remoteproc driver must be disabled by editing the file /// | ||
| + | |||
| + | Remove the line '// | ||
| <code bash> | <code bash> | ||
| - | grep "pin 41" | + | blacklist pruss | 
| + | blacklist pruss_intc | ||
| + | blacklist pru-rproc | ||
| + | blacklist spidev | ||
| </ | </ | ||
| - | and look, that the output matches the following: | + | Afterward reboot | 
| <code bash> | <code bash> | ||
| - | pin 41 (44e108a4.0) 0000002f pinctrl-single | + | reboot | 
| </ | </ | ||
| - | If the Hex-code is not // | + | === Test UIO driver === | 
| - | ===== Enable UIO PRU Driver ===== | + | To verify that the device tree modifications have been loaded correctly, execute: | 
| - | + | ||
| - | ((original source: http:// | + | |
| - | + | ||
| - | 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. | + | |
| - | + | ||
| - | After booting an fresh Debian image an executing the command: | + | |
| <code bash> | <code bash> | ||
| lsmod | lsmod | ||
| + | |||
| Module | Module | ||
| - | pvrsrvkm | + | pm33xx | 
| - | evdev 14151 1 | + | wkup_m3_ipc | 
| - | uio_pdrv_genirq | + | wkup_m3_rproc | 
| - | uio                    10972 | + | remoteproc | 
| - | 8021q 24428 0 | + | virtio | 
| - | garp                    7497 | + | virtio_ring | 
| - | mrp | + | pvrsrvkm | 
| - | stp | + | uio_pruss | 
| - | llc | + | usb_f_acm | 
| - | usb_f_acm | + | u_serial | 
| - | u_serial | + | uio_pdrv_genirq | 
| - | usb_f_ecm | + | usb_f_ncm | 
| - | usb_f_mass_storage | + | uio                    20480  2 uio_pruss, | 
| - | usb_f_rndis | + | usb_f_mass_storage | 
| - | u_ether | + | usb_f_rndis | 
| - | libcomposite | + | u_ether | 
| - | spidev | + | libcomposite | 
| - | tieqep | + | |
| - | pru_rproc | + | |
| - | pruss_intc | + | |
| - | pruss                  12346  1 pru_rproc | + | |
| </ | </ | ||
| - | 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: | + | Now only //UIO PRU// drivers are loaded and no //rproc// drivers. | 
| - | ==== Device tree modifications to enable UIO PRU driver ==== | + | |
| - | Go to the directory: | + | |
| + | ==== 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 | ||
| <code bash> | <code bash> | ||
| - | cd /opt/ | + | cd ~/Beaglebone/dts | 
| </ | </ | ||
| - | Now, modify the file //src/arm/am335x-boneblack-emmc-overlay.dts// | + | Directory | 
| <code bash> | <code bash> | ||
| - | /* #include " | + | dtc -O dtb -o BB-BONE-CC1200-00A0.dtbo -b 0 -@ BB-BONE-CC1200-00A0.dts | 
| - | #include " | + | </ | 
| - | </ | + | |
| - | + | ||
| - | After editing is finished, compile the device tree files by | + | |
| + | During the compilation you can safely ignore warnings like | ||
| <code bash> | <code bash> | ||
| - | make | + | BB-BONE-CC1200-00A0.dtbo: | 
| - | </ | + | </ | 
| - | and install | + | //dtc// is the device tree compiler, which produces the bizarre overlay file // | 
| <code bash> | <code bash> | ||
| - | make install | + | cp BB-BONE-CC1200-00A0.dtbo / | 
| </ | </ | ||
| - | In the last step, the binary | + | Now that we have compiled | 
| - | If not already done look at [[network_protocol_programming_lab: | + | |
| - | + | ||
| - | ==== Disabling the Remoteproc drivers ==== | + | |
| - | + | ||
| - | Finally the UIO PRU driver must be enables | + | |
| - | editing the file /// | + | |
| - | + | ||
| - | Remove | + | |
| <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 | + | It should look like the following: | 
| - | 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 | + | |
| + | < | ||
| + | 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: | ||
| + | </ | ||




