o-gs / dji-firmware-tools

Tools for handling firmwares of DJI products, with focus on quadcopters.
GNU General Public License v3.0
1.55k stars 418 forks source link

(P4S/P4P/P4A) #99

Closed mEfis-afk closed 2 years ago

mEfis-afk commented 5 years ago

I am looking for a person who sell the Software for calibration of Gimbal's DJI. I say calibration, when you change some module ESC of the engines. Example: ESC Yaw/Roll Gimbal Phantom 4 or Phantom 4 Pro and the Gimbal goes crooked. I saw that you made a gimbal Spark calibration Software available, would you sell some to calibrate gimbal from the other Drones?

mefistotelis commented 5 years ago

The method for calibrating each model is probably different. I don't know how to do this exactly, that would require some research. I'm not sure if I'll be looking into that.

Spark has a pre-made auto calibration function which is easy to trigger. Previous platforms seem to have less automated solution, but I never looked at details.

mEfis-afk commented 5 years ago

And how much would you charge to make a script for calibration of Gimbal's Phantom 4 series, Phantom 3 and perhaps inspire? I pay you to do that, I don't want it for free!

mefistotelis commented 5 years ago

We would have to go with one platform at a time. Also, you'd have to be involved in testing what various packets do. From the platforms you mentioned, I only have Ph3, and its gimbal is properly aligned - so not a good test subject.

About paying for the task - I'm not sure if I want to go this way; the time I can spend on this is limited. But I do accept donations.

Sign to Slack - we may talk further there; see Slack link in top menu here: http://dji.retroroms.info/

I will try to find time for some initial research on the subject.

mEfis-afk commented 5 years ago

The site to be faced with stability issues. I can not access the same! Could you pass your email or WhatsApp? I will help in what possible (testing with drones). About the donations, I will donate yes.

mefistotelis commented 5 years ago

The "hardware" channel on Slack is the place where many people discuss mods and repairs for DJI products.

But if you can't access it - we can talk here. I don't use any other messaging apps.

mEfis-afk commented 5 years ago

I'm trying to access it, but I can't. What do you need to give the tip foot in the software for calibration? I have all the drones here to test....

mefistotelis commented 5 years ago

First I will look at gimbal module (m0400) for various platforms. I have the ones for Ph3, Ph4 and Inspire, but I don't think I have one for Ph2 Vision - and it could be helpful.

I will be searching for m0400 modules which are larger in size - this may indicate a version with more debugging messages left in the code.

I need to get a basic understanding of how the firmware works, then I'll get to figuring out the packets which can be sent to it.

mEfis-afk commented 5 years ago

I have a great friend who also program in Python, if you need any other help, I can talk to him... I can help with the tests, since I have no advanced knowledge of software.

mefistotelis commented 5 years ago

It will take some time before I have anything to test. I still need to finish current tasks.

Anyway, at some point I'll want you to run comm_serialtalk.py - so you may want to prepare for it, to the point where the example instruction from README works.

And you can try searching Ph2 firmwares for me.

mEfis-afk commented 5 years ago

Here on the website of DJI has some firmware of the Phantom 2 Plus which is the latest version of PH2

https://www.dji.com/phantom-2-vision-plus/info#downloads

mefistotelis commented 5 years ago

Here are ALL packets on which Phantom 3 Gimbal reacts. The table comes from version P3X_FW_V01.11.0030_m0400:

function cmdid cmdset
packet_exec_gimb_push_aetr
Sets 4 values from packet within gimbal RAM, each in range 364..1684: Aileron, Elevator, Throttle and Rudder. Supports payload encryption. No ACK possible.
0x06 Gimbal
packet_exec_gimb_control
Sets 3 values from packet within gimbal RAM, each in range 364..1684; meaning of them is unknown. Supports payload encryption. No ACK possible.
0x01 Gimbal
packet_exec_spec_special_app_control
Sets some values (10 bytes) from packet within gimbal RAM; unknown. No ACK possible.
0x01 Special
packet_exec_flyc_posture
Sets aircraft posture (4 float values) from packet within gimbal RAM; sent periodically during flight by Flight Controller. Supports payload encryption.
0x42 FlightCtrl
packet_exec_gimb_ext_ctrl_accel
Sets 3 angular values from packet within gimbal RAM; sets angular accelerations of each axis.
0x0C Gimbal
packet_exec_gimb_thirdp_magn
Sets 3 values from packet; does some processing on the values, influences many values stored in RAM. Maybe calibrates the gimbal for work with third party magnetometer?
0x0E Gimbal
packet_exec_gimb_calibration
Triggers auto-calibration, the same which can be triggered by mobile app. Calibrates only 2 axes.
0x08 Gimbal
packet_exec_gimb_adjust_roll
Receives a value from packet and shifts internal roll adjustment by it. The adjustment is not saved into persistent storage.
0x07 Gimbal
packet_exec_gener_version_inquiry
When received, the gimbal responds with a packet containing hardware and software versions.
0x01 Universal
packet_exec_gener_enter_loader
When received, the gimbal software sets startup parameters so that it starts to bootloader mode, and reboots the chip. This is initial step of a firmware update.
0x07 Universal
packet_exec_gener_update_confirm
Used during firmware update.
0x08 Universal
packet_exec_gener_update_transmit
Used during firmware update.
0x09 Universal
packet_exec_gener_update_finish
Used during firmware update.
0x0A Universal
packet_exec_gener_reboot_chip
When received, the gimbal mcu reboots.
0x0B Universal
packet_exec_gener_get_device_state
In response to this request, gimbal returns a dword value representing its state. It looks like this state value is not really used and has no real meaning.
0x0C Universal
packet_exec_gener_set_device_version
Its main purpose is to convince the device about which versions of SW and HW it should report; though only some of the set values are really used for reporting. It has additional magic value triggers which allow to overwrite internal storage, including calibration data. Very suspicious. Potentially very powerful.
0x0D Universal
packet_exec_gener_encrypt_config
Used for factory encryption pairing. Consists of 3 sub-commands: GetChipState, GetModuleState, Config.
0x30 Universal
packet_exec_gimb_cmd20
Sets 3 values from packet within gimbal RAM; meaning of them is unknown. No ACK possible.
0x20 Gimbal
packet_exec_gimb_ext_ctrl_degree
Sets 3 angular values and 3 additional values from packet within gimbal RAM. Resets values from packet 0x20 to 1 if ACK was requested (do you even design, Dji?).
0x0A Gimbal
packet_exec_gimb_get_ext_ctrl_status
In response to this request, gimbal returns a flag field and int value representing current ctrl status.
0x0B Gimbal
packet_exec_gimb_suspend_resume
Allow to suspend or resume gimbal motion when correct magic value is provided as payload. Sets a single flag in RAM. No ACK possible.
0x0D Gimbal
packet_exec_gimb_get_user_param
Given indexes of gimbal user params, returns a list of their values. Values have different size depending on their type. There are 12 gimbal user params defined in the firmware; they work in a similar way as FlyC Params.
0x10 Gimbal
packet_exec_gimb_set_user_param
Allows to set new values of gimbal user params. Index and size of each param must be provided. Also resets values from packet 0x20 to 1.
0x0F Gimbal
packet_exec_gimb_save_user_param
Stores values from user_param list, and additional values like the roll adjustment, to persistent storage. Requires one byte payload to send an ACK, but that byte value is not used (because why not.). Besides returning status code, also sets values from packet 0x20 to different numbers on success and on failure.
0x11 Gimbal
packet_exec_gimb_cmd21
Sets values of unknown 3-element list within RAM. Each list entry consists of 3 integers. No ACK possible.
0x21 Gimbal
packet_exec_gimb_resume_default_param
Restores values of all user params to defaults from persistent storage. Resets values from packet 0x20 to 1.
0x13 Gimbal
packet_exec_gimb_cmd14
Sets 3 angular values and 1 additional value from packet within gimbal RAM. Also contains flags field which influences which fields are set. Meaning of values is unknown. No ACK possible.
0x14 Gimbal

