Backup and Copy of the firmware from one drone to another (ie Factory Reset)

garthkh

Member
Can anyone give me advice on what software I could use to backup the firmware on my drone (KaiOne Pro}? We have a group working out how to use this drone as the manuals are shocking. The drone is very stable, has many features and flies well, even in moderate winds. Working with the developers is hopeless. As with many of these budget drones there are a number of Apps that work with the drone, some worse and some better than the app coming with the drone. One of our group members was trying a new app that does control the drone The app displayed the need to update the firmware. As a new drone user he let it do the update and now there appears to be no wifi to connect the phone to. The normal remote controller is still functional, which tells me the update he's done is still functional to fly the drone. I always thought that firmware updates would need to be done via a USB cable while the Phone connects to the Internet - I was obviously wrong.
What I would like to try is to open up my drone and get to the flight controller. There must be a USB port on it. Then connect the FC to the computer and backup the firmware. Then send the copy of the firmware image to him so he can do the reverse and flash his FC with the original. ie basically do a factory restore.
 
Everything you said sounds great in theory.... the part you might find is missing is a USB connection on the FC. All the "betaflight compatible" FCs will basically have a USB port and chip to translate USB to "old school serial" for the MCU to get it into DFU/device firmware upgrade mode where it is waiting for data to come in on the serial line to "reflash" itself. Most of these FCs are using ST Microelectronics chips at their core and you can get the st-link program from ST Microelectronics that can be used for managing the flash memory on the chip where the firmware is stored, so you can in theory as you say pull the firmware out of that flash memory and save it somewhere local and "reflash" with same backup you made onto another FC and it should work.

The down sides... most non home-built quads have some proprietary things on the FC and will forego adding USB chip or port onto the board to save costs (they can either preflash the chips in a jig or will leave themselves some "pogo pin" pads on the board that a jig can be used to connect the boards for flashing/testing at the factory).

All that said too if the FC is a betaflight FC then you can use Betaflight configurator (desktop app for configuring/reflashing via USB) in the configurator app you can use the "diff" command in the terminal to output any non-default settings that have been saved in Betaflight and can use that to setup another FC as a backup copy, that said if there are different components like gyro or MCU you are almost always best off just setting up betaflight compatible FCs from scratch.
 
Thanks for your reply and details. Our friend who mistakenly updated his firmware has since got his money back from eBay and bought himself a DJI - so I don't need to try and do this memory copy and reflash. However, it's something that interests me anyway. I was a mainframe and mini computer programmer in days past (1980s) and we used to flash eproms on our 6800 processor boards. Since my last post and waiting for replies, I stripped my drone down completely to see exactly what was inside and I photographed every dismantle. I found the Flight Controller not to have a USB port (as you mention above), but it does have a 4-pin serial port. I then went hunting for a USB to serial cable and discovered Aliexpress sells a PL2303 USB to serial cable for flashing. I presume this will be how the Chinese factory will be flashing their controllers. They probably leave the USB hardware of the FC to cut costs. It's interesting that when the drone is assembled you can see and access the 4-pin port underneath going past the camera gimbal.
I, obviously, don't want to damage the firmware on my drone, but it would be an interesting exercise to see if the firmware could be downloaded.
I must say that my drone is very stable. It has many of the features that the expensive DJI's have but their manuals and customer support is nil. I'm sure many of these cheaper drones would be so much more popular if some support was given and updates etc done with user input. That's why the expensive models are so popular.
I can't upload more than one image I see, so here's a composite of the FC and the USB to 4-pin port cable.
FC and Cable.png
 
Ah nice yah I had a feeling from the question you must have had some technical background, but good to get a little of the history to know what will make sense vs what I have to try to explain :D.

Think the cable you got should probably work basically there are two chips that are popular for doing the USB to serial translation either from FTDI or one from SiliconLabs (CP2102 I think is part name).

The MCU chip you have in the pic there is STM32 of some sort so should be able to use the st-link program to download the contents of the flash or update the contents of the flash:
^^ look for st-link in the list there, also the STM32 Cube IDE is basically eclipse IDE with plugins baked in for helping to configure pins and build firmware for the chip might be interesting to someone with the mainframe background :)

All said not sure how much you'll be able to do with the firmware once have a copy of it since is compiled code, but is still fun tinkering with these things even if a bit of a black box. I would suggest you check out iNav and Betaflight source code on github as well since have the technical chops can likely flash one of those onto your hardware once you have a backup and see if can get it configured to fly well with their respective desktop apps (is a deep well in any direction :) ).
 
