Notes RE: NVIDIA Jetson TX2 - ntwong0/intelligentsystems2019 GitHub Wiki

Change Your Lifestyle

  • Ensure that it is possible to restore to your current development state with frequent git commits and data backups via rsync (rsync usage documentation specific to our use case TBA).
  • Avoid pre-production releases as much as possible in order to achieve greatest stability.
  • Treat the environment and all data on the Jetson TX2 as a development environment, and accept the potential of data loss as a fact of life.

Back it up

When a stable image is achieved, follow these instructions.

  • The directory referenced on the line "cd into the directory containing the L4T installation package" is $(JetPack_installation_directory)/64_TX2/Linux_for_Tegra

First Time Procedures

Unboxing and preparing I/O

  • Unboxing
    • 1x NVIDIA Jetson TX2 Developer Kit carrier board, with
      • 1x Jetson TX2 Module with fan and heatsink
      • 1x Jetson Camera Module (5 MP Fixed Focus MIPI CSI Camera)
      • 1x polycarbonate backplate with standoffs
    • 2x Wi-Fi Antennas
    • 1x Power Cable (IEC 60320-C13)
    • 1x Power Supply (line AC to 19VDC at 4.74A, 90W max)
    • 1x USB Micro-B to USB A cable (needed to update the system image via JetPack)
    • 1x USB Micro-B to Female USB A cable (not used)
  • Additional peripheral components for I/O
    • 1x HDMI cable and display
    • 1x Keyboard and mouse
    • 1x USB hub

First-time powering on

  1. Plug in peripherals
  2. Plug in power
  3. Press and hold power button (labeled POWER BTN) until indicator LEDs illuminate, then release
  4. Toggle the keyboard's NumLock/CapsLock/ScrollLock key until the indicator illuminates
  5. At this point, if the HDMI display does not show text, disconnect and reconnect the HDMI cable.
    • If the display still does not show text, the system may be dead.
    • If this does happen for the display you are using, it is likely to happen at every power-on.
  6. You should now be in TTY1. Follow the instructions listed
    • cd NVIDIA-INSTALLER
    • sudo ./installer.sh
  7. Restart the system via Ctrl-Alt-Del

Get the system image ready for development

Placing Jetson TX2 in Force USB Recovery Mode (necessary to flash OS image from JetPack onto TX2)

  1. Power down the device. If connected, remove the AC adapter from the device. The device MUST be powered OFF, not in a suspend or sleep state.
  2. Connect the Micro-B plug on the USB cable to the Recovery (USB Micro-B) Port on the device (labeled USB0) and the other end to an available USB port on the host PC.
  3. Connect the power adapter to the device.
  4. Starting with the system powered off, press and release the power button (labeled POWER BTN); press and hold the recovery force button (labeled REC); while depressing the recovery force button, press and release the reset button (labeled RST); wait two seconds and release the recovery force button.
    • Note: When in Force USB Recovery Mode, the system will not boot up (nothing appears on display or serial port). After successfully updating the system software and restarting your Developer Kit, the system continues through the boot up process.

Update to the latest production release Linux for Tegra (L4T) via JetPack

Reference: Jetson Software

NVIDIA JetPack SDK is the most comprehensive solution for building AI applications. Use the JetPack installer to flash your Jetson Developer Kit with the latest OS image, to install developer tools for both the host PC and Developer Kit, and to install the libraries and APIs, samples, and documentation needed to jumpstart your development environment.

NVIDIA L4T provides the Linux kernel, bootloader, NVIDIA drivers, flashing utilities, sample filesystem, and more for the Jetson platform.

Issues
Keyboard and mouse not working - no USB devices detectable

Reference: USB keyboard and mouse not working on Jetson TX2

This is a symptom of incomplete imaging of the OS onto the Jetson TX2. If the Jetson TX2 is able to achieve network activity via ethernet, attempt to ssh into the device, then ls /lib/firmware. If at some point you want to enable WiFi, use nmtui. If the listing does not compare against the host machine's listing at $(installation_directory_you_specified_in_JetPack....run)/64_TX2/Linux_for_Tegra/rootfs/lib/firmware, then the issue is caused by faulty file system permissions on the host machine. Please ensure that the installation and download directories are owned by the same user that owns and executes JetPack-L4T-3.3-linux-x64_b39.run.

If you are attempting to do this from a partition whose file system does not respect Linux permissions and ownership (i.e. ex/FAT/32/64), you're gonna have a bad time. NTFS partitions generally will grant all or no permissions to files, and can be forced to respect ownership via ntfs-3g.usermap. Ensure that the directories are owned by the Windows user account to be mapped the Linux user account before proceeding with ntfs-3g.usermap. At the end of the user mapping command, there will be a prompt asking you to move the user mapping to $(windows_boot_partition)/.NTFS-3G. Instead,

  1. Confirm that the mappings in the UserMapping file are correct in both user-id and group-id, and
  2. Copy UserMapping to every $(NTFS_partition)/.NTFS-3G directory (and mkdir if necessary)

After performing usermap, files and folders created in the NTFS partition by the mapped Linux user account will be owned by the user.

CUDA, OpenCV, and other components are not installed

This may occur if the JetPack script has timed out when attempting to connect to the Jetson TX2. To remedy this, rerun the JetPack....run script, but in the "JetPack Components Manager" menu,

  1. Deselect all components via "Clear Actions", then
  2. Select "install" in the "Action" column corresponding to "Install on Target".

Updates and install initial packages

Follow the instructions stated on the README for buildOpenCVTX2

This upgrades OpenCV 3.3.1 from JetPack 3.3 to OpenCV 3.4.1

For my build process, I used /home/nvidia/Workspace/opencv-sources as the sources directory, i.e.

./buildAndPackageOpenCV.sh -s /home/nvidia/Workspace/opencv-sources
Follow the instructions stated on the README for YOLO-darknet-on-Jetson-TX2

Fast object detection.

  • Don't forget to source ~/.bashrc after you buildOpenCVTX2
  • Instructions for tiny-yolov3 work out of the box
  • For yolov3, as stated in darknet's issue #1073, reducing the batch size worked:
    1. cd $(your_workspace)/darknet/cfg
    2. cp yolov3.cfg yolov3-smaller.cfg
    3. In yolov3-smaller.cfg, replace line 6 batch=64 with batch=32
    4. Run the following
./darknet detector demo cfg/coco.data cfg/yolov3-smaller.cfg yolov3.weights "nvcamerasrc ! video/x-raw(memory:NVMM), width=(int)1280, height=(int)720,format=(string)I420, framerate=(fraction)30/1 ! nvvidconv flip-method=0 ! video/x-raw, format=(string)BGRx ! videoconvert ! video/x-raw, format=(string)BGR ! appsink"