DFU 不在裸机中传输数据

DFU not transferring data in barebox

我在定制开发板上工作 - 没有可移动存储 (sd),只有一个 UART。我需要使用裸机引导加载程序在 QSPI 存储上传输文件。

我正在尝试使用 DFU 传输各种文件以写入 QSPI

设备树有以下内容

&usbotg1 { 
dr_mode = "otg"; 
status = "okay"; 
}; 

&usbphy1 { 
fsl,tx-d-cal = <106>; 
};

板子上已经设置OTG模式为peripheral,开始dfu接受文件

barebox@Freescale:/ otg.mode=peripheral 
barebox@Freescale:/ dfu /tmp/qspi-header(qspi)src 
udc0: registering UDC driver [g_dfu]
dfu: register alt0(qspi) with device /tmp/qspi-header 
g_dfu usbgadget: g_dfu ready 
g_dfu usbgadget: high-speed config #1: USB DFU 

在系统上,开发板被检测为 DFU 设备

harkirat@harkirat-devsys:~$ sudo 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 sourceforge.net/p/dfu-util/… 

Found DFU: [1d50:60a2] ver=0316, devnum=13, cfg=1, intf=0, path="1-2", alt=0, name="qspi", serial="UNKNOWN" 

因此在传输文件时

harkirat@harkirat-devsys:~$ sudo dfu-util -a qspi -D qspi-header 
dfu-util 0.9 

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.

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 1d50:60a2 
Run-time device DFU version 0100 
Claiming USB DFU Interface... 
Setting Alternate Setting #0 ... 
Determining device status: state = dfuIDLE, status = 0 
dfuIDLE, continuing 
DFU mode device DFU version 0100 
Device returned transfer size 4096 
Copying data from PC to DFU device 
Download [=========================] 100% 512 bytes 
Download done. 
state(6) = dfuMANIFEST-SYNC, status(0) = No error condition is present 
state(7) = dfuMANIFEST, status(0) = No error condition is present 
state(6) = dfuMANIFEST-SYNC, status(0) = No error condition is present 
state(7) = dfuMANIFEST, status(0) = No error condition is present 
state(6) = dfuMANIFEST-SYNC, status(0) = No error condition is present 
state(7) = dfuMANIFEST, status(0) = No error condition is present 
state(6) = dfuMANIFEST-SYNC, status(0) = No error condition is present 
state(7) = dfuMANIFEST, status(0) = No error condition is present 
state(6) = dfuMANIFEST-SYNC, status(0) = No error condition is present 

最后两行不断重复。最终在两者上都按 Ctrl-C

确实显示文件下载完成。但是接收端什么也没有。在董事会

…
g_dfu usbgadget: high-speed config #1: USB DFU 
g_dfu udc0: unregistering UDC driver [fsl-usb2-udc] 
dfu: Interrupted system call 
barebox@Freescale:/ ls /tmp/ 
barebox@Freescale:/

所以问题是为什么????

最近报告与您的问题相匹配的回归是由

引起的

697f53a90224 ("usb: gadget: dfu: Wrap fs operation in workqueue")

这里有第一个修复:

https://lore.barebox.org/barebox/20210830144835.27458-1-jmaselbas@kalray.eu

试试看是否能解决您的问题。

不幸的是,回归失败了,但大多数用户似乎使用 fastboot 或 DFU 与 multigadget 功能(usbgadget -D 命令而不是 dfu 命令)。我建议你对一个新项目也这样做。 fastboot 对 UBI (u) 标志有特殊支持,这允许它在更新时透明地调用 ubiformat 并且它可以重新导出 barebox_update 处理程序,因此您可以使用例如更新:

fastboot flash bbu-nand barebox-myboard.img
fastboot flash rootfs-nand my.ubi

usbgadget 命令允许小工具在 'background' 中工作。因此您可以继续使用 shell 并同时导出多个小工具:例如USB串行控制台和DFU在同一时间。尽管出现了上述回归,这应该仍然有效,因为那个回归只破坏了 dfu 命令。