• AVR Freaks

USB Host speed

Author
vetto
New Member
  • Total Posts : 4
  • Reward points : 0
  • Joined: 2009/05/15 07:23:56
  • Location: 0
  • Status: offline
2009/05/15 07:42:57 (permalink)
0

USB Host speed

Hi,
I am new of this forum. I am using PIC32MX460F512L to develop an application interfacing a flash 2.0 USB pen.
I have to save very quicky in the attached USB 2.0 flash drive image files wich size is 331776 bytes (324 KBytes).
 
Starting from microchip example I am using MSD libraries and I am able to write the file in 2 seconds.
But I wuold expect to have better performance.
Looking at the USB interrupt and the manual I see that every millisecond PIC32 is able to send up to 12000 bits.
In my example I have bulk transfer. Every transfer with 64 bytes.
The media sector size is 512 bytes.
What I see is that every time a sector is written on the flash key, the driver performs these operations:
1. Write CBW (31 bytes) and wait answer (this tooks 1 millisecond using very low bit times)
2. Read/Write the sector (512 bytes) in blocks of 64 bytes (this is performed in another millisecond)
3. Read CSW (13 bytes) and wait answer (this tooks another millisecond using very low bit times)
So I have 3 milliseconds for reading/writing 512 bytes but I am using very little of the available band.
 
With this implementation I think is not possible going quicker, even if the manual declare 1.22MB/s speed for bulk tranfer.
 
Is there a way to make things better?
What is the max speed I could expect in this case?
How can I increase the performaces?
 
Thanks in advance.
Davide
 
#1

4 Replies Related Threads

    bosco
    Super Member
    • Total Posts : 2119
    • Reward points : 0
    • Joined: 2004/07/24 10:17:53
    • Location: Idaho
    • Status: offline
    RE: USB Host speed 2009/05/15 11:01:22 (permalink)
    -2 (1)

    ORIGINAL: vetto
    1. Write CBW (31 bytes) and wait answer (this tooks 1 millisecond using very low bit times)
    2. Read/Write the sector (512 bytes) in blocks of 64 bytes (this is performed in another millisecond)
    3. Read CSW (13 bytes) and wait answer (this tooks another millisecond using very low bit times)
    So I have 3 milliseconds for reading/writing 512 bytes but I am using very little of the available band.

    The MAX theoretical bulk transfer bandwidth for Full Speed 64 Byte payload is 1.2MB/s
    No one can achieve MAX theoretical bandwidth.

    from what I see, #1 and #3 are the problem. The Full Speed USB frame time is 1ms.
    you need to burst (write more than 512 bytes at a time)
    #2
    xiaofan
    Super Member
    • Total Posts : 6247
    • Reward points : 0
    • Joined: 2005/04/14 07:05:25
    • Location: Singapore
    • Status: offline
    RE: USB Host speed 2009/05/17 23:09:00 (permalink)
    0
    Quote Tsuneo from:
    http://www.microchip.com/forums/tm.aspx?m=417509


    I didn't check it on PIC, but I believe PIC32 will achieve this speed, which other full-speed host devices do for MSC (Mass Storage Class).

    Read: ~800 KBytes/sec
    Write: 300 - 400 KBytes/sec

    The point to speed up MSC transfer is reading / writing in the FAT cluster size.
    Microchip's host MSC implementation reads/ writes in sector (block) size - 512 bytes, to apply the same File System library to PIC18F MSC device. When it is optimized to cluster access for the USB host implementation, the overhead is reduced significantly (in the trade off of RAM requirement ).

    "The Default Cluster Size for the NTFS and FAT File Systems"
    http://support.microsoft.com/kb/314878/

    Tsuneo


      USB_Links and libusb
    #3
    vetto
    New Member
    • Total Posts : 4
    • Reward points : 0
    • Joined: 2009/05/15 07:23:56
    • Location: 0
    • Status: offline
    RE: USB Host speed 2009/05/27 00:46:35 (permalink)
    0
    Another question,
    Is there a limit regarding the size of the key that can be hosted by the PIC32?
    Yesterday I tried with a 1Gb flash key and I had an error "Can not enumerate device"..
     
    All the other tests where done with 2.0 key with 256, 512 MB size..
    It's the key that may have a problem or there is some known limit with the key usable with the PIC32?
     
    vetto
    #4
    xiaofan
    Super Member
    • Total Posts : 6247
    • Reward points : 0
    • Joined: 2005/04/14 07:05:25
    • Location: Singapore
    • Status: offline
    RE: USB Host speed 2009/05/27 02:34:18 (permalink)
    0
    The size may not be that much of a problem but the brand and model number matters. It is said that there are compatibility issues with some USB flash disks. It may be the problem of the stack. But there are many non-conforming USB mass storage device in the market. Actually a lot of codes in the Linux USB Mass Storage driver codes are dealing with the non-conforming device (not conforming to the USB specifications for Mass Storage Device).

      USB_Links and libusb
    #5
    Jump to:
    © 2020 APG vNext Commercial Version 4.5