I had written a USB Host example for my sensor device sometime back. Recently I stripped out the device mode bulk class example and host mode shell browser example, and created a setup to perform simple data transfer across two KITs with one actiing as Device and other as Host. I thought of sharing the same here.
The codes are attached herewith and have been tested across two BF527 0.2 Si Kits with VDSP.5.0.9. Application data transfer happens through BULK IN and OUT endpoints.You need to run the device first and then host.
The device code uses ADI Bulk Class, and has two BULK endpoints for data in and data out. The descriptors are programmed through VSBulkConfigure() function in the adi_usb_bulkadi.c, when the application calls the command: ADI_USB_CMD_CLASS_CONFIGURE. Device has to wait for a command block from host to call the right API for write or read.
Host reuses the Endpoint IDs to communicate with device:
g_ReadEpID = 0x5;
g_WriteEpID = 0x6;
While development, host application make peek in to device descriptors after enumeration, by turning on macros USB_OTG_PRINT_DESCRIPTOR and USB_DEBUG for USB driver libraries and rebuilding the same. If you are sure about the object IDs and endpoints (see the function ParseConfigurationMemory() in adi_usb_otg.c), you could just do something like below:
Common functions like WriteMemory() and ReadMemory() are used for data transfer. Host uses SendCommand(), while device uses ReadCommand().
Please refer to the below references for further details and more accurate info of API usage.
Host example: ...\Blackfin\Examples\ADSP-BF527 EZ-KIT Lite\Services\File System\VDK\shell_browser
Device example: ...\Blackfin\Examples\ADSP-BF527 EZ-KIT Lite\Drivers\usb\bulk_loopback_app
Driver Docs: ...\Blackfin\docs\drivers\usb
USB Descriptors: http://www.beyondlogic.org/usbnutshell/usb5.shtml
Here are some screenshots: