Raspberry Pi Quick Start
Introduction
The E-Port Developer Kit converts the aircraft's E-Port interface into various standard hardware interfaces, facilitating hardware device connection and SDK development debugging. For the list of aircraft models supported by the E-Port Developer Kit and their compatible interfaces, refer to the Standard Hardware Interface and Development Kit Table.
This guide is based on the M350 RTK aircraft, E-Port Developer Kit, and Raspberry Pi 4B Developer Kit, outlines the development steps, from hardware connection, software environment setup, development package obtaining, to compilation and execution. It aims to assist you in getting familiar with PSDK (Payload SDK) development. This example works for all aircraft models supported by PSDK.
Basic Information
Below are the hardware devices used in this tutorial. It's recommended to get yourself familiar with them before reading this tutorial:
Hardware Environment Setup
1. Necessary Hardware
Hardware Item | Quantity | Purpose |
---|---|---|
Raspberry Pi 4B Developer Kit | 1 | PSDK Operating Platform |
High-Definition Monitor (HDMI) + HDMI Cable | 1 | Display interface for Ubuntu system on the developer board |
Keyboard + Mouse | 1 | Human-computer interaction for Ubuntu system on the developer board |
Wireless Network Interface Controller/ Ethernet Cable | 1 | Internet access for the developer board |
E-Port Developer Kit | 1 | Connect the developer board to the aircraft |
M350 RTK Aircraft + Accessories (Remote Controller + Battery + Payload + Charger) | 1 | Hardware development platform |
Laptop/Desktop PC | 1 | Connect to aircraft/payload for upgrades and simulator use |
USB to TTL Serial Module | 1 | Connect the developer board to E-Port Developer Kit |
USB-C to USB Cable | 2 | Connect the aircraft's USB-C port for aircraft/payload upgrades and simulator use on PC |
USB-C OTG Adapter Cable | 1 | Connect the developer board to E-Port Developer Kit |
2.54mm Dupont Lines | Several | Connect the developer board to E-Port Developer Kit |
2. Hardware Connection
- Prepare a high-definition monitor, a keyboard, a mouse, and a clean workspace.
- Setup a M350 RTK aircraft, install the battery, and place the aircraft in an appropriate position on the workspace.
- If flight control is needed, connect the aircraft's USB-C port (next to the E-Port interface) to a laptop or desktop PC with a USB-C cable.
- Refer to the Figure. Aircraft Device Connection and connect the E-Port Developer Kit to the aircraft:
- Ensure the power switch (Marker 7) on the E-Port Developer Kit is in the OFF position.
- Connect the USB-C port (Marker 2) of the E-Port Developer Kit to the aircraft's E-Port, and note the A/B sides.

Figure. Aircraft Device Connection
As depicted in the Figure. Raspberry Pi 4B and Figure. Raspberry Pi 4B Developer Board Connection, connect the E-Port Developer Kit to the Raspberry Pi 4B Developer Board. For details about the 40-pin GPIO on the developer board, see the Pin Introduction.
- Use dupont lines to connect the UART (Marker 5) on the E-Port Developer Kit to the USB to TTL Serial Module (TX, RX, and GND of the Developer Kit to RX, TX, and GND of the serial module respectively).
- Connect the USB to TTL Serial Module to the USB 3.0 port (Marker f) of the Raspberry Pi 4B Developer Board.
- Set the USB host/device toggle switch (Marker 3) on the E-Port Developer Kit to the Host position.
- Using the USB-C OTG adapter and USB-C cable, connect the USB (Marker 6) on the E-Port Developer Kit to the USB-C (Marker a) on the developer board.
- Connect the PPS pin (Marker 5) on the E-Port Developer Kit to pin 7 (Marker h) on the 40-pin GPIO of the developer board. For time sync purposes, refer to the Pin Introduction. Skip this step if time sync isn't necessary.
- Connect the micro HDMI output (Marker b or c) of the Developer Board to the monitor. Connect the keyboard and mouse to the USB port (Marker a), and connect to WIFI or to a Ethernet cable with internet capabilities to the Ethernet port (Marker e) of the developer board, respectively.
- Make sure all connections are secure and correct.

Figure. Raspberry Pi 4B

