Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

USB with LPC2148: When to fire a new data transfer from device to PC (bulk endpoint) ?

2005-10-02 by Martin Maurer

Hello,

i am using a LPC2148 via USB, connected to my PC (under WinXP and libusb-win32, PC has USB 2.0).
I am currently trying to understand how i can send data from LPC2148 to PC and increase my throughput.

I use the KEIL examples as base for my development (but currently instead of using an interrupt i just do polling and call the interrupt routine by myself, but this is a different thing...) and they generate a function call each time a IN Token is received. So it looks like this:

void USB_EndPoint5 (DWORD event)
{
switch (event)
  {
  case USB_EVT_IN:
    {
    NrOfIn++;
    AllowedToWriteToEndpoint5 = TRUE;
    // SendDataToEndpoint();
    break;
    }
  }
}

I see that this routine is called around 975 times per second. I think this could be correct, because 1 ms looks reasonable (or should it be 8 times higher because of USB 2.0 ?). Ok, inside this routine i trigger a write (which is currently commented out) to endpoint, which sends 64 bytes. So with this implementation i should be able to send around 64 KByte/s. I think endpoint 5 is double buffered, so with another implementation i think i can send 2 times 64 kbytes/s, result around 128 kbytes/s (theoretically, not tried out). This is far away from 12 MBit/s (which should give around 1,5 MBytes/s, ok, can't reach the theoretical value).

Is this the right way to trigger a write ? Is there another possibility to determine if i can write new data into the endpoint's tramsit register ? Or are the 1 x 64 or 2 x 64 KByte/s the maximum i can get ? Someone already done this and can give me a hint ?

Regards,

       Martin


[Non-text portions of this message have been removed]

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.