Now we can test what each of these does and find out which is used to calibration or position setting.

mefistotelis commented 5 years ago

Disclamer: This can damage the gimbal. I don't know what it does. I will just provide packets which look like they might trigger calibration or control the yaw arm.

Now, first check if taking to gimbal even works (this command is safe):

./comm_serialtalk.py COM5 -vv --receiver_type=Gimbal --seq_num=12341 --ack_type=ACK_After_Exec --cmd_set=General --cmd_id=1

If it does (versions are shown in response), then we can get to business.

I will provide proper commands as soon as I finish figuring them out. The idea I have is to enter work mode 5 - it looks like a different version of auto-calibration routine (which is work mode 3).

mEfis-afk commented 5 years ago

Hey, buddy. How you doing, huh? Very good! I will test this command on some Phantom 3

mefistotelis commented 5 years ago

Please do.

My idea of switching to work mode 5 is not as easy as I anticipated - all packets which allow to control work mode are masking it to 2 bits (allowing only modes 0..3).

I am searching for alternatives.

Also, I don't have any firmware from Ph2 - that would require quite some work to get, as the FW is downloadable through Ph2 Assistant. So I think I'll skip it.

mefistotelis commented 5 years ago

Update: I got all firmwares for Ph2, am looking at them now; will get back to looking at Ph3 gimbal code when I'm done with them.

mEfis-afk commented 5 years ago

Tell me, my friend, how was your year-end? I wish you much health, peace and a lot of money that year. I arrived on a trip today, I was at the relatives ' house. I'm going to test the Phantom 3 code tomorrow, and I'll give you a return.

mEfis-afk commented 5 years ago

Hi, how are you? I went to work. I'm going to take the test this week on a Phantom 3 Pro. It would be interesting if I had any other way to talk to you, I have a good proposition for this project.

mefistotelis commented 5 years ago

You can write me an e-mail. mefistotelis@gmail.com

I am still working on pre-Ph3 firmwares; have limited time for that, so it takes quite long.

cimona commented 5 years ago

can be contacted via viber or whatsApp or messenger. +79219329356 https://www.facebook.com/profile.php?id=100011587383998 cimona84@list.ru  

Пятница, 25 января 2019, 8:39 +03:00 от jebtir notifications@github.com:

Hi, how are you? I went to work. I'm going to take the test this week on a Phantom 3 Pro. It would be interesting if I had any other way to talk to you, I have a good proposition for this project. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub , or mute the thread .

-- Сергей Медведев

mEfis-afk commented 5 years ago

Hey, did you abandon the "project? "

mefistotelis commented 5 years ago

I am not working on it now. May be back when I have more time.

0n3-70uch commented 5 years ago

Hi, did anyone found a solution? I replaced my YAW motor ad now I need to calibrate the motor.

TheonlyAnkit commented 5 years ago

Yes, the complete solution is here. You just have to run one simple python program in root unit of Mavic air drone. You can find one video over YouTube

On Sat, 21 Sep 2019 at 1:39 PM, Fabian notifications@github.com wrote:

Hi, did anyone found a solution? I replaced my YAW motor ad now I need to calibrate the motor.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/o-gs/dji-firmware-tools/issues/99?email_source=notifications&email_token=AMPTHPDVHJWLJDWMQ57JQRLQKXJDFA5CNFSM4GJWBC7KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7INACY#issuecomment-533778443, or mute the thread https://github.com/notifications/unsubscribe-auth/AMPTHPGHLGT6FYP2ZZDBDHLQKXJDFANCNFSM4GJWBC7A .

0n3-70uch commented 5 years ago