Figure. Raspberry Pi 4B Developer Board Connection
Start the aircraft, turn on the power switch of the E-Port Developer Kit, ensure the green LED indicator is on and no red LED indicators are active, and check if the developer board is powered on.
Monitor the display to make sure that the developer board has entered the startup page.
Software Environment Setup
1. Set Up the Software Environment
The Raspberry Pi 4B Developer Kit does not include an SD card and Raspberry Pi OS 64 bit system image by default. Follow the Raspberry Pi Imager for image programming and account setup.
After completing the Hardware Setup and startup, enter your configured account and password to check if you can log into the Ubuntu desktop system.
On the desktop, verify the Raspberry Pi 4B's network connectivity using any browser webpage.
Before running PSDK, install the following dependencies using the shell commands provided. Ensure successful installation.
- FFmpeg
- ffplay
- OpenCV
- libaio
- CMake
- libusb
/* Update software repository */ sudo apt-get update sudo apt-get upgrade /* Install libaio */ sudo apt-get install automake sudo apt-get install libaio-dev /* Download opus-1.3.1 source code from https://opus-codec.org/ and install it */ tar -xzvf opus-1.3.1.tar.gz cd opus-1.3.1/ autoreconf -f -i ./configure make -j4 && sudo make install /* Download ffmpeg 4.3 source code from github and install it */ tar -zxvf ffmpeg-4.3.2.tar.gz ./configure --enable-shared make -j4 sudo make install /* Download opecv 3.4.15 source code from https://opencv.org/releases/ and install it */ unzip opencv-3.4.15.zip cd opencv-3.4.15/ mkdir build && cd build/ cmake ../ make -j4 && sudo make install /* Check opencv version*/ opencv_version /* Install libusb */ sudo apt-get install libusb-1.0-0-dev
2. Enable Raspberry Pi 4B's USB bulk function
PSDK offers a Raspberry Pi 4B Usb Bulk Configuration File,including the configuration script (psdk-usb-configure.sh) and configuration program (startup_bulk).
3. Register for a PSDK Developer Account
Register on the DJI Developer website to become a PSDK developer.
4. Download PSDK Software Package
Retrieve the latest PSDK software development package from the Payload-SDK repository on master branch.
5. Update Required Configuration Code
Note: The sample code of Raspberry is the same as Nvidia Jetson Nano, please refer to the code in the PSDK GitHub repository under
nvidia_jetson
path
After creating an application in the developer user center, input the generated PSDK application information into the specified files from the previously downloaded PSDK software package. PSDK can not run without filling in the information.
- samples/sample_c/platform/linux/manifold2/application/dji_sdk_app_info.h
- samples/sample_c++/platform/linux/manifold2/application/dji_sdk_app_info.h
/* Exported constants --------------------------------------------------------*/
// ATTENTION: User must goto https://developer.dji.com/user/apps/#all to create your own dji sdk application, get dji sdk application
// information then fill in the application information here.
#define USER_APP_NAME "your_app_name"
#define USER_APP_ID "your_app_id"
#define USER_APP_KEY "your_app_key"
#define USER_APP_LICENSE "your_app_license"
#define USER_DEVELOPER_ACCOUNT "your_developer_account"
#define USER_BAUD_RATE "460800"
Based on the connection between the aircraft and the Raspberry Pi Developer Board, modify the PSDK hardware connection configuration file accordingly.
- samples/sample_c/platform/linux/manifold2/application/dji_sdk_config.h
- samples/sample_c++/platform/linux/manifold2/application/dji_sdk_config.h
#define DJI_USE_ONLY_UART (0)
#define DJI_USE_UART_AND_USB_BULK_DEVICE (1)
#define DJI_USE_UART_AND_NETWORK_DEVICE (2)
/*!< Attention: Select your hardware connection mode here.
* */
#define CONFIG_HARDWARE_CONNECTION DJI_USE_UART_AND_NETWORK_DEVICE
If using the DJI_USE_UART_AND_NETWORK_DEVICE connection, configure the currently used wireless network interface controller device name, VID, and PID in the following files.
- samples/sample_c/platform/linux/manifold2/application/dji_sdk_config.h
- samples/sample_c++/platform/linux/manifold2/application/dji_sdk_config.h
/** @attention User can config network card name here, if your device is not MF2C/G, please comment below and add your
* NIC name micro define as #define 'LINUX_NETWORK_DEV "your NIC name"'.
*/
#ifdef PLATFORM_ARCH_x86_64
#define LINUX_NETWORK_DEV "enxf8e43b7bbc2c"
#else
#define LINUX_NETWORK_DEV "l4tbr0"
#endif
/**
* @attention
*/
#ifdef PLATFORM_ARCH_x86_64
#define USB_NET_ADAPTER_VID (0x0B95)
#define USB_NET_ADAPTER_PID (0x1790)
#else
#define USB_NET_ADAPTER_VID (0x0955)
#define USB_NET_ADAPTER_PID (0x7020)
#endif
If using the DJI_USE_UART_AND_USB_BULK_DEVICE connection, configure the current USB Bulk endpoint in these files:
- samples/sample_c/platform/linux/manifold2/application/dji_sdk_config.h
- samples/sample_c++/platform/linux/manifold2/application/dji_sdk_config.h
#define LINUX_USB_BULK1_EP_OUT_FD "/dev/usb-ffs/bulk1/ep1"
#define LINUX_USB_BULK1_EP_IN_FD "/dev/usb-ffs/bulk1/ep2"
#define LINUX_USB_BULK1_INTERFACE_NUM (2)
#define LINUX_USB_BULK1_END_POINT_IN (0x83)
#define LINUX_USB_BULK1_END_POINT_OUT (2)
#define LINUX_USB_BULK2_EP_OUT_FD "/dev/usb-ffs/bulk2/ep1"
#define LINUX_USB_BULK2_EP_IN_FD "/dev/usb-ffs/bulk2/ep2"
#define LINUX_USB_BULK2_INTERFACE_NUM (3)
#define LINUX_USB_BULK2_END_POINT_IN (0x84)
#define LINUX_USB_BULK2_END_POINT_OUT (3)
#ifdef PLATFORM_ARCH_x86_64
#define LINUX_USB_VID (0x0B95)
#define LINUX_USB_PID (0x1790)
#else
#define LINUX_USB_VID (0x0955)
#define LINUX_USB_PID (0x7020)
#endif
6. Compilation and Execution
The PSDK software package supports CMake compilation. Use the cmake command to compile and generate executable files. Executing the example code below creates executable files dji_sdk_demo_on_jetson
and dji_sdk_demo_on_jetson_cxx
in the build/
directory. Raspberry Pi 4B Developer Kit can use the executable files for the Jetson Nano Developer Kit.
cd Payload-SDK/
mkdir build && cd build
cmake ../ && make -j4
Sample Introduction
The PSDK offers plenty of sample features and interfaces, catering to second development needs across various industry scenarios. Here's a walkthrough of some key functions to get you started with PSDK development.
Sample: Custom Widget
PSDK supports the Custom Widget Function. The following sample demonstrates how to utilize the API interface to display pre-set custom widget UI in the Pilot.
Run the executable file dji_sdk_demo_on_jetson_cxx
.
- Enter g to select
Sample - Start widget all features sample
and activate the custom widget feature. - Enter h to select
Sample - Start widget speaker sample
and activate the speaker feature.
Both the custom and speaker widgets display on the Pilot that installed on the remote controller. You can then interact with these widgets in the Pilot.

