[U-Boot] dfu broken on rk3288 dwc2_otg

Hi,
Has anyone successfully used DFU on an rk3288 or dwc2_otg based board? When trying to download a binary to the board over DFU it currently seems to timeout and the transfer fails. I have tested the firefly-rk3288 and also the Tinkerboard.
I have successfully used the same setup on an am335x beaglebone black on the same U-Boot commit.
U-Boot:
U-Boot 2019.01-00189-g2acc24fc28 (Jan 21 2019 - 16:27:07 +0000)
Model: Firefly-RK3288 DRAM: 4 GiB MMC: dwmmc@ff0c0000: 1, dwmmc@ff0f0000: 0 Loading Environment from MMC... *** Warning - bad CRC, using default environment
In: serial Out: serial Err: serial Model: Firefly-RK3288 Net: Warning: ethernet@ff290000 (eth0) using random MAC address - ba:90:f6:9f:c4:70 eth0: ethernet@ff290000 Hit any key to stop autoboot: 0 => setenv dfu_alt_info "kernel ram ${kernel_addr_r} 0x4000000" => dfu 0 ram 0
Desktop:
[jack@arch-corsair rk3288]$ dfu-util -l dfu-util 0.9
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc. Copyright 2010-2016 Tormod Volden and Stefan Schmidt This program is Free Software and has ABSOLUTELY NO WARRANTY Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
Found DFU: [2207:320a] ver=9999, devnum=84, cfg=1, intf=0, path="5-4.1", alt=0, name="kernel", serial="UNKNOWN"
[jack@arch-corsair rk3288]$ dfu-util -D test.img -a 0 dfu-util 0.9
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc. Copyright 2010-2016 Tormod Volden and Stefan Schmidt This program is Free Software and has ABSOLUTELY NO WARRANTY Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
dfu-util: Invalid DFU suffix signature dfu-util: A valid DFU suffix will be required in a future dfu-util release!!! Opening DFU capable USB device... ID 2207:320a Run-time device DFU version 0110 Claiming USB DFU Interface... Setting Alternate Setting #0 ... Determining device status: state = dfuIDLE, status = 0 dfuIDLE, continuing DFU mode device DFU version 0110 Device returned transfer size 4096 Copying data from PC to DFU device Download [ ] 0% 0 bytes dfu-util: Error during download get_status

Hi Jack,
On 01/22/2019 01:55 AM, Jack Mitchell wrote:
Hi,
Has anyone successfully used DFU on an rk3288 or dwc2_otg based board? When trying to download a binary to the board over DFU it currently seems to timeout and the transfer fails. I have tested the firefly-rk3288 and also the Tinkerboard.
I'm not sure if anyone else has test the dfu on rk3288, we have only test rockusb, so maybe some variable needs to adapt for rk3288.
Thanks. - Kever
I have successfully used the same setup on an am335x beaglebone black on the same U-Boot commit.
U-Boot:
U-Boot 2019.01-00189-g2acc24fc28 (Jan 21 2019 - 16:27:07 +0000)
Model: Firefly-RK3288 DRAM: 4 GiB MMC: dwmmc@ff0c0000: 1, dwmmc@ff0f0000: 0 Loading Environment from MMC... *** Warning - bad CRC, using default environment
In: serial Out: serial Err: serial Model: Firefly-RK3288 Net: Warning: ethernet@ff290000 (eth0) using random MAC address - ba:90:f6:9f:c4:70 eth0: ethernet@ff290000 Hit any key to stop autoboot: 0 => setenv dfu_alt_info "kernel ram ${kernel_addr_r} 0x4000000" => dfu 0 ram 0
Desktop:
[jack@arch-corsair rk3288]$ dfu-util -l dfu-util 0.9
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc. Copyright 2010-2016 Tormod Volden and Stefan Schmidt This program is Free Software and has ABSOLUTELY NO WARRANTY Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
Found DFU: [2207:320a] ver=9999, devnum=84, cfg=1, intf=0, path="5-4.1", alt=0, name="kernel", serial="UNKNOWN"
[jack@arch-corsair rk3288]$ dfu-util -D test.img -a 0 dfu-util 0.9
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc. Copyright 2010-2016 Tormod Volden and Stefan Schmidt This program is Free Software and has ABSOLUTELY NO WARRANTY Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
dfu-util: Invalid DFU suffix signature dfu-util: A valid DFU suffix will be required in a future dfu-util release!!! Opening DFU capable USB device... ID 2207:320a Run-time device DFU version 0110 Claiming USB DFU Interface... Setting Alternate Setting #0 ... Determining device status: state = dfuIDLE, status = 0 dfuIDLE, continuing DFU mode device DFU version 0110 Device returned transfer size 4096 Copying data from PC to DFU device Download [ ] 0% 0 bytes dfu-util: Error during download get_status _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot

On Mon, 21 Jan 2019 17:55:51 +0000 Jack Mitchell ml@embed.me.uk wrote:
Hi,
Has anyone successfully used DFU on an rk3288 or dwc2_otg based board? When trying to download a binary to the board over DFU it currently seems to timeout and the transfer fails. I have tested the firefly-rk3288 and also the Tinkerboard.
I see from the output that you are using dwmmc. You may want to look into trats/trats2/Odroid XU3 board from Samsung, as they use the same IP block (and shall work).
I have successfully used the same setup on an am335x beaglebone black on the same U-Boot commit.
U-Boot:
U-Boot 2019.01-00189-g2acc24fc28 (Jan 21 2019 - 16:27:07 +0000)
Model: Firefly-RK3288 DRAM: 4 GiB MMC: dwmmc@ff0c0000: 1, dwmmc@ff0f0000: 0 Loading Environment from MMC... *** Warning - bad CRC, using default environment
In: serial Out: serial Err: serial Model: Firefly-RK3288 Net: Warning: ethernet@ff290000 (eth0) using random MAC address - ba:90:f6:9f:c4:70 eth0: ethernet@ff290000 Hit any key to stop autoboot: 0 => setenv dfu_alt_info "kernel ram ${kernel_addr_r} 0x4000000" => dfu 0 ram 0
Desktop:
[jack@arch-corsair rk3288]$ dfu-util -l dfu-util 0.9
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc. Copyright 2010-2016 Tormod Volden and Stefan Schmidt This program is Free Software and has ABSOLUTELY NO WARRANTY Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
Found DFU: [2207:320a] ver=9999, devnum=84, cfg=1, intf=0, path="5-4.1", alt=0, name="kernel", serial="UNKNOWN"
[jack@arch-corsair rk3288]$ dfu-util -D test.img -a 0 dfu-util 0.9
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc. Copyright 2010-2016 Tormod Volden and Stefan Schmidt This program is Free Software and has ABSOLUTELY NO WARRANTY Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
dfu-util: Invalid DFU suffix signature dfu-util: A valid DFU suffix will be required in a future dfu-util release!!! Opening DFU capable USB device... ID 2207:320a Run-time device DFU version 0110 Claiming USB DFU Interface... Setting Alternate Setting #0 ... Determining device status: state = dfuIDLE, status = 0 dfuIDLE, continuing DFU mode device DFU version 0110 Device returned transfer size 4096 Copying data from PC to DFU device Download [ ] 0% 0 bytes dfu-util: Error during download get_status _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de

On 21/01/2019 17:55, Jack Mitchell wrote:
Hi,
Has anyone successfully used DFU on an rk3288 or dwc2_otg based board? When trying to download a binary to the board over DFU it currently seems to timeout and the transfer fails. I have tested the firefly-rk3288 and also the Tinkerboard.
I have successfully used the same setup on an am335x beaglebone black on the same U-Boot commit.
U-Boot:
U-Boot 2019.01-00189-g2acc24fc28 (Jan 21 2019 - 16:27:07 +0000)
Model: Firefly-RK3288 DRAM: 4 GiB MMC: dwmmc@ff0c0000: 1, dwmmc@ff0f0000: 0 Loading Environment from MMC... *** Warning - bad CRC, using default environment
In: serial Out: serial Err: serial Model: Firefly-RK3288 Net: Warning: ethernet@ff290000 (eth0) using random MAC address - ba:90:f6:9f:c4:70 eth0: ethernet@ff290000 Hit any key to stop autoboot: 0 => setenv dfu_alt_info "kernel ram ${kernel_addr_r} 0x4000000" => dfu 0 ram 0
Desktop:
[jack@arch-corsair rk3288]$ dfu-util -l dfu-util 0.9
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc. Copyright 2010-2016 Tormod Volden and Stefan Schmidt This program is Free Software and has ABSOLUTELY NO WARRANTY Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
Found DFU: [2207:320a] ver=9999, devnum=84, cfg=1, intf=0, path="5-4.1", alt=0, name="kernel", serial="UNKNOWN"
[jack@arch-corsair rk3288]$ dfu-util -D test.img -a 0 dfu-util 0.9
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc. Copyright 2010-2016 Tormod Volden and Stefan Schmidt This program is Free Software and has ABSOLUTELY NO WARRANTY Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
dfu-util: Invalid DFU suffix signature dfu-util: A valid DFU suffix will be required in a future dfu-util release!!! Opening DFU capable USB device... ID 2207:320a Run-time device DFU version 0110 Claiming USB DFU Interface... Setting Alternate Setting #0 ... Determining device status: state = dfuIDLE, status = 0 dfuIDLE, continuing DFU mode device DFU version 0110 Device returned transfer size 4096 Copying data from PC to DFU device Download [ ] 0% 0 bytes dfu-util: Error during download get_status _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
I've been debugging this further and from my limited USB knowledge, it looks like it's missing the host sending a packet. Using wireshark and usbmon I can see the following flow:
host -> device 4096 byte packet (first transfer of data after setup) device -> host acks 4096 packet host -> device 6 byte packet (get dfu status, is missed by device) host times out on waiting for ack
wireshark screen capture: https://imgur.com/a/ZGopclV dwc2_otg debug output attached
Any clues on this would be great as I'm at a bit of a loss. I've tried comparing the ISR with the linux driver but they're very different and the linux driver seems to handle more edge cases which maybe I'm hitting.
The final few lines of the debug output is the driver receiving the 4096 byte packet, and then nothing else comes through. If I try to send the file again from the host it can't communicate with the device anymore until I stop the dfu command from uboot and then start it again.
If anyone has any of the Samsung boards with the same otg driver it would be great if I could get some confirmation that they still work; we might be able to pin it down to some Rockchip specific configuration.
Regards, Jack.