Thanks for your quick answere. Ok thats for mavic air right? Is there a solution for Phantom 4 Pro?

0n3-70uch commented 5 years ago

PS: Can you link me the video pls. Many wrong videos there...

TheonlyAnkit commented 5 years ago

Let me check, i will send here

On Sat, 21 Sep 2019 at 1:59 PM, Fabian notifications@github.com wrote:

PS: Can you link me the video pls. Many wrong videos there...

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/o-gs/dji-firmware-tools/issues/99?email_source=notifications&email_token=AMPTHPHJ6MBVQU66NHWWEOTQKXLPTA5CNFSM4GJWBC7KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7INJYA#issuecomment-533779680, or mute the thread https://github.com/notifications/unsubscribe-auth/AMPTHPBZR6HTPKOZWDWNECDQKXLPTANCNFSM4GJWBC7A .

0n3-70uch commented 5 years ago

Great thanks. I found this video for the spark: https://www.youtube.com/watch?v=LdQtvJjjqeI This solution works for the mavic air too... but the PH4PRO is different.

0n3-70uch commented 5 years ago

Disclamer: This can damage the gimbal. I don't know what it does. I will just provide packets which look like they might trigger calibration or control the yaw arm.

Now, first check if taking to gimbal even works (this command is safe):

./comm_serialtalk.py COM5 -vv --receiver_type=Gimbal --seq_num=12341 --ack_type=ACK_After_Exec --cmd_set=General --cmd_id=1

If it does (versions are shown in response), then we can get to business.

I will provide proper commands as soon as I finish figuring them out. The idea I have is to enter work mode 5 - it looks like a different version of auto-calibration routine (which is work mode 3).

Here is my response:

Prepared binary packet:
55 0d 04 33 0a 04 35 30 40 00 01 91 94
Sending packet...
Waiting for reply...
Retrieved 16 packets (886b), dropped 0 fragments (0b)
Received response packet:
55 2c 04 36 04 0a 35 30 80 00 01 00 01 6e 6f 6e 65 00 b3 09 f2 36 35 00 55 66 3f 00 00 00 00 0c 01 11 0d 32 01 01 00 00 00 01 96 98
Parsed response  - DJIPayload_General_VersionInquiryRe:
        unknown0: 0
        unknown1: 1
      hw_version: b'none'
     ldr_version: 17563648
     app_version: 20057361
       unknown1A: 1
       unknown1E: 1
TheonlyAnkit commented 5 years ago

Yes correct this is the video, just follow the steps in the video carefully. This will work for Mavic air too. This works for me when I installed new gimbal

On Sat, 21 Sep 2019 at 3:57 PM, Fabian notifications@github.com wrote:

Disclamer: This can damage the gimbal. I don't know what it does. I will just provide packets which look like they might trigger calibration or control the yaw arm.

Now, first check if taking to gimbal even works (this command is safe):

./comm_serialtalk.py COM5 -vv --receiver_type=Gimbal --seq_num=12341 --ack_type=ACK_After_Exec --cmd_set=General --cmd_id=1

If it does (versions are shown in response), then we can get to business.

I will provide proper commands as soon as I finish figuring them out. The idea I have is to enter work mode 5 - it looks like a different version of auto-calibration routine (which is work mode 3).

Here is my response:

Prepared binary packet: 55 0d 04 33 0a 04 35 30 40 00 01 91 94 Sending packet... Waiting for reply... Retrieved 16 packets (886b), dropped 0 fragments (0b) Received response packet: 55 2c 04 36 04 0a 35 30 80 00 01 00 01 6e 6f 6e 65 00 b3 09 f2 36 35 00 55 66 3f 00 00 00 00 0c 01 11 0d 32 01 01 00 00 00 01 96 98 Parsed response - DJIPayload_General_VersionInquiryRe: unknown0: 0 unknown1: 1 hw_version: b'none' ldr_version: 17563648 app_version: 20057361 unknown1A: 1 unknown1E: 1

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/o-gs/dji-firmware-tools/issues/99?email_source=notifications&email_token=AMPTHPBQPJ5YH6IWN4OU2YLQKXZHJA5CNFSM4GJWBC7KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7IPA4A#issuecomment-533786736, or mute the thread https://github.com/notifications/unsubscribe-auth/AMPTHPEL2YB5NBA2MYUWNZTQKXZHJANCNFSM4GJWBC7A .

0n3-70uch commented 5 years ago

Yeah this works for Spark and Mavic Air.. but not for Phantom 4. The topic ist "Calibration Gimbal Phantom 4 Series". Thats why I ask for the PH4PRO ;-).

I used following trick now: https://youtu.be/uWCm0QlHTTM

TheonlyAnkit commented 5 years ago

You have replaced the complete motor or only winding part??

On Sat, 21 Sep 2019 at 5:51 PM, Fabian notifications@github.com wrote:

Yeah this works for Spark and Mavic Air.. but not for Phantom 4. The topic ist "Calibration Gimbal Phantom 4 Series". Thats why I ask for the PH4PRO ;-).

I used following trick now: https://youtu.be/uWCm0QlHTTM

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/o-gs/dji-firmware-tools/issues/99?email_source=notifications&email_token=AMPTHPFPEIPCQN43VJBWA33QKYGTDA5CNFSM4GJWBC7KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7IQX5Y#issuecomment-533793783, or mute the thread https://github.com/notifications/unsubscribe-auth/AMPTHPC4SF5NIAMLQGAWI3DQKYGTDANCNFSM4GJWBC7A .

0n3-70uch commented 5 years ago

Only the winding part. The cable was demaged. Now it's running fine and well centered.

TheonlyAnkit commented 5 years ago

Okay, let me know any help you need

On Sat, 21 Sep 2019 at 6:16 PM, Fabian notifications@github.com wrote:

Only the winding part. The cable was demaged. Now it's running fine and well centered.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/o-gs/dji-firmware-tools/issues/99?email_source=notifications&email_token=AMPTHPF2ERULFDQ2NJEOCHLQKYJT5A5CNFSM4GJWBC7KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7IREXI#issuecomment-533795421, or mute the thread https://github.com/notifications/unsubscribe-auth/AMPTHPAIRR5KXPFJFMXZCRDQKYJT5ANCNFSM4GJWBC7A .

0n3-70uch commented 5 years ago

Ok thank you. Have a nice weekend.

lensherm commented 5 years ago

Well well.... Although calibration kept starting but timing out on my Spark, regardless of the combinations of components I tried it with, including original gimbal/cam, different ribbon cable, brand new gimbal motor, brand new gimbal/cam; as soon as I got a replacement board, it worked like a charm. Looks like gremlins were out to get me and my 90 bucks :-). At least all's well with the world in the end.

0n3-70uch commented 5 years ago

Yeah the motor drivers are placed on the core board. Very bad solution... The same situation like the mavic air.

TheonlyAnkit commented 5 years ago

Keep the original magnet over the winding when replace the motor. Also it Depends upon quality of winding whether the motor will work or not in case of phantom 4 pro

On Sat, 21 Sep 2019 at 6:44 PM, Fabian notifications@github.com wrote:

Yeah the motor drivers are placed on the core board. Very bad solution... The same situation like the mavic air.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/o-gs/dji-firmware-tools/issues/99?email_source=notifications&email_token=AMPTHPDF4Z6STS66YNZNQJDQKYMZRA5CNFSM4GJWBC7KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7IRSFQ#issuecomment-533797142, or mute the thread https://github.com/notifications/unsubscribe-auth/AMPTHPDEF32QJJK3XH4PHW3QKYMZRANCNFSM4GJWBC7A .

vserena82 commented 4 years ago

Hello, there is a solution for this problem? I need to calibrate gimbal in P4Pro, I replaced yaw motor. On crash magnet of old yaw motor has broken so I can't use it with new winding part. There is a way to calibrate gimbal or change its default parameteres (angles)? after replacing motors? Thank you

TheonlyAnkit commented 4 years ago

Sorry for the late reply, I was busy in some work.

Make sure the original magnet of yaw motor is fine. And replace the motor winding by new one. After installation of new winding part of yaw motor, make sure every part is fit correctly. When you start your p4 pro the gimbal/camera may be not in center. Don’t worry, That will be in center you just have to do several calibration— gimbal calibration in several position.

Thanks

On Sat, 15 Feb 2020 at 10:18 PM, vserena82 notifications@github.com wrote:

Hello, there is a solution for this problem? I need to calibrate gimbal in P4Pro, I replaced yaw motor? On crash magnet of old yaw motor has broken so I can't use it with new winding part. There is a way to calibrate gimbal or change its default parameteres (angles)? after replacing motors? Thank you

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/o-gs/dji-firmware-tools/issues/99?email_source=notifications&email_token=AMPTHPHY7AHS22D6NOD7WT3RDAMGPA5CNFSM4GJWBC7KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEL3RPIQ#issuecomment-586618786, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMPTHPGGWBCLTLS57UFM44TRDAMGPANCNFSM4GJWBC7A .

vserena82 commented 4 years ago

Thank you for your answer but I cant swap magnet: winding bumped into magnet ring and magnet has been broken, so I cant use it. I tryed with another yaw motor but it is not in correct position. I have also another gimbal to repair: I changed esc board for yaw motor, also in this case yaw motor is in wrong position. Is it possible to make a "deep" calibration using some scripts? Or is it possible to force yaw parameters manually on fw?

If there are no solutions I have to buy others yaw motors and hope the will be in correct position...

Thank you

TheonlyAnkit commented 4 years ago

Any issues you are facing?

On Fri 27 Mar, 2020, 11:11 AM joww1, notifications@github.com wrote:

Reopened #99 https://github.com/o-gs/dji-firmware-tools/issues/99.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/o-gs/dji-firmware-tools/issues/99#event-3171045691, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMPTHPHYVMP7IKJZ5YKMB6DRJQ4A7ANCNFSM4GJWBC7A .

sh88hoseini commented 4 years ago

Hello I also encountered this problem, but I can't open this help link.

TheonlyAnkit commented 4 years ago

Sorry for delayed in response, due to pandemic My work is paused for a while.

Can you elaborate what issues you are facing?

On Thu, 21 May 2020 at 9:46 PM, sh88hoseini notifications@github.com wrote:

Hello I also encountered this problem, but I can't open this help link.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/o-gs/dji-firmware-tools/issues/99#issuecomment-632184962, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMPTHPEYH5KCGN5GDUAAWRLRSVHVZANCNFSM4GJWBC7A .

fargnoli1969 commented 4 years ago

Hi does anyone here able to write a simple program to calibrate after replacing esc or motors each or any of the dji range ?? Donations for programs on their way if you can help . Thanks Fargnoli@scotlandunmanned.co.uk

TheonlyAnkit commented 4 years ago

Hie everyone, is there any programming script to calibrate the P4 Pro gimbal after replacing some damaged/fractured spares from the gimbal??

krixiicsz commented 3 years ago

Hello! I have tried to find some information, but haven't got anything. Now as I understand, that I had to replace magnets from old motor to new, but I have already put my old motor in trash bin. So. Is there any other solution that can work to center my gimbal. My drone have crashed, I have replaced yaw motor, flex cable and also esc board for gimbal. Is there some software where can manually calibrate motor?

mEfis-afk commented 3 years ago

Hi does anyone here able to write a simple program to calibrate after replacing esc or motors each or any of the dji range ?? Donations for programs on their way if you can help . Thanks Fargnoli@scotlandunmanned.co.uk

How much are you selling for?