Figure. Custom Widget Function Sample Result

Figure. Speaker Widget
2. Sample: Information Management and Flight Control
PSDK supports both Information Management and Flight Control Function. This sample shows how to use the API interface to subscribe to M350 RTK aircraft telemetry data and control its motion.
- Enter 0 to select
Sample - Fc subscribe sample
and initiate data subscription. - Connect the aircraft to the DJI Assistant 2 on your PC, then launch the simulator in DJI Assistant 2. Once set up, enter 1 to 6 to try the flight control feature.

Figure. Information Management Sample Result
3. Sample: Camera and Gimbal Management Function
PSDK supports Camera Management and Gimbal Management features. This sample illustrates how to use the API to control camera photography and gimbal rotation. For camera model support details, refer to the Camera Support Feature Comparison Table in Basic Camera Management.
- Enter k to select
Sample - Run camera manager sample
and try the camera management feature. - Enter a to select
Sample - Gimbal manager sample
and try the gimbal management feature.

Figure. Camera Function List

Figure. Camera Management Sample - [11] Record video

Figure. Gimbal Function List
4. Sample: Camera Stream Subscription
PSDK supports the Camera Liveview Function. This sample demonstrates how to use the API to subscribe to the M350 RTK FPV and main camera streams.
Enter c to select Sample - Camera stream view sample
and experience both the camera and FPV stream subscriptions.

Figure. Subscribe Camera Stream

Figure. Main Camera

Figure. FPV Camera
FAQ
Frequently Asked Questions
- Error when running PSDK:
Can't operation the device. Probably the device has not operation permission. Please execute command 'sudo chmod 777 /dev/ttyUSB0' to add permission.
Solution: Run sudo chmod 777 /dev/ttyUSB0
- Error when running PSDK:
Please fill in correct user information to 'samples/sample_c/platform/linux/nvidia_jetson/application/dji_sdk_app_info.h' file.
Solution: dji_sdk_app_info.h
Please create an account on developer website, and fill in the relevant information to file dji_sdk_app_info.h
.
- Error when running PSDK::
ls: cannot access '/dev/ttyUSB0': No such file or directory
Solution: Check if the serial port is connected correctly.
Other Questions
Please go to Technical Documents, PSDK Knowledge Library, DJI Forum, and Submit Request to get more technical support.