├── camera-sequence-diagram.jpg ├── DriverFramework.md ├── PlatformGettingStarted.md ├── GettingStarted.md ├── DevEnvSetup.md ├── CameraProg.md ├── README.md ├── AppsGettingStarted.md ├── DSPAL.md ├── HelloWorld.md ├── SnapdragonROSInstallation.md ├── PX4.md ├── TroubleshootFAQ.md └── UserGuide.md /camera-sequence-diagram.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ATLFlight/ATLFlightDocs/HEAD/camera-sequence-diagram.jpg -------------------------------------------------------------------------------- /DriverFramework.md: -------------------------------------------------------------------------------- 1 | # DriverFramework 2 | 3 | Driver framework for POSIX based userspace drivers. 4 | 5 | ## Location of DriverFramework 6 | 7 | The most active repository for DriverFramework is http://github.com/PX4/DriverFramework 8 | 9 | ## Description 10 | 11 | A Description of how to use DriverFramework is at: http://github.com/PX4/DriverFramework/README.md 12 | -------------------------------------------------------------------------------- /PlatformGettingStarted.md: -------------------------------------------------------------------------------- 1 | # Getting Started with Snapdragon Flight 2 | 3 | This page provides information on setting up your Snapdragon Flight™ kit. 4 | * Create a support account [here](https://support.intrinsyc.com) 5 | * Follow the [steps here](https://support.intrinsyc.com/projects/snapdragon-flight/wiki) to get started. 6 | * Install the latest platform BSP and flight controller addon software using the instructions [here](https://support.intrinsyc.com/projects/snapdragon-flight/wiki/Get_and_install_the_latest_platform_BSP) 7 | * Refer to the relevant sections in [the documentation](https://github.com/ATLFlight/ATLFlightDocs/blob/master/README.md) to accomplish a desired task 8 | -------------------------------------------------------------------------------- /GettingStarted.md: -------------------------------------------------------------------------------- 1 | # Getting Started on Hexagon DSP Application Development 2 | 3 | These instructions are for using DSPAL and DriverFramework with the Hexagon Toolchain on x86_64 Linux. 4 | 5 | ## Installations 6 | ### SDK 7 | Install the Hexagon™ SDK using the instructions at [Development Environment Setup](DevEnvSetup.md). 8 | 9 | ### cmake 10 | If you use Ubuntu 14.04, upgrade cmake to 3.4.3 or higher, and add it to the PATH. 11 | ``` 12 | cd ~/Downloads 13 | wget https://cmake.org/files/v3.4/cmake-3.4.3-Linux-x86_64.sh 14 | chmod a+x cmake-3.4.3-Linux-x86_64.sh 15 | ./cmake-3.4.3-Linux-x86_64.sh 16 | sudo mv cmake-3.4.3-Linux-x86_64 /opt 17 | ``` 18 | In your shell startup script, add 19 | ``` 20 | if [ "x`echo $PATH | grep '/opt/cmake-3.4.3-Linux-x86_64/bin'`" = "x" ]; then 21 | PATH=$PATH:/opt/cmake-3.4.3-Linux-x86_64/bin 22 | fi 23 | export PATH=$PATH 24 | ``` 25 | ### Other packages 26 | ``` 27 | sudo apt-get install python-empy 28 | sudo apt-get install python-pip 29 | sudo pip install catkin_pkg 30 | ``` 31 | 32 | ## All Done. What Next? 33 | 34 | You have installed all the prerequisites to build code for the Hexagon DSP. Try the [HelloWorld](HelloWorld.md) 35 | program to test running a program on the DSP. 36 | -------------------------------------------------------------------------------- /DevEnvSetup.md: -------------------------------------------------------------------------------- 1 | # Snapdragon Flight Development Environment Setup 2 | 3 | ## SDK and Tools 4 | The following SDK and tools are available to develop applications on the Snapdragon Flight™ platform. 5 | * The qrlSDK is used used to create applications that run on the ARM-based applications processor. Once installed, the SDK provides: 6 | * The gcc cross-toolchain that is downloaded from the Linaro servers 7 | * The include files and libraries required to compile and link userspace applications that run on the apps processor 8 | * The environment setup script environment-setup- required by the cross-toolchain 9 | * The Hexagon™ SDK and Hexagon™ tools are used to create applications that run on the Hexagon™ DSP. 10 | 11 | ## Prerequisites 12 | A x86_64 Ubuntu (14.04 or higher) workstation is required 13 | 14 | ## Setup 15 | The steps for installation of both SDK and tools are scripted and documented at https://github.com/ATLFlight/cross_toolchain. Follow the instructions in [the README](https://github.com/ATLFlight/cross_toolchain#cross_toolchain). 16 | 17 | ### Environment Variables Changes 18 | At the end of the installation, the script will display instructions to set your environment variables. 19 | 20 | Below is an example. Actual values to be used based on the instructions displayed by the installation script. 21 | 22 | ``` 23 | export HEXAGON_INSTALL_HOME=${HOME} 24 | export HEXAGON_SDK_ROOT=${HEXAGON_INSTALL_HOME}/Qualcomm/Hexagon_SDK/3.0 25 | export HEXAGON_TOOLS_ROOT=${HEXAGON_INSTALL_HOME}/Qualcomm/HEXAGON_Tools/7.2.12/Tools 26 | export HEXAGON_ARM_SYSROOT=${HEXAGON_INSTALL_HOME}/Qualcomm/qrlinux_v4_sysroot/merged-rootfs 27 | export ARM_CROSS_GCC_ROOT=${HEXAGON_INSTALL_HOME}/Qualcomm/ARM_Tools/gcc-4.9-2014.11 28 | ``` 29 | 30 | -------------------------------------------------------------------------------- /CameraProg.md: -------------------------------------------------------------------------------- 1 | # Camera Programming 2 | This page provides information on writing and building code for Snapdragon Flight™ cameras. 3 | 4 | 1. [Pre-requisites](#pre-requisites) 5 | 1. [Sample Apps](#sample-apps) 6 | 1. [camerad](#camerad) 7 | 1. [More information](#more-information) 8 | 9 | ## Pre-requisites 10 | Follow the instructions in the [Getting Started](AppsGettingStarted.md) page to setup the SDK and build environment, and ensure that you can build and run the "Hello World" sample app. 11 | 12 | ## Sample Apps 13 | 14 | ### camerad 15 | This is a simple camera daemon and client program for Snapdragon Flight™. 16 | 17 | *Get the code* 18 | ``` 19 | # Top-level directory for the project 20 | export ROOTDIR=/local/mnt/workspace/camerad-sample 21 | 22 | mkdir -p $ROOTDIR 23 | cd $ROOTDIR 24 | git clone git://codeaurora.org/quic/le/platform/hardware/qcom/media -b LNX.LER.1.0 25 | ``` 26 | *Build* 27 | Follow the instructions below OR in the $ROOTDIR/media/readme.txt file. 28 | ``` 29 | cd media/camera-daemon 30 | make -f sdk_use.mk 31 | ``` 32 | *Documentation* 33 | - Generate the doxygen documentation: ```cd doxy && make``` 34 | - Open the following file from a web browser: ``` $ROOTDIR/media/camera-daemon/doxy/html/index.html ``` to view and browse the documentation. 35 | 36 | *Run* 37 | Push the binaries to target 38 | ``` 39 | adb push camclient /home/linaro 40 | adb push camerad /home/linaro 41 | ``` 42 | Navigate to the User Guide in the above doxygen documentation and follow the instructions to start and run the ```camerad``` and then the ```camclient```. 43 | 44 | ## More information 45 | Snapdragon Flight platform developer's edition users may see this document for more information [Snapdragon Camera Linux Camera Interface Specification](http://support.intrinsyc.com/documents/143). 46 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Snapdragon Flight Documentation 2 | 3 | These pages provide some information about the [Snapdragon Flight™](https://developer.qualcomm.com/hardware/snapdragon-flight) platform (developer’s edition) including how to setup the build environment, various SW components and more. This information should be used in conjunction with the [official documentation](https://developer.qualcomm.com/hardware/snapdragon-flight). 4 | 5 | ## Table of Contents 6 | 7 | 1. [Getting Started](PlatformGettingStarted.md) 8 | 1. [User Guide](UserGuide.md) 9 | 1. Developer Guide 10 | 1. [Development Environment Setup](DevEnvSetup.md) 11 | 1. [Machine Vision SDK](https://developer.qualcomm.com/hardware/snapdragon-flight/machine-vision-sdk) 12 | 1. [Snapdragon Navigator SDK](https://developer.qualcomm.com/hardware/snapdragon-flight/sd-navigator) 13 | 1. CPU / Applications Processor Development 14 | 1. [Getting Started (and Hello World)](AppsGettingStarted.md) 15 | 1. [Camera Programming](CameraProg.md) 16 | 1. [ROS Installation](SnapdragonROSInstallation.md) 17 | 1. GPU Programming 18 | 1. Video Encoder Programming 19 | 1. Debugging 20 | 1. DSP development (Real-time I/O, Flight Control) 21 | 1. [Getting Started](GettingStarted.md) 22 | 1. [Hello World](HelloWorld.md) 23 | 1. [DSPAL](DSPAL.md) 24 | 1. [DriverFramework](DriverFramework.md) 25 | 1. [PX4](PX4.md) 26 | 1. Debugging 27 | 1. Example applications 28 | 1. [VISLAM ROS example](https://github.com/ATLFlight/ros-examples) 29 | 1. [DFS ROS example](https://github.com/ATLFlight/dfs-ros-example) 30 | 1. Android Tablet Controller Application 31 | 1. [Drone Controller Android Application](https://github.com/ATLFlight/drone-controller) 32 | 1. [Troubleshooting and FAQ](TroubleshootFAQ.md) 33 | 34 | ## License 35 | Content: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), © 2016 Mark Charlebois, Bharath Ramaswamy, James Wilson 36 | -------------------------------------------------------------------------------- /AppsGettingStarted.md: -------------------------------------------------------------------------------- 1 | # Getting Started with apps processor (CPU) development 2 | 3 | This page provides information on setting up your environment to build and run code on the applications processor (CPU). 4 | 5 | 1. [Prerequisites](#prerequisites) 6 | 1. [Building and running sample app](#building-and-running-sample-app) 7 | 1. [More information on environment setup](#more-information-on-environment-setup) 8 | * [Shell limitation](#shell-limitation) 9 | 1. [SDK capabilities and limitations](#sdk-capabilities-and-limitations) 10 | 11 | ## Prerequisites 12 | Install the qrlSDK using the instructions at [Development Environment Setup](DevEnvSetup.md). 13 | 14 | ## Building and running sample app 15 | A "Hello World" sample app is included in the SDK tree. 16 | 17 | To build the sample app: 18 | ``` 19 | > cd /local/mnt/workspace/qrlSdkSrc/sample 20 | > source /local/mnt/workspace/qrlSdkDst/environment-setup- 21 | > make 22 | ``` 23 | 24 | *WARNING:* See [Shell Limitations](#shell-limitation) 25 | 26 | Push the sample app to the target and run it: 27 | ``` 28 | > adb push hello /home/linaro 29 | KB/s ( bytes in s) 30 | > adb shell /home/linaro/hello 31 | Hello world! 32 | ``` 33 | 34 | ## More information on environment setup 35 | The environment setup sets environment variables like CC, CFLAGS, LDFLAGS, so you can source this file, then use a Makefile for the build. The environment variables provide the variables $CC, $CFLAGS, etc., to the Makefile, making it simple to compile/link your code. The environment setup also includes passing --sysroot=xxx to the gcc so the include file and libraries used on the target can be linked with your code. 36 | 37 | ### Shell limitation 38 | Sourcing the SDK's environment setup script renders the user's shell unusable for normal operations other than cross-compilation for the Snapdragon Flight™ apps processor applications. For instance, the ```adb``` may not work. It is suggested that users open another shell to do other operations. 39 | 40 | ## SDK capabilities and limitations 41 | The following types of applications were tested and are supported by this SDK: 42 | - [Camera apps](https://github.com/ATLFlight/ATLFlightDocs/blob/master/CameraProg.md) 43 | 44 | The SDK does NOT support building of the following software. They need to be built on target. 45 | - [VISLAM ROS example](https://github.com/ATLFlight/ros-examples) 46 | -------------------------------------------------------------------------------- /DSPAL.md: -------------------------------------------------------------------------------- 1 | # DSPAL 2 | 3 | The DSP Abstraction Layer (DSPAL) provides a mostly POSIX compliant 4 | interface to ease the porting of code from Linux or another POSIX 5 | compliant OS to the Hexagon DSP. 6 | 7 | ## Using DSPAL 8 | 9 | The header file for DSPAL are maintained at: http://github.com/ATLFlight/dspal 10 | 11 | Support for DSPAL is built into the DSP image for Snapdragon Flight. 12 | These files are available as part of the software available from Intrinsyc. 13 | 14 | The DSP files are located in /lib/firmware in the rootfs installed on the 15 | Snapdragon FLight board. 16 | 17 | ``` 18 | # cd /lib/firmware 19 | # ls adsp* 20 | adsp.b00 adsp.b02 adsp.b04 adsp.b06 adsp.b08 adsp.b11 adsp.mdt 21 | adsp.b01 adsp.b03 adsp.b05 adsp.b07 adsp.b10 adsp.b12 adsp_ver_1.0-r0 22 | ``` 23 | 24 | New versions of DSPAL may require updated DSP images. 25 | 26 | DriverFramework includes dspal as a submodule so you generally do not need to 27 | build dspal directly unless you wish to run the test SW. 28 | 29 | ## Building the test SW 30 | 31 | ``` 32 | git clone https://github.com/ATLFlight/dspal 33 | cd dspal/test 34 | make 35 | make load 36 | ``` 37 | 38 | ### Checking the DSP SW version 39 | 40 | There is a utility to check the version of the DSP SW. 41 | 42 | Connect the Snapdragon Flight board via micro USB connector for ADB. 43 | 44 | Then get a shell on the device: 45 | 46 | ``` 47 | adb shell 48 | # cd /home/linaro 49 | # ./version_test 50 | # exit 51 | ``` 52 | 53 | Amongst the debug output you should see something like: 54 | 55 | ``` 56 | version: DSPAL_VERSION_STRING=DSPAL-1.0.1.0001 57 | build date: BUILD_DATE_STRING=Feb 2 2016 58 | build time: BUILD_TIME_STRING=19:10:21 59 | ``` 60 | 61 | ### Running the DSPAL Unit Tests 62 | 63 | Part of the test SW is a DSPAL unit test. You will need to run mini-dm 64 | to see the output from the DSP. 65 | 66 | In a new terminal, run: 67 | ``` 68 | ${HEXAGON_SDK_ROOT}/tools/debug/mini-dm/Linux_Debug/mini-dm 69 | ``` 70 | 71 | To run the unit test: 72 | 73 | ``` 74 | adb shell 75 | # cd /home/linaro 76 | # ./dspal_tester 77 | # exit 78 | ``` 79 | 80 | ## ADSP keep alive 81 | In the case of a kernel panic, the default software behavior is to perform a system restart. In many cases this is undesirable, as it resets the ADSP processor which can be running software such as a flight stack. An ADSP keep alive feature has been introduced which disables the system restart during kernel panics. This allows the software on the ADSP to continue running when a kernel panic has been triggered. 82 | 83 | By default, this feature is disabled to allow for debugging kernel panics. To enable the feature, set KEEP_ALIVE to 1 in the ```/usr/local/qr-linux/q6-admin.sh``` on target and then reboot the target. 84 | -------------------------------------------------------------------------------- /HelloWorld.md: -------------------------------------------------------------------------------- 1 | # Hello World 2 | 3 | The following instructions describe how to compile and run a hello world program on the Hexagon DSP. 4 | 5 | This guide assumes that the steps in [Getting Started](GettingStarted.md) have already been completed. 6 | 7 | Clone the [HelloWorld project](https://github.com/ATLFlight/HelloWorld) and build it 8 | 9 | ``` 10 | host%> git clone https://github.com/ATLFlight/HelloWorld 11 | ``` 12 | ## Build using QURT_BUNDLE 13 | 14 | ``` 15 | host%> cd HelloWorld/bundle 16 | host%> make 17 | ``` 18 | Connect the device via ADB and make sure it can be found. 19 | ``` 20 | adb devices 21 | ``` 22 | You should see something like: 23 | ``` 24 | $ adb devices 25 | List of devices attached 26 | 997e5d3a device 27 | ``` 28 | 29 | Then load the ARM and DSP portions of the HelloWorld application. 30 | ``` 31 | host%> make load-bundle 32 | ``` 33 | 34 | Run mini-dm to see the output from the DSP 35 | 36 | ``` 37 | host%> ${HEXAGON_SDK_ROOT}/tools/debug/mini-dm/Linux_Debug/mini-dm 38 | ``` 39 | 40 | Open an new shell and run the application on the target. Note that when using 41 | QURT_BUNDLE, the apps proc app has "\_app" appended to differentiate the 42 | helloworld library and the helloworld app, otherwise cmake is confused. 43 | 44 | ``` 45 | host%> adb shell 46 | target#> /home/linaro/helloworld 47 | Asking DSP to say hello 48 | ``` 49 | 50 | You should see the following output on the terminal running mini-dm: 51 | 52 | ``` 53 | DMSS is connected. Running mini-dm... 54 | 55 | [08500/00] 40:27.640 HAP:12365:Hello World 0006 helloworld_qurt.c 56 | 57 | ``` 58 | 59 | ## Build using separate builds for apps proc and aDSP proc 60 | 61 | ``` 62 | host%> cd HelloWorld 63 | host%> make 64 | ``` 65 | Connect the device via ADB and make sure it can be found. 66 | ``` 67 | adb devices 68 | ``` 69 | You should see something like: 70 | ``` 71 | $ adb devices 72 | List of devices attached 73 | 997e5d3a device 74 | ``` 75 | 76 | Then load the ARM and DSP portions of the HelloWorld application. 77 | ``` 78 | host%> make load 79 | ``` 80 | 81 | Run mini-dm to see the output from the DSP 82 | 83 | ``` 84 | host%> ${HEXAGON_SDK_ROOT}/tools/debug/mini-dm/Linux_Debug/mini-dm 85 | ``` 86 | 87 | Open an new shell and run the application on the target 88 | 89 | ``` 90 | host%> adb shell 91 | target#> /home/linaro/helloworld 92 | Asking DSP to say hello 93 | ``` 94 | 95 | You should see the following output on the terminal running mini-dm: 96 | 97 | ``` 98 | DMSS is connected. Running mini-dm... 99 | 100 | [08500/00] 40:27.640 HAP:12365:Hello World 0006 helloworld_qurt.c 101 | 102 | ``` 103 | -------------------------------------------------------------------------------- /SnapdragonROSInstallation.md: -------------------------------------------------------------------------------- 1 | # Snapdragon FlightTM ROS installation 2 | 3 | If you are new to ROS, refer to [ROS Start Guide](http://wiki.ros.org/ROS/StartGuide) first to get started. 4 | 5 | 1. [Pre-requisites](#pre-requisites) 6 | * [Platform BSP](#platform-bsp) 7 | 1. [Install ROS on Snapdragon Platform](#install-ros-on-snapdragon-platform) 8 | 1. [Setup ROS workspace](#setup-ros-workspace) 9 | 1. [Setup ROS_IP](#setup-ros_ip) 10 | 11 | # Pre-requisites 12 | 13 | ## Platform BSP 14 | 15 | These instructions were tested with version **Flight_3.1.2**. The latest version of the software can be downloaded from [here](http://support.intrinsyc.com/projects/snapdragon-flight/files) and installed by following the instructions found [here](http://support.intrinsyc.com/projects/snapdragon-flight/wiki) 16 | 17 | **NOTE**: By default the HOME environment variable is not set. Set this up doing the following: 18 | 19 | ``` 20 | adb shell 21 | chmod +rw /home/linaro 22 | echo "export HOME=/home/linaro/" >> /home/linaro/.bashrc 23 | ``` 24 | 25 | If you use SSH, the home environment variable should be set correct after the above step. 26 | If you use ADB, do the following for each session: 27 | 28 | ``` 29 | adb shell 30 | source /home/linaro/.bashrc 31 | ``` 32 | 33 | # Install ROS on Snapdragon FlightTM platform. 34 | 35 | This installation step requires the Snapdragon FlightTM board to be in **station mode** with internet connection. See instructions [here](https://docs.px4.io/en/flight_controller/snapdragon_flight_advanced.html#wifi-settings) to set the board in **station mode** and connect it to your WiFi network. 36 | 37 | **NOTE** Due to an unmet package dependency for *fastcv-internal* on target, the installation of any deb package using apt-get will fail. To resolve this, do the following: 38 | 39 | 40 | ``` 41 | adb shell 42 | apt-get install -f 43 | ``` 44 | 45 | This will prompt you to uninstall the **fastcv-internal** package. Type "Y" to uninstall and continue. 46 | 47 | ## Install the base ROS package on the target 48 | 49 | The following steps are mirrored from [here](http://wiki.ros.org/indigo/Installation/UbuntuARM). Refer to the link for detailed information about each step. 50 | 51 | 1. Set your locale 52 | 53 | ``` 54 | adb shell 55 | sudo update-locale LANG=C LANGUAGE=C LC_ALL=C LC_MESSAGES=POSIX 56 | ``` 57 | 58 | 1. Setup your sources.list 59 | 60 | ``` 61 | adb shell 62 | sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu trusty main" > /etc/apt/sources.list.d/ros-latest.list' 63 | ``` 64 | 65 | 1. Setup your keys 66 | 67 | ``` 68 | adb shell 69 | sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116 70 | ``` 71 | 72 | 1. Installation 73 | 74 | ``` 75 | adb shell 76 | sudo apt-get update 77 | sudo apt-get install ros-indigo-ros-base 78 | ``` 79 | 80 | **NOTE**: If the installation fails with this message: 81 | 82 | ``` 83 | Errors were encountered while processing: 84 | /var/cache/apt/archives/fontconfig-config_2.11.0-0ubuntu4_all.deb 85 | E: Sub-process /usr/bin/dpkg returned an error code (1) 86 | ``` 87 | 88 | try running the following command: 89 | 90 | ``` 91 | sudo apt-get -f -o Dpkg::Options::="--force-overwrite" install 92 | ``` 93 | 94 | **NOTE**: If the installation fails with this message: 95 | 96 | ``` 97 | E: Failed to fetch http://ports.ubuntu.com/ubuntu-ports/pool/main/i/icu/icu-devtools_52.1-3_armhf.deb 502 cannotconnect [IP: 91.189.88.150 80] 98 | ``` 99 | 100 | try running the following command: 101 | 102 | ``` 103 | apt-get update --fix-missing 104 | apt-get install ros-indigo-ros-base 105 | ``` 106 | 107 | 1. Environment Setup 108 | 109 | ``` 110 | adb shell 111 | echo "source /opt/ros/indigo/setup.bash" >> /home/linaro/.bashrc 112 | ``` 113 | 114 | ## Install additional ROS packages on target 115 | 116 | It is recommended to install the following additional ROS packages. 117 | 118 | ``` 119 | adb shell 120 | apt-get install ros-indigo-tf2-ros 121 | ``` 122 | 123 | ## Initialize ROSDEP 124 | Before you can use ROS, you will need to initialize rosdep. rosdep enables you to easily install system dependencies for source you want to compile and is required to run some core components in ROS. 125 | 126 | ``` 127 | adb shell 128 | sudo rosdep init 129 | rosdep update 130 | ``` 131 | 132 | ## Post installation clean-up 133 | 134 | After installing ROS, the OpenCL library gets installed by ROS as well which causes a conflict with camera pipeline. To fix this, do the following: 135 | 136 | ``` 137 | adb shell 138 | dpkg -r libhwloc-plugins 139 | dpkg -r ocl-icd-libopencl1:armhf 140 | ``` 141 | 142 | **NOTE**: OpenCL can be safely removed as there is a version that is installed on the target at /usr/lib. 143 | 144 | # Setup ROS workspace 145 | 146 | These instructions are mirroed from [here](http://wiki.ros.org/catkin/Tutorials/create_a_workspace). Refer to the page for additional/detailed information. 147 | 148 | 1. Source the ROS environment, if not already done. 149 | 150 | ``` 151 | adb shell 152 | source /home/linaro/.bashrc 153 | ``` 154 | 155 | 1. Create ROS workspace 156 | 157 | ``` 158 | mkdir -p /home/linaro/ros_ws/src 159 | cd /home/linaro/ros_ws/src 160 | catkin_init_workspace 161 | ``` 162 | 163 | **NOTE**: The name of the workspace can be anything. For this demonstration, "ros_ws" is used as the name of the workspace. 164 | 165 | Even though the workspace is empty ( there are no packages in the 'src' folder, just a single CMakeLists.txt link ), you can still build the workspace 166 | 167 | ``` 168 | cd /home/linaro/ros_ws 169 | catkin_make 170 | ``` 171 | 172 | "catkin_make" is necessary as it creates the /home/linaro/ros_ws/devel directory. This is where the generated libaries and the executables will be generated. It also generates a new bash setup script which includes the appropriate environment variables for using the "ros_ws" workspace. It is recommended to add this script to the /home/linaro/.bashrc so that the paths are setup correctly. 173 | 174 | ``` 175 | adb shell 176 | echo "source /home/linaro/ros_ws/devel/setup.sh" >> /home/linaro/.bashrc 177 | ``` 178 | 179 | That's it you are ready to start developing with ROS. 180 | 181 | # Setup ROS_IP 182 | 183 | If you plan on using Snapdragon FlightTM in softap mode, it is recommended to set the environment variable ROS_IP in the .bashrc file: 184 | 185 | ``` 186 | echo "export ROS_IP=192.168.1.1" >> /home/linaro/.bashrc 187 | ``` 188 | 189 | 190 | -------------------------------------------------------------------------------- /PX4.md: -------------------------------------------------------------------------------- 1 | # PX4 2 | 3 | This document describes the build and execution procedure for PX4 flight software on the [Snapdragon Flight](https://www.intrinsyc.com/vertical-development-platforms/qualcomm-snapdragon-flight) platform using drivers provided by Qualcomm. 4 | 5 | 1. [Prerequisites](#prerequisites) 6 | 1. [Building with upstream drivers](#building-with-upstream-drivers) 7 | 1. [Building with FC_ADDON drivers](#building-with-fc_addon-drivers) 8 | 1. [Host Setup](#host-setup) 9 | 1. [Building the Code](#building-the-code) 10 | 1. [Installation on Target](#installation-on-target) 11 | 1. [Execution](#execution) 12 | 1. [Known Issues and Limitations](#known-issues-and-limitations) 13 | 1. [More Information](#more-information) 14 | 15 | ## Prerequisites 16 | 17 | To build the PX4 flight stack for Snapdragon Flight, you need to set up the build environment as described in [GettingStarted](GettingStarted.md). 18 | You can optionally build and run [HelloWorld](https://github.com/ATLFlight/ATLFlightDocs/blob/master/HelloWorld.md) to test your setup. 19 | 20 | ## Building with upstream drivers 21 | 22 | This configuration is supported by the PX4 community. For more information on the hardware components required, please see [http://dev.px4.io](http://dev.px4.io/). 23 | 24 | To build code for this configuration, please SKIP the rest of this page and follow the instructions in the official PX4 documentation at [http://dev.px4.io/starting-building.html](http://dev.px4.io/starting-building.html). 25 | 26 | ## Building with FC_ADDON drivers 27 | 28 | The following hardware is supported / tested by this configuration: 29 | * [Snapdragon Flight](https://shop.intrinsyc.com/products/qualcomm-snapdragon-flight-sbc) or [Developer's Edition](https://shop.intrinsyc.com/products/snapdragon-flight-dev-kit) 30 | * [Qualcomm ESC board](http://shop.intrinsyc.com/products/qualcomm-electronic-speed-control-board) 31 | * Spektrum DSM RC Receiver (such as [AT6210](http://www.spektrumrc.com/Products/Default.aspx?ProdID=SPMAR6210)), and a [Compatible Radio](https://www.spektrumrc.com/Air/Radios.aspx) 32 | * MicroHeli 200mm quadcopter airframe (other airframes may work too) 33 | 34 | This configuration uses proprietary UART_ESC and RC Receiver drivers that are provided by the Flight Controller AddOn (FC_ADDON). The upstream PX4 project contains wrappers for these drivers for use by PX4. 35 | 36 | Login to the [Intrinsyc support website](http://support.intrinsyc.com/projects/snapdragon-flight/files) and download the latest Flight Controller AddOn. The Flight Controller AddOn for Snapdragon Flight provides some driver binaries that require wrappers for use with PX4. This repository contains these driver wrappers. 37 | 38 | Following these instructions to build the PX4 flight code for Snapdragon Flight using the driver binaries provided by Qualcomm. 39 | 40 | ### Host Setup 41 | 42 | Follow the instructions [here](https://github.com/ATLFlight/ATLFlightDocs/blob/master/DevEnvSetup.md) to install the tools, setup the environment variables. 43 | 44 | Obtain the Flight Controller AddOn file (\*\_qcom_flight_controller\_\*.zip). The latest version is available from the [Intrinsyc support website](http://support.intrinsyc.com/projects/snapdragon-flight/files). Download and extract it to any location on your linux PC. The environment variable FC_ADDON needs to point to the location of the extracted Snapdragon Flight Controller addon. 45 | 46 | To use these with PX4, do the following: 47 | 48 | ``` 49 | git clone https://github.com/PX4/Firmware 50 | cd Firmware 51 | git checkout tags/v1.7.3 52 | git submodule update --init --recursive 53 | export FC_ADDON= 54 | ``` 55 | 56 | *NOTE:* 57 | - The above git tag is compatible/was tested with platform software version 3.1.3.1 and flight controller addon version 3.1.3.1 available from Intrinsyc [here](http://support.intrinsyc.com/projects/snapdragon-flight/files). Follow the [instructions](https://support.intrinsyc.com/projects/snapdragon-flight/wiki/Get_and_install_the_latest_platform_BSP) therein to complete the installation. 58 | - Later releases at https://github.com/PX4/Firmware/releases MAY work too but have not been tested. 59 | 60 | ### Building the Code 61 | The commands below build the targets for the DSP and the Linux side. Both executables communicate via muORB. 62 | ``` 63 | cd Firmware 64 | make eagle_legacy_default 65 | ``` 66 | 67 | ### Installation on Target 68 | To load the software on the device, make sure the device is booted up, and verify that you can connect to it via USB cable or SSH. 69 | 70 | The PX4 software uses configuration files that need to be copied on target. They are located in the following path: 71 | ``` 72 | Firmware/posix-configs/eagle/ 73 | ``` 74 | 75 | Where refers to the platform or use-case such as: 76 | * hil: Configuration files for hardware-in-the-loop (HIL) simulation 77 | * flight: Configuration files for a generic flight platform 78 | * 200qx: Configuration files customized for the Microheli 200 MM flight platform 79 | 80 | Install the configuration files: 81 | ``` 82 | cd Firmware 83 | adb push ./posix-configs/eagle/200qx/px4.config /usr/share/data/adsp/px4.config 84 | adb push ./posix-configs/eagle/200qx/mainapp.config /home/linaro/mainapp.config 85 | ``` 86 | 87 | *NOTE:* The steps above installed the flight config files for the 200mm flight platform. Please modify the source path and file names based on your platform or use-case. 88 | 89 | Install the PX4 binaries: 90 | ``` 91 | cd Firmware 92 | adb push ./build/posix_eagle_legacy/px4 /home/linaro 93 | adb push ./build/qurt_eagle_legacy/platforms/qurt/libpx4.so /usr/share/data/adsp 94 | adb push ./build/qurt_eagle_legacy/platforms/qurt/libpx4muorb_skel.so /usr/share/data/adsp 95 | ``` 96 | 97 | If not already done, install the aDSP static image and drivers from the Flight Controller AddOn by executing the install script provided in the addon: 98 | ``` 99 | installfcaddon.sh 100 | 101 | installfcaddon.bat 102 | ``` 103 | 104 | ## Execution 105 | Connect to the target via SSH (recommended) or ADB. 106 | 107 | Optionally, remove the following files (that may have been created from a previous run) 108 | ``` 109 | sudo su 110 | cd /home/linaro 111 | rm -rf log 112 | rm -rf dataman 113 | rm -rf rootfs 114 | ``` 115 | 116 | Start the PX4 flight software as follows: 117 | ``` 118 | sudo su 119 | cd /home/linaro 120 | chmod a+x px4 121 | ./px4 mainapp.config 122 | ``` 123 | 124 | To stop the flight stack and exit gracefully, run the following commands in the mainapp shell: 125 | ``` 126 | muorb stop 127 | shutdown 128 | ``` 129 | 130 | ## Known Issues and Limitations 131 | 132 | *NOTE:* This section is applicable to the latest [stable release](#stable-releases) only. 133 | 134 | Only the following modes / configurations / tools have been tested and therefore supported: 135 | - Flight modes 136 | - MANUAL (Angle) mode 137 | - ATLCTL mode 138 | - Quadcopter X airframes 139 | 140 | The following are not functional: 141 | - HITL / HIL mode 142 | 143 | ## More Information 144 | - Running the DSP debug monitor (mini-dm logging tool): https://dev.px4.io/en/debug/system_console.html 145 | - Setting up auto-start of mainapp upon boot up: https://dev.px4.io/en/setup/building_px4.html#qurt--snapdragon-based-boards 146 | - Troubleshooting: https://docs.px4.io/en/flight_controller/snapdragon_flight_advanced.html 147 | - PX4 User Guide: https://docs.px4.io/en 148 | - PX4 Developer Guide: https://dev.px4.io/en 149 | -------------------------------------------------------------------------------- /TroubleshootFAQ.md: -------------------------------------------------------------------------------- 1 | # Troubleshooting and FAQs 2 | This page provides answers to common questions, solutions to common problems and other how-tos. 3 | 4 | 1. [Host computer requirements](#host-computer-requirements) 5 | 1. [Revive board that will not boot](#revive-board-that-will-not-boot) 6 | 1. [Serial console adapter board](#serial-console-adapter-board) 7 | 1. [Older versions](#older-versions) 8 | 1. [Pin compatibility issues](#pin-compatibility-issues) 9 | 1. [apt-get does not work](#apt-get-does-not-work) 10 | 1. [Install OpenCV](#install-opencv) 11 | 1. [WiFi network connection](#wifi-network-connection) 12 | 1. [Wired ethernet connection](#wired-ethernet-connection) 13 | 1. [USB3 cable](#usb3-cable) 14 | 1. [Camera image is rotated](#camera-image-is-rotated) 15 | 1. [USB-to-serial debug cable](#usb-to-serial-debug-cable) 16 | 1. [Debugging ADB problems](#debugging-adb-problems) 17 | 1. [Unable to flash platform BSP](#unable-to-flash-platform-bsp) 18 | 1. [Debugging IMU issues](#debugging-imu-issues) 19 | 1. [GPS support](#gps-support) 20 | 1. [Build your own drone](#build-your-own-drone) 21 | 1. [High network latency with PX4](#high-network-latency-with-px4) 22 | 1. [Enable root login](#enable-root-login) 23 | 24 | ## Host computer requirements 25 | A host PC running Ubuntu 14.04 Linux is recommended for building code, debugging and testing the Snapdragon Flight™ board (newer versions of the OS may work too but may not be tested / supported). 26 | 27 | ## Revive board that will not boot 28 | If your Snapdragon™ Flight board does not boot up, you may be able to recover it in one of the following ways: 29 | 30 | ### Factory reset 31 | This is documented in the "Factory reset" chapter of the Snapdragon Flight User Guide: http://support.intrinsyc.com/documents/125 32 | 33 | ### Fastboot mode 34 | With a *serial console adapter* board (see [here](http://shop.intrinsyc.com/products/snapdragon-flight-dev-kit) for details). Use the following procedure to recover the Snapdragon Flight board: 35 | 1. Disconnect power and USB cable(s) from the Snapdragon Flight and adapter boards. 36 | 2. Plug the serial console adapter board into the Snapdragon Flight board. 37 | 3. Enable (insert jumper) J2 (FASTBOOT) of the *serial console adapter* board. 38 | 4. Connect the debug board’s 3-pin serial port to the computer’s USB port, using the provided USB-to-serial cable, and open a serial terminal (CuteCom or Putty). 39 | 5. Power up the Snapdragon Flight board. 40 | 6. Connect the Snapdragon Flight board to the computer via a USB cable. 41 | 7. Validate the connection by typing “fastboot devices” on a command prompt or terminal window. You should now see the device-specific random number displayed. 42 | 8. You should be able to flash the platform software images at this point. 43 | 44 | To boot the board normally again, perform the following steps: 45 | 1. Unplug the power supply and USB cable. 46 | 2. Remove the jumper from FSTBT (J2) on the serial console adapter board. 47 | 3. Power up the Snapdragon Flight board and connect the board to the computer via a USB cable. 48 | 4. Validate the connection by typing “adb devices” on a command prompt or terminal window. 49 | 50 | *NOTE:* If none of the above options work, please contact [support](https://www.intrinsyc.com/contact-support) to get it reflashed. 51 | 52 | ## Serial console adapter board 53 | The serial console adapter board and cable are available as part of the [Snapdragon Flight developer's edition](http://shop.intrinsyc.com/collections/product-development-kits/products/snapdragon-flight-dev-kit). This allows the board to be accessed through a USB connector for debugging purposes. It also provides jumpers to force the board in fastboot and other special modes if necessary. 54 | 55 | ### Older versions 56 | Some customers may have received an older deprecated version of the serial console adapter board does not include the fastboot jumper support. Please look at the MCN printed on the board to identify it: 57 | - 25-H9563 - Older serial console board, it does not include the fastboot jumper pins 58 | - 25-H9916 - New serial console board, it includes the fastboot jumper pins (J4) 59 | 60 | If you have the older version, please contact [support](https://www.intrinsyc.com/contact-support) to get the newer Serial Console Adapter board. 61 | 62 | ### Pin compatibility issues 63 | Some serial console adapter parts have all 4 pins on the header whereas they should only have 3. If you have such a part, please *clip pin 2* on the header. This allows the FTDI serial cable to be inserted in only 1 way as below: 64 | 65 | Pin 1 (TXD) Orange 66 | Pin 3 (RXD) Yellow 67 | Pin 4 (GND) Black 68 | 69 | ## apt-get does not work 70 | Ensure that the Snapdragon Flight board is configured in [Station mode](https://docs.px4.io/en/flight_controller/snapdragon_flight_advanced.html) and connected to the Internet: 71 | 72 | apt-get on Snapdragon Flight is broken. We need the following work-around to install packages: 73 | 74 | Uninstall certain on-board packages in order to get apt-get to work. 75 | ```apt-get install -f``` 76 | 77 | Install the package(s) that you want using apt-get. 78 | 79 | ## Install OpenCV 80 | The standard way to install OpenCV is: ```apt-get install --fix-missing libopencv-highgui-dev``` 81 | 82 | Since apt-get on Snapdragon Flight is broken, we need to use the following work-around: 83 | 84 | Uninstall certain installed packages in order to get apt-get to work, and then install OpenCV. 85 | ```shell 86 | apt-get install -f 87 | apt-get -o Dpkg::Options::="--force-overwrite" install libglib2.0-dev 88 | apt-get install --fix-missing libopencv-highgui-dev 89 | ``` 90 | 91 | Also please see this post: https://developer.qualcomm.com/forum/qdn-forums/hardware/snapdragon-flight/32904 92 | 93 | ## WiFi network connection 94 | ### Connection setup 95 | To connect Snapdragon Flight board to a WiFi router on the network, please follow these instructions (see Station mode under Wifi-settings): https://docs.px4.io/en/flight_controller/snapdragon_flight_advanced.html 96 | 97 | ### Antenna 98 | A WiFi antenna is NOT included in the kit. It needs be purchased (ex. [Molex part# 146153-0150](http://www.molex.com/molex/products/datasheet.jsp?part=active/1461530150_ANTENNAS.xml)) and installed. See [here](UserGuide.md#wifi-control) for installation and setup. 99 | 100 | ## Wired ethernet connection 101 | The board can be connected to the network over a wired connection via the OTG USB port by using a USB Ethernet adapter (such as http://www.apple.com/shop/product/MC704LL/A/apple-usb-ethernet-adapter OR Linksys USB 3.0 Gigabit Ethernet Adapter - model USB3GIGV1) along with a USB 2.0 Female to Micro USB Male OTG adapter (such as http://www.rakuten.com/prod/268480078.html). 102 | 103 | ## USB3 cable 104 | Any standard USB micro-B cable may be used with the board. But in order to get USB 3.0 SuperSpeed functionality, one requires a MICRO-A PLUG TO STD-A cable (such as the Amphenol RUB30-0075 http://www1.amphenol-ast.com/v3/en/product_view.aspx?id=189). 105 | 106 | ## Camera image is rotated 107 | On some of the newer boards, the 4K camera images are rotated by 90 degrees. This is a known issue. A software resolution is being worked on and will be provided shortly. 108 | 109 | ## USB-to-serial debug cable 110 | The USB-to-Serial Debug Cable that plugs into the Serial Console Adapter is the TTL-232R-3V3 part from FTDI modified to be 4-pins and keying added to prevent incorrect insertion. For more information, see http://www.ftdichip.com/Support/Documents/DataSheets/Cables/DS_TTL-232R_CABLES.pdf. 111 | 112 | ## Debugging ADB problems 113 | - Verify that the Snapdragon Flight target is listed when you type ```adb devices``` on the host computer? 114 | - Do ```ls -l /etc/udev/rules.d``` and check for the existance of the 51-android.rules file. 115 | - Verify that the following lines are present in your ```/etc/udev/rules.d/51-android.rules``` file? If not, add them and try again. 116 | ``` 117 | #for Device adb interface 118 | SUBSYSTEM=="usb", ATTR{idVendor}=="05c6", MODE="0666", GROUP="plugdev" 119 | #for Fastboot bootloader interface 120 | SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666", GROUP="plugdev" 121 | ``` 122 | - Do ```lsusb``` on the host PC after the Snapdragon Flight board is connected and powered up. You must see an entry for the target (usually listed as ```Qualcomm, Inc. Qualcomm HSUSB Device```). 123 | - Do ```adb kill-server``` and then ```adb start-server``` and try again? 124 | - If none of this works, verify that adb is functional on your host computer by connecting a phone or other device. 125 | - Try replacing the cable. Sometimes the microUSB 3.0 cable does not work, and you might need a microUSB 2.0 cable. 126 | 127 | ## Unable to flash platform BSP 128 | If you're unable to flash the platform BSP using the [intructions here](http://support.intrinsyc.com/projects/snapdragon-flight/wiki/Get_and_install_the_latest_platform_BSP), please try the following: 129 | - Execute the jflash script as root 130 | - If the Snapdragon Flight board is powered through the [Electronic Speed Controller (ESC) board](https://shop.intrinsyc.com/products/qualcomm-electronic-speed-control-board), the installation is known to sometimes fail. The workaround is to unplug the ESC board from the Snapdragon Flight board, and power the latter through the power adapter and 5V DC power supply that are available as part of the [Development kit](https://shop.intrinsyc.com/products/snapdragon-flight-dev-kit). 131 | 132 | ## Debugging IMU issues 133 | Do the following steps if you experience issues that may be due to IMU data. This is a test utility to verify that IMU data is being received correctly. 134 | 135 | On the host machine via a separate terminal (*optional*): 136 | ``` ${HEXAGON_SDK_ROOT}/tools/mini-dm/Linux_Debug/mini-dm ``` 137 | 138 | On the target: 139 | 140 | ```shell 141 | cd /usr/bin 142 | 143 | # Run the imu_app (in the background) 144 | ./imu_app & 145 | 146 | # Run the sensor_imu_tester app for 'n' seconds 147 | ./sensor_imu_tester 148 | ## It should run and then say "test completed..." 149 | ## It should log the IMU data in a file called IMU_*.txt 150 | 151 | # Stop the imu_app 152 | VAR=$(ps -eaf | grep imu_app | grep -v grep | awk '{print $2}' | cut -d' ' -f2); kill $VAR 153 | ``` 154 | 155 | If the IMU_*.txt file was not created or the IMU data in it does not look correct, please try the following: 156 | - Ensure that you installed the latest versions platform BSP and flight controller addon from [here] (http://support.intrinsyc.com/projects/snapdragon-flight). 157 | - Post your issue on the [QDN forum](https://developer.qualcomm.com/forums/hardware/snapdragon-flight) with a snippet of the target console log as well as the log from mini-dm. 158 | 159 | ## GPS support 160 | The on-board GPS module on the Snapdragon Flight™ is *not* supported. Please check this page for other options: https://dev.px4.io/hardware-snapdragon.html 161 | 162 | ## Build your own drone 163 | An almost ready-to-fly drone kit compatible with Snapdragon Flight™ and [Snapdragon Navigator](https://developer.qualcomm.com/hardware/snapdragon-flight/sd-navigator)™ called the [Dragon Drone Development Kit](https://worldsway.com/product/dragon-drone-development-kit) is now available. See [this post](https://developer.qualcomm.com/forum/qdn-forums/hardware/snapdragon-flight/34688) for more information. This is the *recommended* option. 164 | 165 | Other options are as follows: 166 | - Please see [this document](https://support.intrinsyc.com/documents/162) for instructions on how to build your own UAV using the Snapdragon Flight™ board including components, assembly, programming and flying. 167 | - The PX4 community also recommends another airframe setup. Details are available here: https://dev.px4.io/en/flight_controller/snapdragon_flight.html 168 | 169 | ## High network latency with PX4 170 | WiFi latency can increase to several seconds when PX4 flight stack is started. This could happen when MAVLink is running but QGroundControl is not. To fix this problem, start QGroundControl on the host PC or device that connects to the target. 171 | 172 | ## Enable root login 173 | Ensure that your board is in SoftAP Mode (See the Wi-Fi section in this [User Guide](http://support.intrinsyc.com/projects/snapdragon-flight/documents) for details). 174 | 175 | ``` 176 | # Set the root password on the board 177 | echo root: | chpasswd 178 | 179 | # Backup the ssh configuration file 180 | cp -p /etc/ssh/sshd_config /etc/ssh/sshd_config.backup 181 | ``` 182 | 183 | Allow incoming SSH connections as root by editing the ```PermitRootLogin``` line in the file ```/etc/ssh/sshd_config``` as follows: 184 | ```PermitRootLogin yes``` 185 | 186 | Reboot the target 187 | 188 | You should now be able to login to the target as follows: 189 | ```ssh root@``` 190 | - Enter the root password when prompted based on the value that you assigned earlier. 191 | -------------------------------------------------------------------------------- /UserGuide.md: -------------------------------------------------------------------------------- 1 | # Snapdragon Flight User Guide 2 | This page provides useful information about the Qualcomm® Snapdragon™ Flight Kit (Developer's edition) available [here](https://www.intrinsyc.com/vertical-development-platforms/qualcomm-snapdragon-flight). The Qualcomm® Snapdragon Flight™ is a highly integrated board based on a Qualcomm® Snapdragon™ 801 series processor that targets consumer drones and robotics applications. 3 | 4 | # Table of Contents 5 | 1. [Logging](#logging) 6 | - [aDSP](#adsp) 7 | - Apps processor 8 | 1. [Flight Control](#flight-control) 9 | 1. [WiFi control](#wifi-control) 10 | 1. [RC radio control](#rc-radio-control) 11 | 1. [aDSP SDK](#adsp-sdk) 12 | 1. [Device path to hardware port mapping and runtime configuration](#device-path-to-hardware-port-mapping-and-runtime-configuration) 13 | 1. [Camera](#camera) 14 | 1. [Acronyms and abbreviations](#acronyms-and-abbreviations) 15 | 1. [Additional references](#additional-references) 16 | 17 | ## Logging 18 | ### aDSP 19 | The mini-diagnostic monitor (mini-dm) is used to get debug messages from the DSP (including the FastRPC application) using the following procedure: 20 | 21 | 1. Download and install the [Hexagon SDK](https://developer.qualcomm.com/software/hexagon-dsp-sdk/tools) on your host machine. 22 | 2. Navigate to the mini-dm executable location: ``` ${HEXAGON_INSTALL_HOME}/Qualcomm/Hexagon_SDK/3.0/tools/debug/mini-dm/Linux_Debug ``` 23 | 3. Connect the USB cable from the Snapdragon Flight board to the host machine where the mini-dm is installed. 24 | 4. Run the mini-dm using the following command: ``` ./mini-dm ``` 25 | 5. Run the FastRPC or other application that loads the aDSP module. For more information, see the Hexagon SDK documentation located at ```${HEXAGON_INSTALL_HOME}/Qualcomm/Hexagon_SDK/3.0/docs/index.html``` 26 | 6. For more information on mini-dm, see this [FAQ](https://developer.qualcomm.com/forum/qdn-forums/mobile-technologies/multimedia-optimization-hexagon-sdk/toolsinstallation/27111). 27 | 28 | ### Apps processor 29 | #### Serial console logging 30 | More information coming soon. 31 | 32 | ## Flight Control 33 | Flight control commands are transmitted over a Wi-Fi or RC communication link. 34 | ### WiFi control 35 | The Wi-Fi communication link can transmit commands to the unmanned aerial vehicle (UAV). 36 | For information on installation of antennas for Wi-Fi, see Qualcomm Snapdragon Flight User Guide (80-H9581-1). 37 | #### UAV setup 38 | By default, the system should come up in SoftAP mode. If the default is not set, this configuration can be enable with the following steps: 39 | 1. Enable AP mode and reboot. See [here](http://dev.px4.io/advanced-snapdragon.html#wifi-settings) for additional information. 40 | 2. The AP mode defaults with automatic channel selection (ACS), which selects a 2.4 GHz channel with the least interference. If this is not the desired provisioning, this can be configured manually. Scan for other APs in the vicinity and configure SoftAP with a channel unlikely to suffer from interference with other devices. See the official [User Guide](http://support.intrinsyc.com/documents/125) for additional information. 41 | 3. Once SoftAP mode is enabled, run the following command (through adb or serial console to the UAV) to determine its server set identifier (SSID): 42 | ```/usr/local/qr-linux/wificonfig.sh –g``` 43 | 4. When the PX4 flight stack is installed, this should include provisioning for MavLink communication to allow commands to be received and used by the flight stack. See the [QGroundControl documentation](https://donlakeflyer.gitbooks.io/qgroundcontrol-user-guide/content) for additional details. 44 | #### View FPV video stream 45 | It also is possible to stream the FPV from the drone. This feature currently is currently in alpha state. 46 | Connect to the drone and start the flight software as usual. The FPV reads from an RTSP server running on the drone. 47 | The RTSP server can be started manually using the following command: 48 | ```qcamvid –c hires –f auto –o /dev/null –t 600``` 49 | The argument to “-t” is the video stream duration in seconds (the video stream will stop after that length of time, which will cause the FPV on the app to fail since there is no more video streaming). 50 | * -c is the type of camera. 51 | * -f is the focus mode. The example command above sets it in Auto mode. 52 | * -o is video output file name. The example command above does not keep the video file, and instead pipes it to /dev/null. 53 | 54 | *NOTE:* For more information on these options, use the qcamvid --help option. 55 | 56 | The MPlayer application can be used to stream the video to a Linux and Windows laptop. For instance, users can run MPlayer on a Windows laptop while connected to the drone in AP mode. 57 | * Command to start mplayer on a laptop: ``` mplayer rtsp:///fpvview --nocache --fps 30``` 58 | * If the drone is in AP mode, the command is: 59 | ```mplayer rtsp://192.168.1.1/ fpvview --nocache --fps 30``` 60 | * If the drone is in station mode, where the IP address of the drone is 10.73.189.56, the command is: 61 | ```mplayer rtsp://10.73.189.56 fpvview --nocache --fps 30``` 62 | 63 | *NOTE:* If there are any issues with the streaming, restart the client and server apps. 64 | #### Spektrum transmission over WiFi 65 | The Spektrum transmitter can send control commands over Wi-Fi. 66 | When running the PX4 flight stack for instance, a standard RC transmitter can be connected via the AeroSIM RC dongle to a laptop computer running the QGroundControl application. The RC transmitter relays commands to the QGroundControl application, which are then transmitted to the UAV over Wi-Fi. 67 | #### Setup QGroundControl application 68 | When running the PX4 flight stack, the QGroundControl application running on a Wi-Fi-enabled Windows laptop computer needs to be set up as per the instructions here: https://donlakeflyer.gitbooks.io/qgroundcontrol-user-guide/content 69 | ### RC radio control 70 | Connect your RC receiver to the Snapdragon Flight board. 71 | To set up your transmitter, see the instruction manual at http://www.spektrumrc.com/Air/Radios.aspx corresponding to your make and model (tested with DX6i or later). 72 | To bind your transmitter to the receiver on your UAV, see the binding section of the manual corresponding to your receiver: http://www.spektrumrc.com/Air/Receivers.aspx. 73 | Once the system has powered up, the transmitter joysticks and switches may be used to control and operate the UAV (including arm, disarm, pitch, yaw, roll, altitude, and navigation). 74 | Consult your flight stack software documentation for details on operating the UAV using the transmitter in various modes of operation. (For PX4, see https://pixhawk.org/peripherals/radio-control/start and http://px4.io/docs/px4-autopilot/flying). 75 | 76 | ## aDSP SDK 77 | The SDK includes the following: 78 | - The Flight Controller AddOn file (*_qcom_flight_controller_*.zip) which is the Qualcomm add-on for the flight controller. The latest version is available from this [support website](http://support.intrinsyc.com/projects/snapdragon-flight/files). 79 | - NOTE: A default version of the add-on is pre-installed on target. In some cases, a new add-on may be available at the above URL that may contain additional features or fixes. In that situation, please download and extract the ZIP file, and execute the installation script therein to install the contents on target. 80 | - The Hexagon SDK which provides a complete environment and means for generating dynamic Hexagon DSP code to customize and extend the features of the aDSP. Refer to the following link for the general Hexagon Digital Signal Process (DSP) SDK development guide: https://developer.qualcomm.com/software/hexagon-dsp-sdk. 81 | 82 | ### aDSP/Hexagon developer guide 83 | Refer to the file docs/index.html in the Hexagon SDK available from https://developer.qualcomm.com/software/hexagon-dsp-sdk/tools. 84 | 85 | ### DSP abstraction layer API 86 | The DSP abstraction layer (DSPAL) provides a standard interface for porting code to the application digital signal processor (aDSP) (Hexagon) processor. The DSPAL code and more information is available [here](DSPAL.md) and [here](https://github.com/ATLFlight/dspal). 87 | 88 | ## Device path to hardware port mapping and runtime configuration 89 | ### Overview 90 | The APQ8074 has 12 BLSP ports, each of which can be configured as serial peripheral interface (SPI), inter-integrated circuit (I2C), or universal asynchronous receiver transmitter (UART), etc. These ports are shared between the aDSP and the apps processor. To isolate the BAM low-speed peripheral (BLSP) port usage between the two subsystems, we can define BLSP port allocation in the TrustZone (TZ) module. Subsystems that access BLSP ports not owned by them result in a system crash. 91 | In DspAL, we provide a device path to hardware mapping in the following manner: 92 | - SPI: ```/dev/spi-[1-12]``` represents SPI device on BLSP 1 to 12 93 | - I2C: 94 | - ```/dev/i2c-[0-11]``` represents I2C device on BLSP 1 to 12 95 | OR 96 | - ```/dev/iic-[1-12]``` represents I2C device on BLSP 1 to 12 97 | - UART: ```/dev/tty-[1-4]``` 98 | 99 | *NOTE:* 100 | - The /dev/i2c-[0-11] numbering convention will be deprecated soon. Update your software to use the /dev/iic-[1-12] device numbering convention. 101 | - Up to four UART devices are supported. Each UART device is associated with a BAM device. 102 | Selecting any BLSP port as an SPI or I2C device is already supported in DspAL. The following section describes how to configure UART to BAM port mapping at runtime. 103 | 104 | ### How it works 105 | During boot time, the aDSP loads a BLSP configuration file to initialize the UART devices. To enable run time configuration, define the UART device to BAM port mapping in the file /usr/share/data/adsp/blsp.config. 106 | The following is a sample blsp.config file showing the default board UART to BAM mapping: 107 | ``` 108 | tty-1 bam-9 2-wire 109 | tty-2 bam-6 2-wire 110 | tty-3 bam-8 2-wire 111 | tty-4 bam-2 2-wire 112 | ``` 113 | Each line begins with the UART device name "tty-[x]" where x is between 1 and 4 inclusive. The device name is followed by a space and bam-[y] where y is between 1 and 12 inclusive. To indicate that the UART should only use two wires, one to receive and the other to transmit, include the text "[2-wire]" at the end of the line. 114 | 115 | Note the following: 116 | - Not all four UART devices need to be configured. Developers may enable fewer than four UART devices. 117 | - In case the config file does not exist or loading the file fails due to the incorrect format, the default settings listed above will be used. 118 | - After creating and editing the ```/usr/share/data/adsp/blsp.config``` file, it is recommended to set the file to read-only mode. 119 | - If the two-wire designation is not included, the UART defaults to using four wires: receive data, transmit data, clear to send (CTS), and receive to send (RTS) 120 | This will cause a problem for any other type of I/O on the same connector, since the pins will be configured as RTS and CTS signals. 121 | 122 | #### Sample logs 123 | During aDSP boot time, the status of the run time configuration operation is shown in the mini-dm logs. 124 | The following is a sample log when the run time configuration was successful and the /usr/share/data/adsp/blsp.config was successfully loaded. 125 | ``` 126 | QDSP6/High00:04:21.725 blsp_config.c 00189 loading BLSP configuration 127 | QDSP6/High00:04:21.726 blsp_config.c 00208 opened /usr/share/data/adsp/blsp.config 128 | QDSP6/High00:04:21.726 blsp_config.c 00170 UART tty-1: BAM-6 129 | QDSP6/High00:04:21.726 blsp_config.c 00170 UART tty-2: BAM-9 130 | QDSP6/High00:04:21.726 blsp_config.c 00170 UART tty-3: BAM-2 131 | QDSP6/High00:04:21.726 blsp_config.c 00170 UART tty-4: BAM-8 132 | QDSP6/High00:04:21.727 main.c 00268 BLSP configuration loaded 133 | ``` 134 | The following is a sample log when the run time configuration failed and the /usr/share/data/adsp/blsp.config file did not exist. In this case, the aDSP uses default UART to BAM mappings. 135 | ``` 136 | QDSP6/Medium00:00:43.775 file.c 00162 HAP:159:open file blsp.config in mode rb 137 | QDSP6/High00:00:43.776 file.c 00167 HAP:159:unable to open the specified file path 138 | QDSP6/Fatal00:00:43.776 blsp_config.c 00204 failed to open /usr/share/data/adsp/blsp.config 139 | QDSP6/Fatal00:00:43.776 main.c 00261 QDSP6 Main.c: blsp_config_load() failed 140 | QDSP6/High00:00:43.776 blsp_config.c 00035 Loaded default UART-BAM mapping 141 | QDSP6/High00:00:43.776 blsp_config.c 00043 UART tty-1: BAM-9 142 | QDSP6/High00:00:43.776 blsp_config.c 00043 UART tty-2: BAM-6 143 | QDSP6/High00:00:43.776 blsp_config.c 00043 UART tty-3: BAM-8 144 | QDSP6/High00:00:43.776 blsp_config.c 00043 UART tty-4: BAM-2 145 | ``` 146 | 147 | ## Camera 148 | ### Take a picture 149 | The following is required to take a picture: 150 | - The ```camera::ICameraDevice::takePicture()``` function triggers the capture of a snapshot. 151 | - The caller must wait for the snapshot frame to be delivered before additional pictures can be taken. 152 | - The output snapshot image is delivered in the ```camera::ICameraListener::onPictureFrame()``` callback. This function should awaken the waiting thread. 153 | - The snapshot dimensions and format can be set using the corresponding parameters defined in ```camera::CameraParams```. 154 | 155 | ### Sequence diagram 156 | Below is the call flow sequence diagram for a typical camera use case: 157 | ![Image](./camera-sequence-diagram.jpg?raw=true) 158 | 159 | ### Use cases 160 | For specific use cases of the API, such as stereo camera streaming, raw preview, and high framerate support, refer to the application note in the example test application. This application is located at: https://source.codeaurora.org/quic/le/platform/hardware/qcom/camera/tree/libcamera?h=LNX.LER.1.2. 161 | 162 | ## Acronyms and abbreviations 163 | - BAM: Bus access manager 164 | - BLSP: BAM low-speed peripheral 165 | 166 | ## Additional references 167 | Please refer to the following pages and documents for additional information: 168 | - User Guide and Developer Guide documents at: http://support.intrinsyc.com/projects/snapdragon-flight/documents 169 | - Information on pinouts, connectors and peripherals: http://dev.px4.io/hardware-snapdragon.html 170 | - Useful information and How-To's: http://dev.px4.io/advanced-snapdragon.html 171 | --------------------------------------------------------------------------------