Sample code does not work
1313 2 2021-2-26
Uploading and Loding Picture ...(0/1)
o(^-^)o
djiuser_Ax19VJABAt18
lvl.1

Germany
Offline

Hello,

We've got a Matrice 210 v2 and I am trying to run the samples of the OSDK. I've been working on it for two days now, but I still fail.
The setup is the following: I've got a linux PC with Ubuntu 18.04 running on it. The drone is connected to it via an USB-TTL cable with a built-in FT232 chip and also it is connected via a dual-head USB cable. The USB-TTL cable is connected to the drone's expansion port with GND, RX, TX in line 3 from top to bottom as described in the manual.


I'm using OSDK 4.1.0 and I've updated the drone's firmware to 01.00.0710. I also checked my app_id, my app_key and the baudrate (1000000) several times and also checked whether the device connects correctly as '/dev/ttyUSB0' and wheter the ACM port '/dev/ttyACM0' works fine. Furthermore I've enabled the API control in the DJI Assistant 2 and also I verified wheter I got permissions to communicate via UART.
For compiling the sample code, I've got gcc (version 7.5.0) and cmake(version 3.10.2) installed and the code compiles without an error. But when running the sample code, I still get error messages which claim that the hand shake with the drone failed.


~/Onboard-SDK/build/bin$ ./djiosdk-flightcontrol-sample UserConfig.txt UserConfig.txt
Read App ID
User Configuration read successfully.

[3725469.231]STATUS/1 @ getDroneVersion, L1702: ret = 2
[3725469.232]ERRORLOG/1 @ getDroneVersion, L1707: Drone version not obtained! Please do not proceed.
Possible reasons:
    Serial port connection:
        * SDK is not enabled, please check DJI Assistant2 -> SDK -> [v] Enable API Control.
        * Baudrate is not correct, please double-check from DJI Assistant2 -> SDK -> baudrate.
        * TX and RX pins are invert
[3725469.232]STATUS/1 @ functionalSetUp, L282: Shake hand with drone Fail ! Cannot get drone version. (1/20)
[3725469.232]STATUS/1 @ functionalSetUp, L284: Try again after 1 second ......
^C



Does anyone know what I'm doing wrong? Thanks in advance.



expansion_port_0.PNG
2021-2-26
Use props
kv886
lvl.4

Hong Kong
Offline

It looks like there is no problem with your operation. You can try to see if the voltage signal can be detected on the API port of the aircraft
2021-3-4
Use props
djiuser_Ax19VJABAt18
lvl.1

Germany
Offline

Thanks for the reply. I have now been able to solve the problem. I had connected the TX and RX pins upside down. In addition to that I also forgot to enable the OSDK communication port within the DJI Pilot App.
2021-3-4
Use props
Advanced
You need to log in before you can reply Login | Register now

Credit Rules