Fixing flash in DM365 chip within Ph3 Pro gimbal

To unpack P3X_FW_V01.11.0020.bin (Latest P3P version):

Tried running the following in a fresh install of Python and Idle GUI on a Win7 64bit machine , but it returns with syntax error.
If I run dji_fwcon.py with no parameters comes back with Crypto.Cipher module not found.

Note: I put all files in the Python folder so that they can be found by Python.

This is why my hair is so thin now ....years of using Windows OS

Code:

dji_fwcon.py -vvv -x -p P3X_FW_V01.11.0020.bin
openssl des3 -d -k Dji123456 -in P3X_FW_V01.11.0020_m0800.bin -out P3X_FW_V01.11.0020_m0800_decrypted.tar.gz
tar -zxf P3X_FW_V01.11.0020_m0800_decrypted.tar.gz
 
Have a peek here. I also run into crypto issues when playing around with dji firmware, mine was related to environmental settings, eventually ended up with success on my third windows machine. Second time I needed it, I used raspberry pi with raspbian installed and had no issues at all :)
 
Have a peek here. I also run into crypto issues when playing around with dji firmware, mine was related to environmental settings, eventually ended up with success on my third windows machine. Second time I needed it, I used raspberry pi with raspbian installed and had no issues at all :)
Thanks for the info. Much appreciated.
 
@quaddamage
I've hit a brick wall.
I've managed to solder on a new NW361 nand chip and flash the bootloader successfully using TI's serial flasher host program.
Attempting to extract uImage primary kernel and other modules from latest Phantom 3 Pro firmware p3x_fw_v01.11.0020.bin has turned into a nightmare.
My newly installed Python V3.8 was returning with either syntax error or couldn't find 'Crypto' module if run with no parameters.
Tried installing Pycrypto to fix this but couldn't build it or install it due to missing vcvarsall.bat.
Everywhere I turn there's a hurdle in the way.

You have done the extraction of the files required for GL300 controller in gl300_dm36x_extracted_firmwares.zip

Is there any way of enticing you to to do the same for the top gimbal for current p3x_fw_v01.11.0020.bin firmware ?
I'm sure it would encourage many others who are not quite software experts to have a go at repairing their Phantoms.
Many thanks for getting me this far all the same. Cheers Jim
 
This is as far as I get:

code:

C:\Python27>python dji_fwcon.py -vvv -x -p P3X_FW_V01.11.0020.bin
P3X_FW_V01.11.0020.bin: Opening for extraction
P3X_FW_V01.11.0020.bin: Package format version 2016 detected
P3X_FW_V01.11.0020.bin: Header:
{ 'entry_count': 17,
'hdrend_offs': 950,
'magic': 305419896L,
'magic_ver': 1,
'manufacturer': 'DJI',
'model': 'P3X',
'padding': '00000000000000000000',
'timestamp': 1499225380L,
'ver_latest': 17498132L,
'ver_latest_enc': 158398548,
'ver_rollbk': 17498132L,
'ver_rollbk_enc': 158398548}
P3X_FW_V01.11.0020.bin: Module index 0
{ 'decrypted_len': 905728L,
'decrypted_md5': 'a6f0e3375c3a8417d8090f1c27d1826d',
'dt_offs': 950L,
'encrypt_type': 1,
'reserved2': 1,
'spcoding': 16,
'splvalue': 0,
'stored_len': 905728L,
'stored_md5': 'c0c9ee22ae23700e7f3d41d00a4a5ca8',
'target': 'm0306',
'target_name': "main controller 'A3' app",
'version': '02.04.5170'}

Traceback (most recent call last):
File "dji_fwcon.py", line 672, in <module>
main(sys.argv[1:])
File "dji_fwcon.py", line 653, in main
dji_extract(po,fwpkgfile)
File "dji_fwcon.py", line 426, in dji_extract
encrypt_key = bytes.fromhex("96709aD326674AC382B66927E6d88421")
AttributeError: type object 'str' has no attribute 'fromhex'


C:\Python27>python openssl des3 -d -k Dji123456 -in P3X_FW_V01.11.0020_m0800.bin
-out P3X_FW_V01.11.0020_m0800_decrypted.tar.gz
python: can't open file 'openssl': [Errno 2] No such file or directory

C:\Python27>python tar -zxf P3X_FW_V01.11.0020_m0800_decrypted.tar.gz
python: can't open file 'tar': [Errno 2] No such file or directory
 
Openssl and tar are not python scripts. Get rid of the 'python part of strings, openssl is for decryption, tar for unpacking the archive. I did this part using Linux, for Windows you have to install openssl (not sure if availavle) and bite tar archive somehow (maybe 7zip?).
 
Code:
C:\Python27>python dji_fwcon.py -vvv -x -p P3X_FW_V01.11.0020.bin

Why would you use Python 2.7?


The error is caused by use of ancient Python:

Code:
AttributeError: type object 'str' has no attribute 'fromhex'

For further commands:
1. don't run them if you see a command before failed
2. they're not python scripts, you need the binaries to run

When I'm working on Windows, I usually use msys2 to get the tools Windows lacks. Though in Win10, there's some kind of Linux subsystem which offers them as well.
 
Why would you use Python 2.7?

Because I had to install a copy of pycrypto due to "couldn't find 'Crypto' module" and the Windows version I found V-2.6.1 would only work on Python 2.7

This is the problem I'm up against. I know just enough to keep myself IN trouble but not enough to get OUT of it.

Appreciate your comments.
 
