o-gs / dji-firmware-tools

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

Gl300 Interface Board Failed Device Add #358

Closed nullibyte closed 10 months ago

nullibyte commented 10 months ago

Hey all, I've been trying to repair a interface board which initially had a bad u-boot image and corrupt primary firmware. But I get the following output when connecting phones over the usb interface:

DM36x initialization passed! UBL Product Vesion : DJI-486M-UBL-1.0-rc0(2015-10-30) Dji UBL Version: 1.51(Nov 2 2015 - 15:46:28) Booting Catalog Boot Loader BootMode = NAND Starting NAND Copy... Valid magicnum, 0xA1ACED66, found in block 0x00000019. DONE Jumping to entry point at 0x81080000.

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 Image Name: Linux-2.6.32.17-davinci1 Created: 2015-06-23 9:37:05 UTC Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 4065664 Bytes = 3.9 MiB Load Address: 80008000 Entry Point: 80008000 ## Booting kernel from Legacy Image at 80700000 ... Image Name: Linux-2.6.32.17-davinci1 Created: 2015-06-23 9:37:05 UTC Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 4065664 Bytes = 3.9 MiB Load Address: 80008000 Entry Point: 80008000 Loading Kernel Image ... OK OK

Starting kernel ...

[ 0.000000] Kernel Product Vesion : DJI-GRC-Kernel-1.1-rc0(2015-06-23) [ 0.000000] Linux version 2.6.32.17-davinci1 (root@dji) (gcc version 4.3.3 (Sourcery G++ Lite 2009q1-203) ) #6 PREEMPT Tue Jun 23 17:37:03 HKT 2015 [ 0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177 [ 0.000000] CPU: VIVT data cache, VIVT instruction cache [ 0.000000] Machine: DaVinci DM36x EVM [ 0.000000] Memory policy: ECC disabled, Data cache writeback [ 0.000000] DaVinci dm36x_rev1.2 variant 0x8 [ 0.000000] Built 1 zonelists in Zone order, mobility grouping off. Total pages: 12192 [ 0.000000] Kernel command line: console=ttyS0,115200n8 rw dm365_imp.oper_mode=0 video=davincifb:vid0=0,10K:vid1=0,10K:osd0=1920x1080X16,8100K mem=48MB davinci_enc_mngr.ch0_output=COMPOSITE davinci_enc_mngr.ch0_mode=pal ubi.mtd=2,2048 root=ubi0:rootfs rootfstype=ubifs ip=off lpj=1077248 [ 0.000000] PID hash table entries: 256 (order: -2, 1024 bytes) [ 0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes) [ 0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes) [ 0.000000] Memory: 48MB = 48MB total [ 0.000000] Memory: 44424KB available (3672K code, 444K data, 116K init, 0K highmem) [ 0.000000] SLUB: Genslabs=11, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1 [ 0.000000] Hierarchical RCU implementation. [ 0.000000] NR_IRQS:245 [ 0.000000] Console: colour dummy device 80x30 [ 0.000000] Calibrating delay loop (skipped) preset value.. 215.44 BogoMIPS (lpj=1077248) [ 0.000000] Mount-cache hash table entries: 512 [ 0.000000] CPU: Testing write buffer coherency: ok [ 0.000000] DaVinci: 8 gpio irqs [ 0.000000] NET: Registered protocol family 16 [ 0.090000] bio: create slab at 0 [ 0.100000] DM365 IPIPE initialized in Continuous mode [ 0.100000] SCSI subsystem initialized [ 0.100000] usbcore: registered new interface driver usbfs [ 0.100000] usbcore: registered new interface driver hub [ 0.110000] usbcore: registered new device driver usb [ 0.110000] vpss vpss: dm365_vpss vpss probed [ 0.110000] vpss vpss: dm365_vpss vpss probe success [ 0.110000] ch0 default output "COMPOSITE", mode "PAL" [ 0.110000] pinmux1:0x00145555 [ 0.110000] VPBE Encoder Initialized [ 0.120000] cfg80211: Using static regulatory domain info [ 0.120000] cfg80211: Regulatory domain: US [ 0.120000] (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp) [ 0.120000] (2402000 KHz - 2472000 KHz @ 40000 KHz), (600 mBi, 2700 mBm) [ 0.120000] (5170000 KHz - 5190000 KHz @ 40000 KHz), (600 mBi, 2300 mBm) [ 0.120000] (5190000 KHz - 5210000 KHz @ 40000 KHz), (600 mBi, 2300 mBm) [ 0.120000] (5210000 KHz - 5230000 KHz @ 40000 KHz), (600 mBi, 2300 mBm) [ 0.120000] (5230000 KHz - 5330000 KHz @ 40000 KHz), (600 mBi, 2300 mBm) [ 0.120000] (5735000 KHz - 5835000 KHz @ 40000 KHz), (600 mBi, 3000 mBm) [ 0.120000] cfg80211: Calling CRDA for country: US [ 0.120000] Switching to clocksource timer0_1 [ 0.120000] musb_hdrc: version 6.0, pio, host, debug=0 [ 0.150000] musb_hdrc: USB Host mode controller at fec64000 using PIO, IRQ 12 [ 0.150000] musb_hdrc musb_hdrc: MUSB HDRC host driver [ 0.150000] musb_hdrc musb_hdrc: new USB bus registered, assigned bus number 1 [ 0.150000] usb usb1: configuration #1 chosen from 1 choice [ 0.150000] hub 1-0:1.0: USB hub found [ 0.150000] hub 1-0:1.0: 1 port detected [ 0.150000] NET: Registered protocol family 2 [ 0.150000] IP route cache hash table entries: 1024 (order: 0, 4096 bytes) [ 0.150000] TCP established hash table entries: 2048 (order: 2, 16384 bytes) [ 0.150000] TCP bind hash table entries: 2048 (order: 1, 8192 bytes) [ 0.150000] TCP: Hash tables configured (established 2048 bind 2048) [ 0.150000] TCP reno registered [ 0.150000] NET: Registered protocol family 1 [ 0.150000] RPC: Registered udp transport module. [ 0.150000] RPC: Registered tcp transport module. [ 0.150000] RPC: Registered tcp NFSv4.1 backchannel transport module. [ 0.160000] kfile init [ 0.160000] JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc. [ 0.160000] msgmni has been set to 86 [ 0.160000] alg: No test for stdrng (krng) [ 0.160000] io scheduler noop registered (default) [ 0.200000] davincifb davincifb.0: dm_osd0_fb: Initial window configuration is invalid. [ 0.200000] davincifb davincifb.0: dm_osd0_fb: 1920x1080x16@0,0 with framebuffer size 8100KB [ 0.200000] davincifb davincifb.0: dm_vid0_fb: 0x0x16@0,0 with framebuffer size 10KB [ 0.210000] davincifb davincifb.0: dm_osd1_fb: Initial window configuration is invalid. [ 0.220000] davincifb davincifb.0: dm_osd1_fb: 1920x1080x4@0,0 with framebuffer size 4050KB [ 0.220000] davincifb davincifb.0: dm_vid1_fb: 0x0x16@0,0 with framebuffer size 10KB [ 0.270000] venc off init [ 0.270000] hdmi status init [ 0.270000] DM365 IPIPEIF probed [ 0.280000] imp serializer initialized [ 0.280000] davinci_previewer initialized [ 0.280000] davinci_resizer initialized [ 0.280000] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled [ 0.280000] serial8250.0: ttyS0 at MMIO 0x1c20000 (irq = 40) is a 16550A [ 0.750000] console [ttyS0] enabled [ 0.750000] serial8250.0: ttyS1 at MMIO 0x1d06000 (irq = 41) is a 16550A [ 0.760000] brd: module loaded [ 0.770000] NAND device: Manufacturer ID: 0x2c, Chip ID: 0xf1 (Micron NAND 128MiB 3,3V 8-bit) [ 0.780000] Creating 4 MTD partitions on "davinci_nand.0": [ 0.790000] 0x000000000000-0x0000004a0000 : "bootloader" [ 0.790000] 0x0000004a0000-0x000000e00000 : "kernel" [ 0.800000] 0x000000e00000-0x000007f00000 : "filesystem" [ 0.810000] 0x000000000000-0x000008000000 : "all" [ 0.820000] davinci_nand davinci_nand.0: controller rev. 2.3 [ 0.830000] UBI: attaching mtd2 to ubi0 [ 0.830000] UBI: physical eraseblock size: 131072 bytes (128 KiB) [ 0.840000] UBI: logical eraseblock size: 126976 bytes [ 0.840000] UBI: smallest flash I/O unit: 2048 [ 0.850000] UBI: sub-page size: 512 [ 0.850000] UBI: VID header offset: 2048 (aligned 2048) [ 0.860000] UBI: data offset: 4096 [ 1.030000] usb 1-1: new high speed USB device using musb_hdrc and address 2 [ 1.180000] usb 1-1: configuration #1 chosen from 1 choice [ 1.180000] hub 1-1:1.0: USB hub found [ 1.190000] hub 1-1:1.0: 2 ports detected [ 1.310000] UBI: attached mtd2 to ubi0 [ 1.310000] UBI: MTD device name: "filesystem" [ 1.320000] UBI: MTD device size: 113 MiB [ 1.320000] UBI: number of good PEBs: 904 [ 1.330000] UBI: number of bad PEBs: 0 [ 1.330000] UBI: max. allowed volumes: 128 [ 1.340000] UBI: wear-leveling threshold: 4096 [ 1.340000] UBI: number of internal volumes: 1 [ 1.350000] UBI: number of user volumes: 1 [ 1.350000] UBI: available PEBs: 0 [ 1.360000] UBI: total number of reserved PEBs: 904 [ 1.360000] UBI: number of PEBs reserved for bad PEB handling: 9 [ 1.370000] UBI: max/mean erase counter: 23/1 [ 1.370000] UBI: image sequence number: 1249621002 [ 1.380000] UBI: background thread "ubi_bgt0d" started, PID 342 [ 1.390000] console [netcon0] enabled [ 1.390000] netconsole: network logging started [ 1.390000] Initializing USB Mass Storage driver... [ 1.400000] usbcore: registered new interface driver usb-storage [ 1.410000] USB Mass Storage support registered. [ 1.410000] usbcore: registered new interface driver usbtest [ 1.420000] i2c /dev entries driver [ 1.420000] Linux video capture interface: v2.00 [ 1.430000] hdmi_i2c_probe [ 1.440000] vpfe-capture: vpss clock vpss_master enabled [ 1.440000] vpfe-capture vpfe-capture: v4l2 device registered [ 1.450000] vpfe-capture vpfe-capture: video device registered [ 1.460000] No sub devices registered [ 1.460000] Trying to register davinci display video device. [ 1.470000] layer=c1feb000,layer->video_dev=c1feb164 [ 1.470000] Trying to register davinci display video device. [ 1.480000] layer=c1feb400,layer->video_dev=c1feb564 [ 1.490000] davinci_init:DaVinci V4L2 Display Driver V1.0 loaded [ 1.490000] watchdog watchdog: heartbeat 1 sec [ 1.500000] usbcore: registered new interface driver usbmouse [ 1.500000] usbmouse: v1.6:USB HID Boot Protocol mouse driver [ 1.510000] TCP cubic registered [ 1.510000] NET: Registered protocol family 17 [ 1.520000] lib80211: common routines for IEEE802.11 drivers [ 1.520000] ksocket init [ 1.550000] encrypt device:atsha204 found [ 1.630000] mfi_i2c_client addr:17 [ 1.640000] Clocks: disable unused mmcsd0 [ 1.640000] Clocks: disable unused mmcsd1 [ 1.640000] Clocks: disable unused spi0 [ 1.640000] Clocks: disable unused spi1 [ 1.640000] Clocks: disable unused spi2 [ 1.640000] Clocks: disable unused spi3 [ 1.640000] Clocks: disable unused spi4 [ 1.640000] Clocks: disable unused pwm0 [ 1.640000] Clocks: disable unused pwm1 [ 1.640000] Clocks: disable unused pwm2 [ 1.640000] Clocks: disable unused pwm3 [ 1.640000] Clocks: disable unused timer1 [ 1.640000] Clocks: disable unused timer3 [ 1.640000] Clocks: disable unused emac [ 1.640000] Clocks: disable unused voice_codec [ 1.640000] Clocks: disable unused asp0 [ 1.640000] Clocks: disable unused rto [ 1.640000] Clocks: disable unused mjcp [ 1.710000] davinci_emac_probe: using random MAC addr: e2:88:87:af:5f:a6 [ 1.730000] emac-mii: probed [ 1.760000] UBIFS: recovery needed [ 1.810000] UBIFS: recovery completed [ 1.810000] UBIFS: mounted UBI device 0, volume 0, name "rootfs" [ 1.820000] UBIFS: file system size: 110342144 bytes (107756 KiB, 105 MiB, 869 LEBs) [ 1.830000] UBIFS: journal size: 9023488 bytes (8812 KiB, 8 MiB, 72 LEBs) [ 1.830000] UBIFS: media format: w4/r0 (latest is w4/r0) [ 1.840000] UBIFS: default compressor: lzo [ 1.840000] UBIFS: reserved for root: 0 bytes (0 KiB) [ 1.850000] VFS: Mounted root (ubifs filesystem) on device 0:13. [ 1.860000] Freeing init memory: 116K

