2010-10-12 12:08:39 USB Bulk Transfer Failure from BF525 Mass Storage Device
Wayne Tinklepaugh (UNITED STATES)
Message: 94435
We are having a problem with USB bulk transfers on a BF525 based design. We have the BF525 configured to run with the USB Gadget driver and connect to a PC as a USB Mass Storage Device. When we copy a group of files from the BF525 Mass Storage device to a PC, we intermittently get copy failures where the PC loses connection with the BF525 Mass Storage device and attempts to reset the USB connection. The end result is that the PC cannot reset the connection, Windows displays an error msg, and the only recovery mechanism is to unplug the device from the host PC and reconnect (not very user friendly).
We have been able to capture a USB trace on a CATC USB Analyzer when the file copy error occurrs. When the error occurs, it appears that the host is in the middle of a bulk transfer of 64Kbytes when all of a sudden the device quits responding to subsequent IN requests from the host. In the particular failure that I captured, I see one bulk transfer of 64K complete successfully then a second bulk transfer of 64K is setup and started. In the second 64K bulk transfer, seven IN requests of 512 bytes are ACK'ed properly and the host follows this up with subsequent IN requests, but the device never supplies the data that the host is requesting. After about 10 seconds of IN requests from the host and only NAKs from the device, the host finally resets the USB bus and attempts to establish a new connection but to no avail.
We have reviewed the BF52x Anomalies and have noticed that there are a few related to USB. We have also reviewed the USB driver code and have found comments in the code related to certain USB anomalies. Please see the attached blackfin.h file to see the list of anomalies addressed in the version of the driver we are using. Additionally, we have found that the workaround for anomaly 05000460 is turned on in the file anomaly.h.
Has anyone else ever seen this type of problem? Any ideas for fixes or workarounds?
blackfin.h
QuoteReplyEditDelete
2010-10-12 22:54:11 Re: USB Bulk Transfer Failure from BF525 Mass Storage Device
Bob Liu (CHINA)
Message: 94449
Hi,
Please attach the realease and version of your kernel, you can use the version command.
And could you paste the detail test process? i will try whether this problem can be repeated on my board.
What's more, your kernel config use dma or pio mode for usb transfer?
Thanks
QuoteReplyEditDelete
2010-10-13 16:09:13 Re: USB Bulk Transfer Failure from BF525 Mass Storage Device
Wayne Tinklepaugh (UNITED STATES)
Message: 94491
We are using Linux-2.6.28.10-ADI-2009R1. Attached is the linux.config (.config) file used for our build.
Our test process is as follows: 1) Copy 10-15 large files to the FFS on BF525 board. We are using 22MB .mp4 files because this is the typical file size and type used in our application. You can either use 10-15 different files or get one file and copy it 10 times and give each a unique name. We are not sure if the files have to be greater than a certain size, but large files do seem to make the problem occur more often. 2) Remove or disconnect the BF525 mass storage device from the PC. 3) Re-connect the BF525 mass storage device to the PC. 4) When the Windows Explorer window opens for the mass storage device, use Ctrl-A to select all of the files and then use Ctrl-C to copy the files to the Windows clipboard. 5) Navigate to a destination folder on the PC and do Ctrl-V to paste the files into the destination folder.
Please note that sometimes all of the files copy correctly using the above process. If the files copy correctly, we disconnect the mass storage device from the PC and then repeat steps 3) thru 5) above. I really can't say what type of failure rate you should expect. We have had some boards pass most of the time (fail 1 out of 30 tries) and then put a different set of files on the board and the board would fail most of the time (90% of the time). My advice would be to try a different set of files if you have a hard time seeing the failure initially
We have seen the failure with and without DMA enabled, but most of our testing has been with DMA enabled.
We have used the same Linux release built for an BF527(v0.2) EZ-Kit board, and we were able to replicate the same failure using the EZ-kit board.
linux.config
QuoteReplyEditDelete
2010-10-15 11:28:54 Re: USB Bulk Transfer Failure from BF525 Mass Storage Device
Sean Priddy (UNITED STATES)
Message: 94566
Because the problem can be difficult to reproduce, we are willing to Fed-Ex our reference platform which exhibits the problem and a CD with the Linux distribution and build configuration.
Please send me a contact name and address directly
QuoteReplyEditDelete
2010-10-18 00:09:24 Re: USB Bulk Transfer Failure from BF525 Mass Storage Device
Bob Liu (CHINA)
Message: 94640
Hi,
Yes, I didn't reproduce this problem on my bf527-v0.2.
My test progress is like this:
on board:
root:/> dd if=/dev/zero of=fsg.block bs=1M count=40
root:/> modprobe g_file_storage file=/fsg.block stall=0
on pc:
1. mkfs on the usb storage device(mk2fs /dev/sdc)
2. mount it
3. copy files to it
4. disconnect
5. replug usb
6. copy files from the usb to PC's other dir.
But since my total ram only 64M, the total file size is 40M(about 10-15 files).
And could you change to 2010R1 or svn trunk for testing this problem? If there is no such
problem, we can then try to findout the fix patch and backport.
Our team located at China, send board may need several days at least.
QuoteReplyEditDelete
2010-10-18 02:01:18 Re: USB Bulk Transfer Failure from BF525 Mass Storage Device
Bob Liu (CHINA)
Message: 94641
And your release was downloaded from
"https://blackfin.uclinux.org/gf/project/uclinux-dist/frs/?action=FrsReleaseBrowse&frs_package_id=76&__utma=28888175.1807310620.1277088553.1287375507.1287381773.150&__utmz=28888175.1279511612.91.19.utmcsr%3Dgoogle|utmccn%3D%28organic%29|utmcmd%3Dorganic|utmctr%3Dmixer+dlfcn.h%3A+No+such+file+or+directory&__utmc=28888175&__utmb=28888175.5.10.1287381773&_br_pkgrls_total=100&_br_pkgrls_page=2"?
which version it is ? 2009R1.1-RC4 or 2009R1-RC6 ?
Because my test was againest svn-trunk, so I need to know which detail version you are using and test it again.
QuoteReplyEditDelete
2010-10-18 02:10:13 Re: USB Bulk Transfer Failure from BF525 Mass Storage Device
Sonic Zhang (CHINA)
Message: 94642
How large is the file created for the g_file_storage module to simulator a disk?
where do you create this file? in initramfs, NOR Flash?
What is the totol size of this disk after you format it in host pc?
Do you use the 2009R1-RC6 release tar ball from our download page?
Bob fails to reproduce with 2010R1-RC1 release on bf527-ezkit (v0.2) after copy 9 files (28Mbytes in total).
If you can provide details, Bob can try again with 2009R1-RC6.
QuoteReplyEditDelete
2010-10-18 12:08:31 Re: USB Bulk Transfer Failure from BF525 Mass Storage Device
Steve ten Pas (UNITED STATES)
Message: 94679
Wayne is out of the office today so I will respond. On the bf527-ezkit the file for g_stoarge is 100MB and it was created on the NAND flash. I used mkdosfs to format the partition. The linux version is "2.6.28.10-ADI-2009R1" . The tarball did come from your website a little over a year ago. To reproduce the problem you need to use larger files. The files that we are using are approx 22MB in size, we would have 4 of them on the ezkit. After you copy the files to the device then try to copy all the files at one time over to the pc.
QuoteReplyEditDelete
2010-10-18 15:04:37 Re: USB Bulk Transfer Failure from BF525 Mass Storage Device
Steve ten Pas (UNITED STATES)
Message: 94683
Just to be clear we are using 2009R1-RC6 for the kernel tree.
QuoteReplyEditDelete
2010-10-18 22:40:00 Re: USB Bulk Transfer Failure from BF525 Mass Storage Device
Sonic Zhang (CHINA)
Message: 94684
Why not format the partition on NAND flash by UBIFS?
Could you still read/write files on the NAND partition in a console after the copy halts?
This may be a NAND flash related problem rather than USB.
QuoteReplyEditDelete
2010-10-19 05:54:34 Re: USB Bulk Transfer Failure from BF525 Mass Storage Device
Steve ten Pas (UNITED STATES)
Message: 94729
We used YAFFS2 because that is what your documentation said to use for NAND devices. You can still r/w the partition from the linux command line after the copy fails.
QuoteReplyEditDelete
2010-10-19 06:48:47 Re: USB Bulk Transfer Failure from BF525 Mass Storage Device
Sonic Zhang (CHINA)
Message: 94731
Since 2009R1, YAFFS2 is replaced by UBIFS. So, we suggest you move to UBIFS for better support.
QuoteReplyEditDelete
2010-10-19 07:59:20 Re: USB Bulk Transfer Failure from BF525 Mass Storage Device
Steve ten Pas (UNITED STATES)
Message: 94732
I just checked the .config file for this version of linux and UBIFS was not even an option. I have attached the .config file(renamed linux.config).
linux.config
QuoteReplyEditDelete
2010-10-19 23:11:36 Re: USB Bulk Transfer Failure from BF525 Mass Storage Device
Bob Liu (CHINA)
Message: 94748
Hi,
I have tested it many times with both yaffs2 and ubifs on my board BF527 EZ-KIT 1.4@2007(chip version 0.2).
The usb backfile is 100M on nandflash.
The first time connected to PC, I fromated it using mkdosfs, then I copyed four 22M files to it from PC, then
1. umount it
2. plugout the usb and plugin again
3. After the Windows Explorer window opens for the mass storage device, use Ctrl-A Ctrl-C Ctrl-V to copy these files to PC.
I repeated step1-3 many times, but still can't repeat the problem.
root:/mnt> version
kernel: Linux release 2.6.28.10-ADI-2009R1, build #16 PREEMPT Wed Oct 20 10:03:57 CST 2010
toolchain: bfin-uclinux-gcc release gcc version 4.1.2 (ADI svn)
user-dist: release 2009R1, build #9 Wed Oct 20 10:03:28 CST 2010
===
Ubifs have supported in 2009R1, you can compare with my attached linux.config and follow wiki:
https://docs.blackfin.uclinux.org/doku.php?id=linux-kernel:ubifs&rev=1255077175
It's faster than yaffs2.
Thanks!
linux.config
QuoteReplyEditDelete
2010-10-19 23:15:09 Re: USB Bulk Transfer Failure from BF525 Mass Storage Device
Sonic Zhang (CHINA)
Message: 94749
Can you attach the uImage file used on your bf527-ezkit here for us to have a try?
Bob can also attach his for you as well.
QuoteReplyEditDelete
2010-10-19 23:18:29 Re: USB Bulk Transfer Failure from BF525 Mass Storage Device
Bob Liu (CHINA)
Message: 94750
Attached!
uImage
QuoteReplyEditDelete
2010-10-21 08:46:32 Re: USB Bulk Transfer Failure from BF525 Mass Storage Device
Steve ten Pas (UNITED STATES)
Message: 94812
I am trying to switch over to ubifs as you recommended. I have followed the directions for setting up the ubi by following the directions in the ubi link you included. The system gives me a kernel trap when a try and make a large vfat bin file for the usb gadget. I can make a 100MB file ok but if I try to make a 390MB file I get a trap. I have included a dump from the terminal that shows how I set the ubi up and creating the vfat file. I am using the dd command to create the vfat file.
ubidump.txt
QuoteReplyEditDelete
2010-10-21 13:45:05 Re: USB Bulk Transfer Failure from BF525 Mass Storage Device
Sean Priddy (UNITED STATES)
Message: 94815
I would like to reiterate my offer to send a BF527 reference kit with a CD containing the necessary software to demonstrate this problem.
Please send me a ship to address.
QuoteReplyEditDelete
2010-10-21 23:54:25 Re: USB Bulk Transfer Failure from BF525 Mass Storage Device
Bob Liu (CHINA)
Message: 94830
1. As you said this problem would happen with 100MB backfile and four 22M files with yaffs2.
So what about the results using ubifs or the uImage I attached?
2. It seems the free memory is too small to alloc 390M backfile, you can add physical memory or adapt the write-back ratio before creating the file using:
echo '5' > /proc/sys/vm/dirty_ratio
QuoteReplyEditDelete
2010-10-22 00:42:28 Re: USB Bulk Transfer Failure from BF525 Mass Storage Device
Sonic Zhang (CHINA)
Message: 94831
Have you tried the kernel uImage Bob loaded against bf527-ezkit? Can you replicate this issue on your bf527-ezkit?
Please also upload the uImage which you use on your bf527-ezkit for us to test.
If you insist to ship your hardware and software to us, it is OK.
See following address:
22/F, One Corporate Avenue
222 Hu Bin Road, Shanghai 200021, China
Sonic Zhang
QuoteReplyEditDelete
2010-10-22 05:52:09 Re: USB Bulk Transfer Failure from BF525 Mass Storage Device
Steve ten Pas (UNITED STATES)
Message: 94867
The uImage that Bob sent will not load on our ezkit board. I get a crc error. I was not able to get any new image to work on our ezkit for the same reason. So I have switched over to our board. Can you try to reproduce this issue on your ezkit. Did you review my log file that I sent to see if I was creating the ubi partition correctly.
QuoteReplyEditDelete
2010-10-22 06:42:53 Re: USB Bulk Transfer Failure from BF525 Mass Storage Device
Bob Liu (CHINA)
Message: 94869
Yes, you create the ubifs correctly.
But why you want to create 380M file ? You can try 100M first, because your said before with 100M and four 22M files the problem can reproduced?
For 380M file, the system memory is too small, you can try it three ways:
1.add more system memory
2.mount the filesystem with sync.
3.adapt /proc/sys/vm/dirty* values to make dirty pages less(so more pages can be used agian by dd).
QuoteReplyEditDelete
2010-10-26 10:49:25 Re: USB Bulk Transfer Failure from BF525 Mass Storage Device
Steve ten Pas (UNITED STATES)
Message: 95230
I have got the ubi file system to work on our system. We are still seeing the usb copy problem. I have included my linux config file.
linux.config
QuoteReplyEditDelete
2010-10-28 09:10:32 Re: USB Bulk Transfer Failure from BF525 Mass Storage Device
Steve ten Pas (UNITED STATES)
Message: 95362
Here is a uImage that will run on your bf527 ezkit. It is the same image as we use on our customers board except that it has been recompiled for the bf527 instead of the bf525. You will have to set your ezkit up for either parallel flash or spi boot. This kernel image needs to be started at location 0 in the nand flash. After you flash the device it will reboot about 8 or 9 times while it builds up the vfat partition. When it is done then copy 19 22MB files over to the device(if you give me a ftp site I will upload the files I am using). Then reboot the device an try to copy the files over to your pc. On our customers board I got this to fail about 20% of the time.
uImage
QuoteReplyEditDelete
2010-10-28 09:30:40 Re: USB Bulk Transfer Failure from BF525 Mass Storage Device
Steve ten Pas (UNITED STATES)
Message: 95363
I got the usb copy failure on your bf527 ezkit board using the uImage that I posted earlier. I have included the config file that I used.
bf527ezkit.config
QuoteReplyEditDelete
2010-11-02 07:34:21 Re: USB Bulk Transfer Failure from BF525 Mass Storage Device
Bob Liu (CHINA)
Message: 95481
Hi,
I can reproduce this problem on my board ez-kit-lite-2.0 with your uImage attached last Friday.
I am trying to setup my environment in order to debug this problem.
Thanks.
QuoteReplyEditDelete
2010-11-04 05:48:42 Re: USB Bulk Transfer Failure from BF525 Mass Storage Device
Steve ten Pas (UNITED STATES)
Message: 95551
Bob,
I am glad that you were able to reproduce this issue. Have you been able to determine the cause of the failure?
Thanks for your help.
QuoteReplyEditDelete
2010-11-04 07:30:56 Re: USB Bulk Transfer Failure from BF525 Mass Storage Device
Bob Liu (CHINA)
Message: 95558
Hi,
I am still not clear with the root cause.
But it seems that on 2010R1 branch there is no such problem, if you have time would you please double-checked that?
I am back patching some patches between 2009R1 and 2010R1, but I am still not make the problem disappear.
QuoteReplyEditDelete
2010-11-04 15:25:56 Re: USB Bulk Transfer Failure from BF525 Mass Storage Device
Steve ten Pas (UNITED STATES)
Message: 95571
Bob,
Thanks for the update. Have you tested this exact test condition on the 2010R1 branch?
Thanks,
Steve
QuoteReplyEditDelete
2010-11-04 22:30:41 Re: USB Bulk Transfer Failure from BF525 Mass Storage Device
Bob Liu (CHINA)
Message: 95574
Yes, I tested exact this case with 2010R1 over 15 times testing it didn't fail.
But with 2009R1 it always fails within 10 times.
QuoteReplyEditDelete
2010-11-04 22:38:15 Re: USB Bulk Transfer Failure from BF525 Mass Storage Device
Bob Liu (CHINA)
Message: 95575
If you can double check this then I am sure i am on the right way to solve this problem.
Just compile a 2010R1 uImage and replace the old one on nandflash. And the 490M file has been created by 2009R1, so it's easy to try it .
Remember 2010R1 use uart1 instead of uart0 so you need to change bootargs.
Thanks.
QuoteReplyEditDelete
2010-11-04 23:00:57 Re: USB Bulk Transfer Failure from BF525 Mass Storage Device
Steve ten Pas (UNITED STATES)
Message: 95577
Which version of 2010R1 do you want me to try? Can a uImage be made with the 2010R1? Based on what I had seen with the newer kernels you could not make a uImage, it had to be a vmImage/rootfs combination.
QuoteReplyEditDelete
2010-11-04 23:20:44 Re: USB Bulk Transfer Failure from BF525 Mass Storage Device
Bob Liu (CHINA)
Message: 95578
Would you please try this?
https://blackfin.uclinux.org/gf/download/frsrelease/500/8309/blackfin-linux-dist-2010R1-RC1.tar.bz2
I use uImage(vmImage/rootfs combination) in my test both 2010R1 and 2009R1.
It can be found at uclinux-dist/images/uImage after compile the system.
My config is attached.
If you build faild you may need new toolchain 2010R1. It can be found here
https://blackfin.uclinux.org/gf/project/toolchain/frs/?action=FrsReleaseBrowse&frs_package_id=74&__utma=28888175.1807310620.1277088553.1288855888.1288927445.172&__utmz=28888175.1287539991.155.27.utmcsr%3Dgoogle|utmccn%3D%28organic%29|utmcmd%3Dorganic|utmctr%3D+error%3A+uuid%2Fuuid.h%3A+No+such+file+or+directory&__utmc=28888175&__utmb=28888175.4.10.1288927445&_br_pkgrls_total=100&_br_pkgrls_page=4
After the new kernel booting,
I use
==
ubiattach /dev/ubi_ctrl -m 2
mount -t ubifs ubi0:ubifs0 /mnt
modprobe /lib/modules/2.6.28.10-ADI-2009R1/kernel/drivers/usb/gadget/g_file_storage.ko file=/mnt/vfat.bin stall=0
==
then copy out file to PC.
Thanks
linux.config
QuoteReplyEditDelete
2010-11-05 04:16:03 Re: USB Bulk Transfer Failure from BF525 Mass Storage Device
Bob Liu (CHINA)
Message: 95587
Hi, Steve
Would you please test the attached patch againt 2009R1 before you try 2010R1?
In my test, this patch can fix the problem.
1. cp new.patch to linux-2.6.x/drivers/usb/musb
2. patch -p1 < new.patch
I have tested it about 30 times and it works fine.
Thanks.
new.patch
QuoteReplyEditDelete
2010-11-09 05:49:00 Re: USB Bulk Transfer Failure from BF525 Mass Storage Device
Steve ten Pas (UNITED STATES)
Message: 95700
Bob,
I have implemented the patch. We are in the process of testing it.
Thank,
Steve
QuoteReplyEditDelete
2010-11-15 10:46:15 Re: USB Bulk Transfer Failure from BF525 Mass Storage Device
Steve ten Pas (UNITED STATES)
Message: 95857
Bob,
This patch seems to have fixed the problem.
Thanks,
Steve