Thanks for this. I'll take a look at that st-link software. I use both openSuse Linux and also Windows - I'll probably load it in Windows to see what's in the software once it loads.
Yes, there's not much I could do with the software once it's downloaded, except to keep it as a backup in case I box up the firmware. Definitely not considering trying to decode the compiled code.I would like to rather have the bricked drone to be able to flash it back there, but he's moved on.
All this is stretching my old knowledge of doing this low-level stuff. It's many years since I was fiddling with EEPROMS etc and I'm sure the software working with them has changed too. If I could reliably download the firmware and flash it back I'd love to consider playing with iNav and Betaflight to see if their software could replace the existing and still have all the existing facilities. Can Betaflight provide the AI to recognise hand signals like take a photo, start and stop video, follow me, and circle an object? These drone are pretty smart, even these budget varieties. The software in these drones is waaayy more that the COBOL and Assembler programming I used to do.
I was a Radio Ham too in South Africa and the radio comms on these drones interests me too. I'm busy bringing the 3 antennas to the outside of the drone, and the one on the remote, to see if I can improve the signal to get a bit more distance, using different antenna types.
I'll look at st-link and see if it's worth buying the PL2303 cable. Thanks again
 
Last edited:
Wafflejock, can I ask you a question re the wifi access to a drone. This friend who bricked his Kai One drone, he says that after the alternate app updated is firmware the drone went through a reboot and then he could no longer even see the wiffi connection to the drone via any app. Is there also firmware in on the wifi card that can be updated? I've been wondering where the wifi access code is supplied to the phone app comes from. As per my drone and others using the same RxDrone App, when we connect the phone to the drone we will all see the same wifi code UAV GO-5G 852958. At least I think we all get the same code (I must check that). Why would this fella have lost access even to the wifi code. Surely the wifi card still broadcasts the connection code?
 
Regarding betaflight and any sort of AI for the most part I think that's outside of what it really intends to support it's more in the way of manual/acrobatic flight control and just doing some stabilization using accelerometer and gyro data (is largely about the filtering used to eliminate as much "noise" from the gyro/accelerometer data as possible to feed into a PID loop). iNav firmware is meant to be a little more in the way of the quad or any RC craft really to control itself using GPS plus the PID loop for "self balancing" or "angle mode" flight of a quadcopter but again I don't think there's really much in there in the way of integration of camera or vid signal processing. Honestly a little shocking to me they are able to do any sort of inference "at the edge" on these quads without some kind of dedicated GPU hardware, typically I've suggested in the past that if people wanted to add AI onto a quad the best bet would be using the FC as is for the "lower level" motor control and putting a raspberry pi or nvidia jetson board on top for doing the inference from a camera and feeding control signals to the FC. I know STM32 offers some AI modules for their Cube IDE but have only explored some of the more basic kinds of sensors like time of flight or ultrasound and mostly in the context of "IoT" which is fancy terminology for web/internet connected sensors/actuators.

---

Can check out the betaflight website for overview:
Betaflight is broken up into the firmware that runs on the FCs and the "configurator" tool in terms of github repositories but most users can just download the "configurator" and within there can download new versions of the firmware that are already configured for their FC (has mappings for what pin on MCU goes to what pin/pad on PCB)

iNav similarly has github repo and can flash compatible FCs using the "configurator" tool (used to both configure PID values/receiver input and FC to ESC protocols etc.)

There's a handful of other flight control firmware's I've heard of but haven't really experimented much outside of these two.

---

Regarding the wifi question the STM32 itself doesn't have WiFi baked into it so typically there is another chip somewhere on the board that handles the WiFi, I want to say on some devkit boards I have they used broadcom WiFi modules but think it could basically be anything that could use SPI or I2C. Anyhow I do remember I had to separately update the firmware of the WiFi module when was doing some of those IoT projects in order for the security (TLS) to work properly so I think is normally the case that the WiFi SSID/broadcast name would be baked into that modules firmware rather than the firmware flashed on the STM32... that said if the firmware flashed onto STM32 was changed where it was no longer using the right pins to try and activate the WiFi module then could see it just stopping from initializing.
 
Thank you - I think you've answered a lot of questions I have had in my head on how these fancy drones work. My Kai One Pro, I think, like a number of other budget drones coming out, have AI facilities that are trying to emulate what the DJI models have built into theirs (and pretty well too). I thought as much that Betaflight would not be able to produce all the code for what these machines can do.
My drone has a separate WiFi card module with two antennas (presumable one TX and the RX) for the 5.8GHz FPV WwFfi to the phone. I imagine if I was to buy a new WiFi card module from AliExpress or Banggood it would come ready to go with its own SSID code etc. I've never looked at one of these. And I presume these are similar WiFi modules to that are fitted into home internet modems.
The 3rd antenna on my drone is the 2.4GHz antenna and this (unfortunately for some of what I'd like to experiment with) is built onto the Power / Speed Controller Board. All three in one - I guess to cut the product costs again.
This is the WiFi card with one of the antenna cables removed
08.jpg
 
Yup pretty sure from logo and part number that one is a Realtek module, but there are wifi modules from Intel or Broadcom or a handful of other companies, I also would imagine is a similar chip dedicate to handling the wifi communication (modem) for home wifi access points. The older hardware will only operate on 2.4GHz band but newer ones might have 5GHz as well (dual-band is marketing term for both in one), 2.4 generally better for range and penetration but because of lots of devices using 2.4GHz and it travelling through walls etc easier it tends to be a more "noisy" band.
 
Back
Top