Filesystem Product Vesion : DJI-Filesystem-1.0-rc2 Runing /etc/init.d/rcS [ 3.440000] CMEMK module: built on Jul 30 2014 at 10:21:45 [ 3.460000] Reference Linux version 2.6.32 [ 3.460000] File /home/u/work/svn/dec_grc/src/dvsdk/dvsdk_dm368_4_02_00_06/linuxutils_2_26_01_02/packages/ti/sdo/linuxutils/cmem/src/module/cmemk.c [ 3.480000] allocated heap buffer 0xc7000000 of size 0x4400000 [ 3.510000] heap fallback enabled - will try heap if pool buffer is not available [ 3.510000] CMEM Range Overlaps Kernel Physical - allowing overlap [ 3.520000] CMEM phys_start (0x1000) overlaps kernel (0x80000000 -> 0x83000000) [ 3.530000] cmemk initialized [ 3.560000] IRQK module: built on Jul 30 2014 at 10:21:09 [ 3.560000] Reference Linux version 2.6.32 [ 3.580000] File /home/u/work/svn/dec_grc/src/dvsdk/dvsdk_dm368_4_02_00_06/linuxutils_2_26_01_02/packages/ti/sdo/linuxutils/irq/src/module/irqk.c [ 3.600000] irqk initialized [ 3.640000] EDMAK module: built on Jul 30 2014 at 10:19:34 [ 3.660000] Reference Linux version 2.6.32 [ 3.660000] File /home/u/work/svn/dec_grc/src/dvsdk/dvsdk_dm368_4_02_00_06/linuxutils_2_26_01_02/packages/ti/sdo/linuxutils/edma/src/module/edmak.c [ 3.860000] exFAT: Version 1.2.9 settime:2023.08.12 15:07:13 [ 5.620000] usb 1-1.1: new high speed USB device using musb_hdrc and address 3 [ 5.750000] usb 1-1.1: configuration #1 chosen from 1 choice * daemon not running. starting it now on port 5037 * daemon started successfully [ 9.370000] usbcore: registered new interface driver usb_applehid [ 9.390000] usb applehid module init ok [ 9.430000] 68013 connected [ 9.430000] usbcore: registered new interface driver usb_68013 [ 9.460000] usb 68013 module init ok sulogin: no password entry for root [ 9.640000] UBI: scrubbed PEB 239 (LEB 0:267), data moved to PEB 372 login[499]: root login on 'ttyS0'