Openssl and tar are not python scripts. Get rid of the 'python part of strings, openssl is for decryption, tar for unpacking the archive. I did this part using Linux, for Windows you have to install openssl (not sure if availavle) and bite tar archive somehow (maybe 7zip?).

Great ! Every little bit of education gets me closer to my goal of FPV on my tablet.
"not python scripts" is invaluable to me. Many thanks.
 
Because I had to install a copy of pycrypto due to "couldn't find 'Crypto' module" and the Windows version I found V-2.6.1 would only work on Python 2.7

Python finds and installs modules for you. Ie. `pip3 install pycrypto` or `pip3 install pycryptodome`.
 
Python finds and installs modules for you. Ie. `pip3 install pycrypto` or `pip3 install pycryptodome`.

With a new install of Python 3.8 and pycryptodome, I got the dji_fwcon.py -vvv -x -p P3X_FW_V01.11.0020.bin working.
It spewed out a bunch of files like P3X_FW_V01.11.0020_m0800.bin and P3X_FW_V01.11.0020_m0800.inf
Slowly but surely !

Edit:
And now I have DJI\Data folder with these files in it.
So I think I'm a bit further ahead now, or am I ?

uImage.JPG
 
Last edited:
Yes. You already flashed the bootloader (ubl and u-boot files), so all you need now is kernel image (uImage).

I successfully flashed the uImage in both primary and recovery locations plus I've flashed the encrypted partition with appropriate file.
I forgot I needed the primary kernel location temporarily to sort out the last and biggest headache of all:
Flashing the root file system.

The wiki says to use primary kernel location for temporary recovery rootfs tool.
You have used recovery kernel location.
Does it not matter which is used ?

I've read everything you've written and everything on the Wiki about this and it's slowly sinking in.
This is my last hurdle, so any further advice on the subject from anyone is most welcome. Cheers
 
Last edited:
Yes. You already flashed the bootloader (ubl and u-boot files), so all you need now is kernel image (uImage).

I'm almost done but can't figure out required commands to use LRZ via yModem to send dm365_root_ubifs.ubi file over serial.
Tried Wiki's USB method but can't get USB port to work (wired USB socket to OFDM ribbon cable) USB + and - pins wired correctly to pins 1 and 2 of ribbon cable as per your pic. 5v and Gnd are correct.

Dji-Pro # usb start . . . . returns with '0 devices' or something similar. Forgotten now.
Dji-Pro # usb storage

There is mention on the wiki that on some boards the USB port won't work without a software GPIO switch somehow.

Commands are supplied at the Wiki for USB method but not for serial method.
Can you please put me out of my misery. I'm so close to the end !
 
Last edited:
Dji-Pro # usb start . . . . returns with '0 devices' or something similar. Forgotten now.
Dji-Pro # usb storage

There is mention on the wiki that on some boards the USB port won't work without a software GPIO switch somehow.

Would be nice to know which GPIO line controls that. At the point when we're in Linux, we should be able to easily switch GPIOs.

Commands are supplied at the Wiki for USB method but not for serial method.
Can you please put me out of my misery. I'm so close to the end !

Looking at the manual:

It should be something like:
Code:
lrz --ymodem -b -8 /tmp/rootfs.ubi

Make sure the board is cooled somehow - the transfer will take quite some time.
 
Would be nice to know which GPIO line controls that. At the point when we're in Linux, we should be able to easily switch GPIOs.



Looking at the manual:

It should be something like:
Code:
lrz --ymodem -b -8 /tmp/rootfs.ubi

Make sure the board is cooled somehow - the transfer will take quite some time.

I managed to get the USB working, but it's still a bit flaky. I did get the rootfs written in the end, via USB.

ubiattach -m 2 --vid-hdr-offset=2048 . . returned with no errors !

I'll reassemble gimbal tomorrow and see if I've got fpv video. I'll worry about 8fps video later.
Thanks for the LRZ info above. May get another chance to try it out yet. Cheers
 
Would be nice to know which GPIO line controls that. At the point when we're in Linux, we should be able to easily switch GPIOs.



Looking at the manual:

It should be something like:
Code:
lrz --ymodem -b -8 /tmp/rootfs.ubi

Make sure the board is cooled somehow - the transfer will take quite some time.

Thanks to quaddamage and szupek for steering me in the right direction, I now have FPV.
Thanks guys !
And now to the 8fps problem ......

Edit:
I've got V1.11.0020 installed on my P3P. Can I apply the V1.11.0030 .. mod1.elf patch or should I do a full 0030 upgrade first ?


FPV Success.jpg
 

Attachments

  • FPV Success.jpg
    FPV Success.jpg
    50.4 KB · Views: 118
Last edited:
I've got V1.11.0020 installed on my P3P. Can I apply the V1.11.0030 .. mod1.elf patch or should I do a full 0030 upgrade first ?

Compared to V1.11.0020, the unofficial V1.11.0030 release only modifies ESC Firmware. I'd upgrade to it (though I keep my birds on a lower FW).
 
...I'd upgrade to it (though I keep my birds on a lower FW).
@quaddamage, what is your firmware of choice for your birds/RC/app?

Have a recently DJI repaired P3P and they stuffed 1.11.0020 on the craft for me. I walked it back using the DEBUG method to 1.9.6, but I only get 3500 feet of video transmission now. I've owned the craft since release, and have been well over 10,500 feet without issue. Looking to recover my range and P3P capabilities.

Thanks in advance for your time and wisdom.

SD
 

Recent Posts

Members online

Forum statistics

Threads
143,103
Messages
1,467,662
Members
104,992
Latest member
Johnboy94