Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| network_protocol_programming_lab:3_preparedebian [2022/04/14 16:44] – [Final Test] fangenoorth | network_protocol_programming_lab:3_preparedebian [2022/04/14 16:51] (current) – [Final Test] fangenoorth | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Debian Preparation for PPL ====== | ||
| + | ===== Get PPL Files for BeagleBone Black ===== | ||
| + | |||
| + | First you need to download all the stuff for the PPL on the BeagleBone Black. | ||
| + | In the home directory, execute the following command: | ||
| + | |||
| + | <code bash> | ||
| + | wget http:// | ||
| + | </ | ||
| + | |||
| + | If you are unsure in which directory you currently are, execute the '' | ||
| + | |||
| + | Now extract the archive by executing the command: | ||
| + | |||
| + | <code bash> | ||
| + | tar -xzf Beaglebone.tar.gz | ||
| + | </ | ||
| + | |||
| + | You will see a new directory called Beaglebone, containing additional directories: | ||
| + | |||
| + | <code bash> | ||
| + | ls Beaglebone | ||
| + | dts spi SPI_test | ||
| + | </ | ||
| + | |||
| + | 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> | ||
| + | sudo -s -H | ||
| + | </ | ||
| + | |||
| + | after booting the BeagleBone Black and logging in into the //debian// account, whose default password is // | ||
| + | |||
| + | 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, after you have become superuser, it is a good advice to update the operating system with new packages by entering the commands: | ||
| + | |||
| + | <code bash> | ||
| + | apt-get update | ||
| + | apt-get upgrade | ||
| + | </ | ||
| + | |||
| + | This ensures the the operation system is up do date. | ||
| + | |||
| + | ===== Install additional Packages ===== | ||
| + | |||
| + | The following additional packages are needed: | ||
| + | |||
| + | <code bash> | ||
| + | apt-get install cmake | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== 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 ===== | ||
| + | |||
| + | At the time of writing this memo, the kernel version included in the Debian image was // | ||
| + | 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> | ||
| + | cd / | ||
| + | git pull | ||
| + | ./ | ||
| + | </ | ||
| + | |||
| + | Now boot the BeagleBone Black once again. | ||
| + | |||
| + | <code bash> | ||
| + | reboot | ||
| + | </ | ||
| + | |||
| + | After the reboot, let's check our new upgraded kernel: | ||
| + | |||
| + | <code bash> | ||
| + | uname -a | ||
| + | Linux beaglebone 4.19.94-ti-r72 #1buster SMP PREEMPT Tue Mar 8 22:13:06 UTC 2022 armv7l GNU/Linux | ||
| + | </ | ||
| + | |||
| + | Now the kernel version // | ||
| + | |||
| + | ===== Device tree modifications ===== | ||
| + | |||
| + | ==== Device tree compiler and overlays ==== | ||
| + | |||
| + | 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 place. This 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. | ||
| + | |||
| + | 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' | ||
| + | |||
| + | 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 ==== | ||
| + | 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> | ||
| + | disable_uboot_overlay_video=1 | ||
| + | </ | ||
| + | |||
| + | ==== 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> | ||
| + | enable_uboot_cape_universal=1 | ||
| + | </ | ||
| + | |||
| + | ==== Reboot | ||
| + | |||
| + | To make the changes effective, reboot. | ||
| + | |||
| + | To test that HDMI is disabled, execute the following command: | ||
| + | |||
| + | <code bash> | ||
| + | grep "pin 41" / | ||
| + | </ | ||
| + | |||
| + | and look, that the output matches the following: | ||
| + | |||
| + | <code bash> | ||
| + | pin 41 (PIN41) 44e108a4 0000002f pinctrl-single | ||
| + | </ | ||
| + | |||
| + | If the Hex-code is not // | ||
| + | |||
| + | ==== PRU Driver ==== | ||
| + | |||
| + | ((original source: https:// | ||
| + | |||
| + | 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> | ||
| + | lsmod | ||
| + | |||
| + | 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 === | ||
| + | |||
| + | 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> | ||
| + | uboot_overlay_pru=/ | ||
| + | </ | ||
| + | |||
| + | We should also disable the overlay for the unused rproc driver by commenting out the following line in the same file: | ||
| + | |||
| + | <code bash> | ||
| + | uboot_overlay_pru=/ | ||
| + | </ | ||
| + | |||
| + | |||
| + | === Disable the Remoteproc drivers === | ||
| + | |||
| + | Finally the Remoteproc driver must be disabled by editing the file /// | ||
| + | |||
| + | Remove the line '// | ||
| + | |||
| + | <code bash> | ||
| + | blacklist pruss | ||
| + | blacklist pruss_intc | ||
| + | blacklist pru-rproc | ||
| + | blacklist spidev | ||
| + | </ | ||
| + | |||
| + | Afterward reboot the Beaglebone Black. | ||
| + | |||
| + | <code bash> | ||
| + | reboot | ||
| + | </ | ||
| + | |||
| + | === Test UIO driver === | ||
| + | |||
| + | To verify that the device tree modifications have been loaded correctly, execute: | ||
| + | |||
| + | <code bash> | ||
| + | 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 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> | ||
| + | cd ~/ | ||
| + | </ | ||
| + | |||
| + | Directory //dts// contains the file // | ||
| + | |||
| + | <code bash> | ||
| + | dtc -O dtb -o BB-BONE-CC1200-00A0.dtbo -b 0 -@ BB-BONE-CC1200-00A0.dts | ||
| + | </ | ||
| + | |||
| + | During the compilation you can safely ignore warnings like | ||
| + | <code bash> | ||
| + | BB-BONE-CC1200-00A0.dtbo: | ||
| + | </ | ||
| + | |||
| + | //dtc// is the device tree compiler, which produces the bizarre overlay file // | ||
| + | |||
| + | <code bash> | ||
| + | cp BB-BONE-CC1200-00A0.dtbo / | ||
| + | </ | ||
| + | |||
| + | 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 /// | ||
| + | |||
| + | <code bash> | ||
| + | ###Custom Cape | ||
| + | # | ||
| + | </ | ||
| + | |||
| + | Uncomment this line and edit it so that it loads our own device tree overlay blob: | ||
| + | |||
| + | <code bash> | ||
| + | dtb_overlay=/ | ||
| + | </ | ||
| + | |||
| + | After that, reboot. | ||
| + | |||
| + | ===== Final Test ===== | ||
| + | |||
| + | After all that is done we can do a final test to verify that all the hardware is configured correctly. | ||
| + | |||
| + | Execute the command as root and inspect its output: | ||
| + | |||
| + | <code bash> | ||
| + | / | ||
| + | </ | ||
| + | |||
| + | 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: | ||
| + | </ | ||
| + | |||
| + | 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: | ||
| + | </ | ||