Process /etc/profile...

root@Dji-Pro:~# encrypt check ok init libusb successed!!! usbmuxd disabled usbsocket_init OK usbsocket_create_handle ok, port:22345, bCanRecv:1 usbsocket_create_handle ok, port:22346, bCanRecv:0 watchdog timeout:5 latency1:33332 latency2:33000 latency3:30000 displaybuffnum1:4 displaybuffnum2:9 start decode stream from 68013 decode init ok, main thread exit get 1765 version,200040a 40c0104 get FPGA version,10007ee 100083b 68013 exist encrypt chip exist Osd_Init_Font succeed [ 10.510000] pinmux1:0x00145555 [ 10.510000] pinmux1:0x00145555 [ 10.570000] pinmux1:0x00145555 [ 10.580000] pinmux1:0x00145555 [ 10.580000] pinmux1:0x00145555 umount: can't umount /mnt/usb: No such file or directory rmdir: '/mnt/usb': No such file or directory DummyRead68013 0.000000kb [ 12.430000] PCLK = 0 -> 0 [ 12.430000] HTotal = 0 -> 1650 [ 12.440000] VTotal = 0 -> 750 [ 12.440000] ScanMode = I -> P [ 12.440000] PCLK = 0,(1650x750) PROGRESS CHANGE MODE [ 12.450000] VIC = 4 DummyRead68013 0.000000kb DummyRead68013 0.000000kb DummyRead68013 0.000000kb DummyRead68013 0.000000kb DummyRead68013 0.000000kb DummyRead68013 0.000000kb [ 18.680000] usb 1-1.2: new high speed USB device using musb_hdrc and address 4 [ 18.800000] usb 1-1.2: configuration #1 chosen from 2 choices **android device add vid = 0x4e8** thread_connection_fun thread running error: device not found conn failed, type:0, port:22345 conn failed, type:0, port:22346 conn failed, type:0, port:22345 error: device not found conn failed, type:0, port:22346 conn failed, type:0, port:22345 conn failed, type:0, port:22346 conn failed, type:0, port:22345 error: device not found conn failed, type:0, port:22346 conn failed, type:0, port:22345 conn failed, type:0, port:22346 conn failed, type:0, port:22345 error: device not found conn failed, type:0, port:22346 DummyRead68013 0.000000kb conn failed, type:0, port:22345 conn failed, type:0, port:22346 conn failed, type:0, port:22345 [ 19.970000] usb 1-1.2: USB disconnect, address 4 error: device not found conn failed, type:0, port:22346 conn failed, type:0, port:22345 conn failed, type:0, port:22346 *android device remove** thread_connection_fun go to end DummyRead68013 0.000000kb DummyRead68013 0.000000kb DummyRead68013 0.000000kb DummyRead68013 0.000000kb `

