-
Notifications
You must be signed in to change notification settings - Fork 427
Firmware m1300
Target
Purpose
Versions
Structure
OS and Libraries
Flashing
Interfaces
The module programs the TMS320DM365 firmware. Location of this chip is GL300 Interface board.
Complementary DM36x chip exists within the drone gimbal; the air part is programmed by module m0800.
The firmware is used on all boards with HDMI output, and on GL300a boards even if no HDMI output is present. Other RC models have the DM365 chip removed, so the firmware is not used.
The DaVinci firmware handles video transcoding between Lightbridge compression and the compression for mobile app. In the boards with HDMI output, it also prepares the uncompressed video signal for that output.
There are multiple versions, always unencrypted.
Marking | Packages | Timestamp | Overview |
---|---|---|---|
02.12.0000 | P3X_FW_V01.01.0006 P3X_FW_V01.01.1003 | 2015-04-30 ... 2015-05-01 | |
02.13.0000 | P3S_FW_V01.01.0008 P3S_FW_V01.01.0009 P3S_FW_V01.02.0007 P3S_FW_V01.02.0008 P3X_FW_V01.01.0008 P3X_FW_V01.01.0009 P3X_FW_V01.01.1007 P3X_FW_V01.02.0006 | 2015-05-06 ... 2015-07-10 | |
02.18.0001 | C1_FW_V01.03.0020 P3S_FW_V01.03.0020 P3XS_FW_RC_V01.03.0020 P3X_FW_V01.03.0020 | 2015-07-24 ... 2015-08-04 | |
02.18.0002 | C1_FW_V01.02.0021 C1_FW_V01.03.00.21 C1_FW_V01.04.0030 | 2015-07-28 ... 2015-09-29 | |
02.24.0000 | C1_FW_V01.05.0070 C1_FW_v01.05.0071 | 2015-11-24 ... 2016-02-01 | |
02.26.0000 | C1_FW_V01.01.0020 C1_FW_V01.01.0092 C1_FW_V01.05.0080 C1_FW_V01.06.0000 C1_FW_v01.01.0030 C1_FW_v01.01.0035 C1_FW_v01.01.0040 C1_FW_v01.01.0050 C1_FW_v01.01.0051 C1_FW_v01.01.0053 C1_FW_v01.01.0054 C1_FW_v01.01.0055 C1_FW_v01.01.0060 C1_FW_v01.01.0080 C1_FW_v01.01.0090 C1_FW_v01.07.0002 C1_FW_v01.07.0030 C1_FW_v01.07.0040 | 2016-03-15 ... 2016-12-08 | |
02.29.0000 | C1_FW_v01.06.0001 C1_FW_v01.07.0000 C1_FW_v01.08.0000 | 2016-08-13 ... 2016-09-12 | |
02.31.0000 | C1_FW_v01.09.0000 | 2016-11-08 | |
02.32.0000 | C1_FW_V01.01.0093 C1_FW_v01.07.0060 | 2016-11-10 ... 2016-12-29 |
The module is encrypted using OpenSSL salted format. Password is "Dji123456". Here is an example decryption command:
openssl des3 -d -k Dji123456 -in C1_FW_V01.06.0000_m1300.bin -out C1_FW_V01.06.0000_m1300_decrypted.tar.gz
Unencrypted firmware is a TAR GZip archive containing some Linux tools compiled for ARM, boot configuration and kernel modules. It also contains partition images which can be flashed.
In order to use the decrypted bootloader images dji/data/*.img
with sfh_DM36x or other chip manufacturers tools, first 0x800 bytes of the files have to be removed, ie.:
dd if=dji/data/u-boot.img of=u-boot_prop.img bs=2048 skip=1 dd if=dji/data/ubl1.img of=ubl1_prop.img bs=2048 skip=1
The files included in firmware update are written in appropriate places of the 128MB NAND flash memory. Map of the flash memory is as follows:
Offset | Description | Content |
---|---|---|
0020000 | U-boot init | ubl?.img, a copy every 0x20000 bytes; initial startup code for u-boot |
0320000 | U-boot app | u-boot.img, a copy every 0x60000 bytes; main part of the u-boot bootloader |
04a0000 | Primary kernel | uImage; the Linux Kernel normally used for booting |
0900000 | Recovery kernel | uImage_recovery, not included in FW updates; the Linux Kernel which is used when primary kernel gets corrupted |
0d60000 | Encrypted data | Hardware-encrypted partition |
0e00000 | Root Filesystem | ubifs-partition.ubi; Linux Root Filesystem, using UbiFS; contains kernel modules, tools and applications |
7f00000 | End of flash | also end of Root Filesystem partition |
The firmware consists of U-Boot boot loader and DaVinci Linux as OS.
Additional Kernel Modules and User Mode Applications are providing communication to Cypress USB Controller and video transcode functions.
Here are the known ways to flash the U-Boot bootloader and DaVinci Linux. Some of the flashing methods may not be listed here.
The official way of flashing the firmware is by selecting upgrade (or downgrade) in the mobile app. The app will download the firmware, extract modules from the package and distribute them to proper target components. In older versions of the firmware, it was also possible to update by inserting a flash drive containing new firmware to the USB port. In order to use this method, the DaVinci Linux system has to be functional. This means boot loader must work, at least one kernel image must work, UbiFS must be a valid root file system and encrypted partition must have valid data.
It is also possible to boot the chip into a mode which allows programming it via serial port. Since the board requires 3.3V serial interface, you will need USB to TTL converter (aka FTDI adapter) which supports this voltage.
Connect your 3.3V TTL converter to service pads. Don't worry about connecting RX and TX incorrectly, switching them will not damage anything, it just won't work. The pad names depend on the board you have:
- in GL300a board, the names are UART_RX, UART_TX and GND.
- in HDMI board, the names are 368_RX, 368_TX and GND.
If after tapping to the serial interface, you see no message, or booting does not get to loading kernel, the you should reflash u-boot images. To do that, you should boot the chip into a mode which allows programming it via serial port.
To switch the boot mode, short the Boot Select service pad to 3.3V. Then, use TI utilities on connected PC to flash your new image:
sfh_DM36x -nandflash -v -p "COM21" ubl1.img u-boot.img
You will need the unencrypted images of TI DaVinci Linux and the U-boot bootloader to do the flashing.
You can look at the description of the flashing procedure for Lightbridge for some details.
This method is based on Serial Boot and Flash Loading Utility provided by Texas Instruments.
If at the serial interface you see kernel boot error, or Recovery Kernel is booted, or kernel stops booting - you should reflash the kernel image. For example, this is how booting Recovery Kernel looks like:
U-Boot Product Vesion : DJI-DEC-Uboot-1.0-rc0(2015-11-02) U-Boot 2010.12-rc2-svn3214-Dji (Nov 02 2015 - 19:39:56) Cores: ARM 486 MHz DDR: 360 MHz I2C: ready DRAM: 128 MiB NAND: 128 MiB Bad block table found at page 65472, version 0x01 Bad block table found at page 65408, version 0x01 *** Warning - bad CRC, using default environment . Net: Ethernet PHY: GENERIC @ 0xff DaVinci-EMAC Press ESC to abort autoboot in 1 seconds . Loading from nand0, offset 0x4a0000 ** Unknown image type Wrong Image Format for bootm command ERROR: can't get kernel image! . Loading from nand0, offset 0x900000 Image Name: Linux-2.6.32.17-davinci1 Created: 2015-02-12 3:09:59 UTC Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 3665856 Bytes = 3.5 MiB Load Address: 80008000 Entry Point: 80008000 ## Booting kernel from Legacy Image at 80700000 ... Image Name: Linux-2.6.32.17-davinci1 Created: 2015-02-12 3:09:59 UTC Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 3665856 Bytes = 3.5 MiB Load Address: 80008000 Entry Point: 80008000 Loading Kernel Image ... OK OK . Starting kernel ... . [ 0.000000] Kernel Product Vesion : DJI-GRC-Kernel-1.0-rc8(2014-11-21) [ 0.000000] Linux version 2.6.32.17-davinci1 (u@dji) (gcc version 4.3.3 (Sourcery G++ Lite 2009q1-203) ) #1 PREEMPT Thu Feb 12 11:09:57 HKT 2015 [ 0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
Usually you will want to flash the primary kernel, uImage
, which you can get from any firmware update. But if your Recovery Kernel is also damaged, you may also flash the special recovery image uImage_recovery
. Get it (TODO: provide link).
To reflash the kernel, you need to press the ESC
key just when your board gets power, so that you end up in u-boot console. Next press Enter
to get rid of any additional ESC
s left in input buffer:
Press ESC to abort autoboot in 1 seconds Dji-Pro # Unknown command '' - try 'help' Dji-Pro #
Now, you need to load a new kernel image to DRAM, and from there, flash it to NAND memory.
Let's start by cleaning a portion of DRAM which we will use:
Dji-Pro # mw.b 0x80008000 0xFF 0x460000
Now we need to put our kernel image into that location. There are two ways:
The transfer over serial is very slow and cumbersome. It requires compatible terminal client. On Windows, you can use ExtraPuTTY. On Linux, Minicom can support it.
First, initiate the transfer on DaVinci side:
Dji-Pro # loady 0x80008000 115200 ## Ready for binary (ymodem) download to 0x80008000 at 115200 bps...
Then, use proper function in your terminal to select the target file. The transfer will last some time. After it finishes, you will see:
xyzModem - CRC mode, 1(SOH)/3971(STX)/0(CAN) packets, 4 retries ## Total Size = 0x003e09c0 = 4065728 Bytes Dji-Pro #
This is the method I'd suggest. It is fast and reliable. It was tested with 2GB sd-card formatted to FAT32 and inserted into USB Card Reader.
Copy the kernel image on your USB stick, and put it into USB slot of your board. Then, execute the following:
Dji-Pro # usb start Dji-Pro # usb storage
The second command isn't really needed, but it will show you your USB device, so that you know it is functioning. Now, start the loading process:
Dji-Pro # fatload usb 0 0x80008000 uImage
On success, you should see something like:
reading uImage . 4065728 bytes read Dji-Pro #
Be careful, you are now going to make changes to your NAND memory.
To write Primary Kernel, execute the following commands:
Dji-Pro # nand erase 0x04a0000 0x460000 Dji-Pro # nand write 0x80008000 0x04a0000 0x460000
In case you are writing Recovery Kernel, run the commands below instead:
Dji-Pro # nand erase 0x0900000 0x460000 Dji-Pro # nand write 0x80008000 0x0900000 0x460000
Do NOT write the same kernel image over the two locations! Having different kernels is beneficial.
Texas Instruments maintains an extensive Wiki with information about ways of Writing Image to NAND Flash for their processors.
What they propose as primary method is to update the firmware via Ethernet controller by using U-Boot boot loader functionalities. The wiki also discusses flashing the U-Boot itself, and contains links to descriptions of other flashing methods.
TODO
This page is created by drone enthusiasts for drone enthusiasts.
If you see a mistake, or you know more about specific subject, or you see an area for improvement for the wiki - create an issue in this project and attach your patch (or describe the change you propose).