OK, then it's a course material for USB education, with limited process speed.
[ Hardware ]
A USB PIC is used for the target USB engine of emulation.
A second device provides connection between this USB PIC and the emulator PC.
a) back-to-back USB PICs
Another USB PIC provides the second device.
The firmware of the second chip is based on CDC or HID example from Microchip
b) USB PIC + USB-UART chip
For this option, the second device is an existing USB-UART chip like FT232R http://www.ftdichip.com/Products/FT232R.htm
c) Low Pin Count USB Development Kit w/ PICkit 2 - PICkit 2 Programmer UART Tool http://www.microchipdirect.com/productsearch.aspx?Keywords=DV164126
"Low Pin Count USB Development Kit" is used for the target USB PIC.
"PICkit 2 Programmer UART Tool" makes the PICkit 2 a USB-UART converter http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en023805
I recommend you b) option for easiness of the development
[ Firmware of USB PIC and Host application on the emulator PC ]
Just for USB HID keyboard emulation, the keyboard example in Microchip USB framework, MCHPFSUSB v2.3.1, is available for the base code. http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=2680&dDocName=en537044
USB Device - HID - Keyboard
Modify this example, so that a input report sent by the emulator PC is put to the interrupt IN endpoint.
When the PIC has a bootloader over serial, you can swap the emulated device on the PIC. As the Microchip USB framework has several examples, like CDC, HID keyboard and mouse, MSC and vendor specific, you can make up another emulated devices in this way. Then, you'll provide a couple of pairs of device firmware and PC emulator app.
In this scheme, the enumeration is done by the USB PIC, without intervention of the emulator PC. The emulator PC supplies just the handling of bulk/interrupt endpoints. If you want to be more general, enumeration over the default endpoint is also brought to the PC side. And then, without firmware download, the PC can emulate most of USB class. But this second scheme means hard firmware development, not just brief modification of Microchip examples.
post edited by chinzei - 2009/03/06 01:12:43