I have not seen " error: device not found" or "conn failed, type:0, port:XXX" documented on the wiki. Anyone have any ideas what the issue could be? Also of note the style of interface board is: WM610_GRCP_MFI368_V1

mefistotelis commented 10 months ago

Wiki describes drones, not mobile devices which you could connect. The drone part, from the log, functions properly.

    puts("thread_connection_fun thread running  * * * * * * *");
    j_ThreadSignal_MaskPipe();
    for ( i = 0; i <= 1; ++i )
    {
      pConn = &s_arr_conn[i];
      if ( pConn->bUsed )
      {
        init_connection(pConn, s_device_type);
        pConn->bFirstRecv = 0;
        pConn->conn_state = 0;
        ((void (__fastcall *)(int *, int))pConn->fun_conn)(&pConn->sfd, pConn->port);
      }
    }
    while ( mDevicePlugin )
    {
      for ( i = 0; i <= 1; ++i )
      {
        pConn_0 = &s_arr_conn[i];
        if ( pConn_0->bUsed )
        {
          if ( ((int (__fastcall *)(int))pConn_0->fun_is_conn)(pConn_0->sfd) )
          {
            if ( !pConn_0->conn_state && pConn_0->type == 1 )
              usbmuxd_send_first(pConn_0);
            if ( !pConn_0->conn_state )
            {
              pConn_0->conn_state = 1;
              printf("connecte ok, type:%d, port:%d\n", pConn_0->type, pConn_0->port);
            }
            if ( pConn_0->type == 1 && !pConn_0->bCanRecv && !pConn_0->bFirstRecv )
            {
              slRet = ((int (__fastcall *)(int, INT8U *, signed int))pConn_0->fun_recv)(pConn_0->sfd, aucBuff, 1024);
              if ( slRet > 0 )
              {
                printf("ios device first recv, type:%d, port:%d\n", pConn_0->type, pConn_0->port);
                pConn_0->bFirstRecv = 1;
              }
            }
          }
          else
          {
            printf("conn failed, type:%d, port:%d\n", pConn_0->type, pConn_0->port);
            ((void (__fastcall *)(int *))pConn_0->fun_close)(&pConn_0->sfd);
            ((void (__fastcall *)(int *, int))pConn_0->fun_conn)(&pConn_0->sfd, pConn_0->port);
            pConn_0->conn_state = 0;
            pConn_0->bFirstRecv = 0;
          }
        }
      }
      usleep(0x186A0u);
    }
nullibyte commented 10 months ago

Oh interesting, so this will appear over serial for any interface board that has a phone connected rather than a drone if I understand that part. Ill give that a try with a known working interface board. Looks like I'll have to do more digging to see why the dji go app cannot sense the usb connection

nullibyte commented 10 months ago

I had a chance to compare against a working unit and verified that the log does indeed act the same way. However I recently gained access to a variant of the usb board with the chips on board rather than on a daughterboard. Same issue of firmware appearing functional, but the usb board rejecting connections to phones and usb storage devices.

Since this issue is unrelated to the request, I'll close the issue but add my findings if I find a fix for the two faulty boards