Flashing your DJI aircraft is bloody simple with the pyduml.py script. This FAQ is based on work by vk2fro, and Dreadwing007.
Install your toolchain as per the instructions here. You only need to do this once… but check the instructions to see if there are any new tools that you may need.
If this is your first time using duml, you will need to checkout the code from git.
cd ~/Documents/ git clone https://github.com/hdnes/pyduml.git cd pyduml
If you have done this before and you want to make sure you have the latest code, you just need to sync to the most recent version
cd ~/Documents/pyduml git pull
If you are planning to flash new firmware, you obviously need some firmware files. The primary source is http://github.com/MAVProxyUser/dji_system.bin … or, you can go to firmware for a listing of what is available
NOTE for Spark RC: Firmware for Spark RC have the ending “.tar” as the Spark RC is quite different from the other devices (also how to flash, see below, skip to bottom of (4.) to see next Spark RC note…)
This step will find the TTY for connectivity to your aircraft, and store it in a file /tmp/dji.port for use later.
ls /dev/tty* | sed -e "s#.*/##g" > /tmp/dji.on
ls /dev/tty* | sed -e "s#.*/##g" > /tmp/dji.off
diff /tmp/dji.on /tmp/dji.off | grep "<" | sed -e "s/.* //" > /tmp/dji.port rm /tmp/dji.on /tmp/dji.off cat /tmp/dji.port
NOTE for Spark RC: Please skip above and just switch on RC and connect your Mac/PC to its WiFi network as a preparation. Also see notes for Spark RC in section (5.)
FULLY CHARGE A BATTERY!!! do not try to flash with a depleted battery - itʼll only end in tears and a dead aircraft. If you aren't interested in changing firmware and you just want to get root access, skip ahead to the next step.
cd ~/Documents/pyduml
cp <yourfirmwarename> dji_system.bin
NOTE for Spark RC:
#ONLY do this if flashing a Spark RC cp <yourSparkRCfirmwarename.tar> fw.tar
cp V01.03.0700_Mavic_dji_system.bin dji_system.bin
If your on windows substitute 'copy' for 'cp'
copy V01.03.0700_Mavic_dji_system.bin dji_system.bin
python pyduml.py /dev/`cat /tmp/dji.port`
NOTE for Spark RC: No additional Parameters needed, just choose the Spark RC as device when prompted…
#ONLY do this if flashing a Spark RC python pyduml.py
For windows users:
python pyduml.py com#:
where # is the comport number you discovered in device manager.
Flashing takes around 10 minutes. Watch the lights on the aircraft. It may reboot during the procedure but donʼt touch it. Once it chimes and the front beacons stop flashing, its done. Be patient - 10 minutes seems like an awfully long time, but you donʼt get a pretty progress bar like when you flash with assistant.
Do not disconnect the drone when the script says its finished - thats only the upload portion! The flashing process follows and its a good idea to leave it all alone until you hear the chimes.
Want to watch the process? if you have root, you can issue the following commands in a second terminal session:
adb shell busybox tail -f /ftp/upgrade/dji/log/upgrade00.log
rm dji_system.bin
Windows users can simply del the file
del dji_system.bin
The optional batteries then can upgraded/downgraded simply by inserting them in the aircraft and connecting to the Assistant, letting it detect and fix any discrepancy in the versions.
cp fireworks.tar dji_system.bin
Windows users:
copy fireworks.tar dji_system.bin
python pyduml.py /dev/`cat /tmp/dji.port`
Windows users:
python pyduml.py com#:
rm dji_system.bin
windows users:
del dji_system.bin
From your terminal window
adb devices
adb shell
To make it easier to get back into your aircraft via ADB next time, you can add a command to the boot init script. Beware. This command is modifying a startup script. If you get it wrong, that could be … well … bad. Don't do this more than once, unless you change your firmware to re-patch the startup script.
mount -o remount,rw /system echo /system/bin/adb_en.sh >> /system/bin/start_dji_system.sh reboot