The implementation of USB audio MIDI class is easy.
It's good for exercise of class implementation.
Then, try it.
0) Start with an existing USB example, such as HID, CDC (virtual COM port).
Confirm that this example works on your board - if not, fix it.
1) Descriptor work
Replace the descriptors following the example on the USB MIDI spec.
http://www.usb.org/developers/devclass_docs/midi10.pdf
Appendix B. Example: Simple MIDI Adapter (p37)
This PIC descriptor is coded with above example.
http://www.microchip.com/forums/tm.aspx?m=371796&mpage=2#376451
Modifying a little for LPC, it is directly available for you.
Device descriptor
- Vendor ID / Product ID
Apply a temporary pair, such as 0xFFFF/0x0000, for development
Before releasing your device, get an official one.
Configuration set
Move IN and OUT endpoint address (bEndpointAddress) to EP2 for bulk.
With this change, your device is recognized as a MIDI device immediately, when
it is connected to a PC. But to make it work, you have to add a little more code
to it.
2) Endpoint work
In and OUT endpoints exchange USB-MIDI event packets, defined on this chapter of
the spec.
http://www.usb.org/developers/devclass_docs/midi10.pdf
4 USB-MIDI Event Packets (p16)
As this chapter describes, USB add a prefix byte before usual 3-byte MIDI
packet.
Put this 4-byte packet(s) to the IN endpoint 2, when the device sees key make/
release.
3) Clean up your code
That's all.
Tsuneo
--- In lpc2000@yahoogroups.com, "radim100" <radim100@...> wrote:
>
> I was just wondering if anybody has some LPC214X or LPC2100 based
> MIDI USB Class code available to share .
> Thanks. Radim
>