Least effort Full-Speed USB on LPC1788

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Least effort Full-Speed USB on LPC1788

1,635 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TKoe on Wed Jul 11 07:01:06 MST 2012
Hello!

The last few days I've been working with the nxpusblib. Getting the HID and VirtualSerial examples working was not a problem, but both of them didn't really do what I wanted to do: having a data throughput of ~1.5 MB/sec.
It was pretty obvious that it wouldn't work with the HID example and after reading up on USB's Communication Device Class I can get the virtual serial port only to about 128 kB/sec.


The thing is, I have absolutely no idea about Windows driver development and tried to evade that as it would require quite some work to get into. Is there some way to get to Full-Speed without having to develop a device-specific Windows driver myself? (unfortunately, using libusb-win32 or libusbk is not an option :-/)

But even if I can't get around writing a driver: Which would be the best USB device class to choose? Does that even matter when you're writing your own driver?



Also:
The nxpusblib wants to configure the PLLs for me and I don't really like hacking around in libraries. How do I stop it from doing that in a clean way?


Regards,
Tim
Labels (1)
Tags (1)
0 Kudos
Reply
2 Replies

1,229 Views
graygirling
NXP Employee
NXP Employee

> it wouldn't work with the HID example and after reading up on USB's Communication Device Class I can get the virtual serial port only to about 128 kB/sec.

Yes - using HID means that you have to rely on two 'interrupt' endpoints in your interface (the USB configuration your O/S selects is theoretically composed of a number of interfaces, but HID uses only one).  Interrupt endpoints exchange interrupt packets that can be issued only once per frame (i.e. once per ms) or possibly (if you support them) in a small number of microframes (of which there are 8 per frame).  In USB 1.1 (full speed) the maximum size of a transfer is 64 bytes.

If you were to use USB 2 (hi speed, which I expect your hardware is capable of) the maximum transfer size rises significantly to 1KB.  But your bandwidth limitation still derives from you choice of the HID class.

Greater performance (although less predictable latency) can be achieved by using your interface definition (and therefore class), e.g. using 'bulk' endpoints, as David proposes.

> Is there some way to get to Full-Speed without having to develop a device-specific Windows driver myself? (unfortunately, using libusb-win32 or libusbk is not an option :-/)

In principle I think "any" user-mode (i.e. non-kernel-mode) USB library should do.  But actually we've never looked beyond libusb (it's mulit-platform and what we use in LPCXpresso).

Sincerely

LPCXpresso IDE Support

0 Kudos
Reply

1,229 Views
davidfallah
Contributor I

Hey Tim,

I've developed a full-speed USB solution on LPC1788. When I saw this post I thought I might as well create an account since it was a real pain. My device is set up to communicate using endpoint 2 IN & OUT (bulk endpoints) with 64-bit max packet size. For the device descriptors I use vendor-specific device class (0xFF).

I went the route of developing an actual device-specific Windows driver based on WinUSB, which took a while and was annoying. I know you want to avoid that. A colleague of mine recently told me about a .NET project called LibUsbDotNet (http://libusbdotnet.sourceforge.net/V2/Index.html), which allows you to really easily create a high-level library/application for communicating with your device. It works for both Windows and UNIX environments, using WinUSB on Windows and libusb for OS X or Linux environments. I've created and tested an application to control my device on both Windows and Ubuntu environments using this project and it works fine. It also apparently includes an INF generation wizard, which I haven't used myself but hopefully should help you out (see the section "Getting Started With Windows").

As for the USB code on the LPC1788 itself, I mostly just copied and pasted the NXP examples for it that come with IAR Embedded Workbench.

0 Kudos
Reply