Hey folks,
This is a little off-topic, but it is for an LPC2000 project. I was trying to think of what would be Most Useful Tool to work on to get famillar with the ARM. It seemed to me that a ‘USB Endpoint’ simplification would be useful, and I could learn a lot by it.
Some kind of config file where a developer simply defines four functions:
USBSendXXX(data, dataSz)
USBRecvXXX(data, dataSz)
HostSendXXX(data, dataSz)
HostRecvXXX(data, dataSz)
So on the host side, to send data, you just call USBSendXXX, and on the PC side the callback HostRecvXX gets called data. On the PC side, developers can just call HostSendXXX and the USB device will callback to USBRecvXXX.
During comile or runtime, tools automaticlly deal with endpoint managment, etc, so developers don’t have to dig into USB stuff. I have yet to work out the details of how to do this (use HUD? something else?).
Does anything like this exist? Is this a good design? Would this be useful to anyone else?
This is a great idea. I am just this morning looking for this exact thing for a project I have. All that I have come up with so far is I see a program called TNKernel out there but it seems a bit complicated and I don’t know if it would actually drive a device (as host). A lot of usb projects seem to lead nowhere because they end up being for the device end and not the host end. Good luck. I will keep an eye on your progress.
Doing a little research I came across the Max3421E which would do the job. It can be host or device. It gives a programming guide but no actual code help or over-all diagrams. Has anyone programmed anything for this chip yet?
regards;
My plan is to do this mostly in software. The LPC2148 has a built-in USB interface/controller. I’m aiming to do thins in software or (if possible) port an existing project over to the embedded platform.
Here is a project that aims at microcontrollers using an USBN960x:
http://www.ixbat.de/index.php?page_id=79
For my own USB stack for the LPC214x (called lpcusb) I am also considering an API like the one you proposed, inspired by how DMA works on the LPC214x. Currently the application gets an interrupt for each packet of USB data (max. 64 bytes) , but it would be useful to abstract this a bit further for an application. For example, a mass storage application should be able to receive 512 bytes and let the USB layer patch the 64-byte packets together and take care of double-buffering for improved throughput. I’m thinking of a uniform API that fits both devices with and without DMA, so the application would not even know if the USB layer is using DMA. Lately I have not been very busy on this though.
I think the TNKernel USB code is a modified version from one of the early releases of lpcusb.