NVIDIA AGX Xavier Board Bringup ############################### This document explains the steps to configure the Nvidia AGX Xavier developer kit to execute the app4mc-racecar application. JETPACK Installation on NVIDIA AGX :superscript:`TM` Xavier Developer Kit ************************************************************************** This section lists the steps to install the JetPack on NVIDIA Jetson AGX :superscript:`TM` Xavier Developer Kit. It provides the information about the NVIDIA JetPack :superscript:`TM` SDK, system requirements, prerequisites and the physical configuration. NVIDIA JetPack :superscript:`TM` SDK supports both the developer kit and the host development environment platform. It includes: * OS Image (Sample Linux filesystem derived from Ubuntu) with NVIDIA drivers. * AI and Computer Vision libraries and APIs. * Developer Tools such as CUDA tools, NVIDIA Nsight Systems, NVIDIA Nsight Graphics. * Documentation and sample code. The Jetson Software can be installed using two methods: * SD Card Image method. * NVIDIA SDK Manager method. This document provides the steps to install the Jetson Software using the NVIDIA SDK Manager method. The installation steps provided in this document has been performed on the below system configurations: * 64-bit host computer with Ubuntu 18.04 installed on it. * NVIDIA AGX Xavier TM development board (P2972). System Requirements =================== The minimum system requirements for the host computer are: * Ubuntu Linux x64 v16.04 or 18.04. * A valid internet connection * At least 32GB of disk space. The below diagram represents the NVIDIA Jetson Xavier AGX developer kit interface. .. image:: ../../images/agx_xavier_external_interfaces.png :align: center :scale: 60 % The left image represents the front view and right image represents the rear view. Prerequisites ============= Linux host computer is required to run the JetPack installer and flash the developer kit. `NVIDIA SDK Manager`_ must be installed on the Linux host machine. Physical Configuration ====================== NVIDIA Jetson Xavier AGX should be connected as follows: * Connect the external HDMI display to the development board’s HDMI port. * Connect the USB keyboard and mouse using the USB Type-A interface and rear USB Type-C interface (The rear USB Type-C is used for flashing the developer kit). * Connect the rear USB Type-C port of development board to your host computer. * Connect the development board to your local network via Ethernet cable to the board’s Ethernet port (The host and development board should be connected to the same network). * Connect the included AC adapter to the development board power jack (Use the AC adapter supplied with the developer kit). * Put the development board into force recovery mode by following the steps mentioned below: 1. Initially the board must be powered off. 2. Press and hold down the force recovery button. 3. Press and hold down the power button. 4. Release both buttons. Executing the **lsusb** command on the host computer must display the Nvidia Corporation device connected to the host computer. .. image:: ../../images/lsusb_output.png :align: center :scale: 60 % Now that the NVIDIA Jetson Xavier AGX :superscript:`TM` board is connected to your host machine, start the *NVIDIA SDK Manager* application on the host computer. Install JetPack :superscript:`TM` with NVIDIA SDK Manager ========================================================= * Select the host machine. The target hardware is automatically detected by the SDK Manager. * Select the target operating system which is the Linux based JetPack version. * Select the additional SDKs required for application development. * Select the download folder and accept the license agreements. * Once the download and installation is complete, the SDK Manager provides a prompt to flash the JetPack on the target hardware. The target hardware can be flashed in two ways – *Manual* and *Automatic*. * After SDK Manager completes the flashing process, the monitor/display device connected to your target hardware system will show a prompt for initial setup. Complete the initial installation setup on the target hardware. After the initial setup is complete, the target hardware boots to Linux desktop. * SDK Manager completes the installation by installing other selected software libraries. The details can also be viewed on NVIDIA SDK Manager developer tutorial on `Install Jetson Software with SDK Manager`_. Installing RT-Linux on NVIDIA Jetson AGX Xavier :superscript:`TM` ***************************************************************** This section describes the steps to install real-time kernel (RT-Linux) on NVIDIA Jetson Xavier :superscript:`TM` . When the JetPack is flashed on the development board, it does not have the real-time capability. This can be verified by executing the **‘uname -a’** command which gives the below output. Linux Version ============== .. image:: ../../images/linux-version.png :align: center :scale: 60 % As observed, the output string does not contain the **'SMP PREEMPT RT'** string. Before installing the RT kernel version we need to check the number of CPU cores that are in online state, the current Linux version as well as the current JetPack or the Tegra release version installed on the development hardware. CPU Information =============== The information about the CPU’s cores can be obtained by executing the **lscpu** command. .. image:: ../../images/cpuinfo.png :align: center :scale: 60 % The above output demonstrates that out of 8 CPU cores only 4 are in online. **nvpmodel** command can be used to change the mode of the development board which is discussed further in this document. JetPack Version =============== The JetPack version can be obtained from the file **nv_tegra_release**: .. image:: ../../images/tegra-release.png :align: center :scale: 60 % In this case, the current release version is 32 with revision 4.4. This makes our JetPack version as L4T32.4.4. Modifying the Mode of development board ======================================= .. image:: ../../images/nvpmodel.png :align: center :scale: 60 % **nvpmodel** is a utility command line tool to set the performance and energy usage characteristics of NVIDIA Jetson AGX Developer kit. We have used mode 3 to utilize all the 8 cores available on the development board. The complete list of the modes and its respective configuration can be obtained from `Power Management for Jetson AGX Xavier Series Devices`_. The kernel source code required for applying the real-time kernel patch must be of version 4.9.140 with JetPack version of L4T32.4.4 . Steps to install RT-Linux on Nvidia AGX Xavier :superscript:`TM` ================================================================ * Download the board support package source code for Jetson L4T32.4.4 “public_sources.tbz2” [`here L4T Driver Package (BSP) Sources`_ ] applicable for Nvidia AGX Xavier :superscript:`TM` . * Place the downloaded zip file at location usr/src/ in the target hardware environment. * git clone https://github.com/jetsonhacks/buildJetsonTX2Kernel.git. * Change the getKernelSources.sh script as below : * Modify JETSON_MODEL=”AGX Xavier” (Your development board platform) * Modify L4T_TARGET=”32.4.4” (Your current L4T version) * cd scripts * Edit getKernelSources.sh script (in the scripts folder) – Comment the line containing the wget command to download the kernel source code. * *cd ~/buildJetsonTX2Kernel*. * Extract Kernel Sources - *./getKernelSources.sh*. * Execute makeKernel script. The kernel builds successfully - *./makeKernel.sh*. * Apply the RT-kernel patch. * *cd usr/src/kernel/kernel-4.9/scripts*. * *sudo ./rt-patch apply-patches*. * *cd ~/buildJetsonTX2Kernel*. * Execute makeKernel script : - *./makeKernel.sh* * Select Fully Preemptive Kernel (Option - 5). * Missed Timer Offsets Histogram(MISSED_TIMER_OFFSETS_HIST) [N/y/?] (NEW) N .. image:: ../../images/makekernel.png :align: center :scale: 60 % * Build and install the modules - *./makeModules.sh*. * Execute *./copyImage.sh*. * Reboot the development board - *sudo reboot*. * Check the kernel version after the reboot - *uname -a*. .. image:: ../../images/rtlinuxinstalled.png :align: center :scale: 60 % NVIDIA AGX :superscript:`TM` Xavier Communication Interfaces ************************************************************* The Tegra Xavier SoC is a 64-bit ARM high performance system. The I/O ports are broken out through a carrier board via a 699-pin board-to-board connector. The Jetson AGX Xavier carrier board provides several standard expansion connectors to support additional functionality beyond what is integrated on the main platform board. This includes: * USB 2.0 Micro B Connector * USB 3.1: 2x Type C Connectors * Gigabit Ethernet: RJ45 Connector * HDMI: Type A Connector * PCIe x16 Connector (PCIe or SLVS) * UFS / Micro SD Card Socket * eSATA: Standard SATA Connector, 22-pin including power * M.2, Key E Slot * M.2, Key M Slot * Audio Panel Header * JTAG .. image:: ../../images/agx_interface.png :align: center :scale: 60 % Apart from these expansion connectors, the carrier board supports several expansion headers : * Jetson AGX Xavier Connector, 65x11 * Camera Expansion Header, 2x60, 0.5 mm pitch * Expansion Header, 2x20, 2.54 mm pitch * Audio Panel Header, 2x5, 2.54 mm pitch * Fan Header, 4-pin, 1.25 mm pitch * DC Power Jack .. image:: ../../images/agx_gpio.png :align: center :scale: 60 % The 2x20 pin expansion header supports I2C, UART, SPI, CAN protocols along with GPIO pins. The initial pinmux should set all these pins, except for the power, UART RX TX and two I2C busses, to GPIO at boot. The UART and I2C busses should not be used for GPIO. CAN Protocol is a message-based networking protocol with prioritisation feature. It is widely used in communication between automotive components and remains a standard in automotive application. The Jetson Xavier AGX provides two CAN interface via the 2x20 pin expansion header. However, the unavailability of a dedicated integrated CAN transreceiver restricts the usage of CAN interface directly. Enabling CAN interface on NVIDIA AGX :superscript:`TM` Xavier Developer Kit =========================================================================== The CAN interface on Nvidia AGX xavier is not enabled by default. The external GPIO pin header connector supports a power voltage of 3.3V. The CAN0_DIN and CAN0_DOUT can be configured by modifying the pinmux setup of GPIO pins #29 and #31. Similarly, CAN1_DIN and CAN1_DOUT can be configured by modifying the pinmux setup of GPIO pins #37 and #33. .. code-block:: bash :linenos: #!/bin/bash sudo devmem2 0x0c303000 w 0x0000C400 sudo devmem2 0x0c303008 w 0x0000C458 sudo devmem2 0x0c303010 w 0x0000C400 devmem2 0x0c303018 w 0x0000C458 sudo modprobe can sudo modprobe can_raw sudo modprobe mttcan sudo ip link set can0 type can bitrate 500000 sudo ip link set up can0 txqueuelen 1000 .. image:: ../../images/can.png :align: center :scale: 100 % .. _Install Jetson Software with SDK Manager : https://docs.nvidia.com/sdk-manager/install-with-sdkm-jetson/index.html .. _NVIDIA SDK Manager : https://developer.nvidia.com/nvidia-sdk-manager .. _Power Management for Jetson AGX Xavier Series Devices : https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide/power_management_jetson_xavier.html .. _here L4T Driver Package (BSP) Sources : https://developer.nvidia.com/embedded/linux-tegra