On 21/01/2019 17:55, Jack Mitchell wrote:
Hi,
Has anyone successfully used DFU on an rk3288 or dwc2_otg based board? When trying to download a binary to the board over DFU it currently seems to timeout and the transfer fails. I have tested the firefly-rk3288 and also the Tinkerboard.
I have successfully used the same setup on an am335x beaglebone black on the same U-Boot commit.
U-Boot:
U-Boot 2019.01-00189-g2acc24fc28 (Jan 21 2019 - 16:27:07 +0000)
Model: Firefly-RK3288 DRAM: 4 GiB MMC: dwmmc@ff0c0000: 1, dwmmc@ff0f0000: 0 Loading Environment from MMC... *** Warning - bad CRC, using default environment
In: serial Out: serial Err: serial Model: Firefly-RK3288 Net: Warning: ethernet@ff290000 (eth0) using random MAC address - ba:90:f6:9f:c4:70 eth0: ethernet@ff290000 Hit any key to stop autoboot: 0 => setenv dfu_alt_info "kernel ram ${kernel_addr_r} 0x4000000" => dfu 0 ram 0
Desktop:
[jack@arch-corsair rk3288]$ dfu-util -l dfu-util 0.9
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc. Copyright 2010-2016 Tormod Volden and Stefan Schmidt This program is Free Software and has ABSOLUTELY NO WARRANTY Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
Found DFU: [2207:320a] ver=9999, devnum=84, cfg=1, intf=0, path="5-4.1", alt=0, name="kernel", serial="UNKNOWN"
[jack@arch-corsair rk3288]$ dfu-util -D test.img -a 0 dfu-util 0.9
Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc. Copyright 2010-2016 Tormod Volden and Stefan Schmidt This program is Free Software and has ABSOLUTELY NO WARRANTY Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
dfu-util: Invalid DFU suffix signature dfu-util: A valid DFU suffix will be required in a future dfu-util release!!! Opening DFU capable USB device... ID 2207:320a Run-time device DFU version 0110 Claiming USB DFU Interface... Setting Alternate Setting #0 ... Determining device status: state = dfuIDLE, status = 0 dfuIDLE, continuing DFU mode device DFU version 0110 Device returned transfer size 4096 Copying data from PC to DFU device Download [ ] 0% 0 bytes dfu-util: Error during download get_status _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
I've been debugging this further and from my limited USB knowledge, it looks like it's missing the host sending a packet. Using wireshark and usbmon I can see the following flow:
host -> device 4096 byte packet (first transfer of data after setup) device -> host acks 4096 packet host -> device 6 byte packet (get dfu status, is missed by device) host times out on waiting for ack
wireshark screen capture: https://imgur.com/a/ZGopclV dwc2_otg debug output attached
Any clues on this would be great as I'm at a bit of a loss. I've tried comparing the ISR with the linux driver but they're very different and the linux driver seems to handle more edge cases which maybe I'm hitting.
The final few lines of the debug output is the driver receiving the 4096 byte packet, and then nothing else comes through. If I try to send the file again from the host it can't communicate with the device anymore until I stop the dfu command from uboot and then start it again.
If anyone has any of the Samsung boards with the same otg driver it would be great if I could get some confirmation that they still work; we might be able to pin it down to some Rockchip specific configuration.
Regards, Jack.
participants (4)
-
Jack Mitchell
-
Jack Mitchell
-
Kever Yang
-
Lukasz Majewski