The attached code sets up two ADSP-BF527 EZ-KITs with one acting as a USB Device and the other as a USB Host. This has been tested on revision 0.2 silicon with VisualDSP++ 5.0 Update 9. Application data transfer happens through BULK IN and OUT endpoints.You need to run the device first and then the host.
The device code uses ADI Bulk Class and has two BULK endpoints for data in and data out. The descriptors are programmed through the VSBulkConfigure() function in the adi_usb_bulkadi.c file when the application calls the command: ADI_USB_CMD_CLASS_CONFIGURE. The Device has to wait for a command block from the host to call the right API for write or read.
The Device has the opened endpoints information, but the host doesn't. The following may be employed to retrieve this data at the Host end:
1. The Host reuses the known/published Endpoint IDs to communicate with the Device:
g_ReadEpID = 0x5;
g_WriteEpID = 0x6;
2. It is however possible to retrieve the complete descriptor info, including which endpoints are configured at the Device. During enumeration, the event adi_usb_otg_SetConfiguration(1) is called to set the configuration number to be used by the Device. This function uses adi_usb_GetObjectFromID to get the configuration object which the Host is going to activate for the Device. The Host stores this configuration object as its active configuration Object. This configuration object can be used to find out which BULK Endpoints are currently used by the Device.
pDevO = (PDEVICE_OBJECT)pArg;
pCfgO = pDevO->pConfigObj;
pEpO = pCfgO->pActiveEpObj;
pActiveEpO = pEpO;
while(pActiveEpO != NULL)
/* BULK endpoints ONLY */
if(pActiveEpO->pEndpointDesc->bAttributes == USB_BULK_MODE)
if((pActiveEpO->pEndpointDesc->bEndpointAddress & 0x80))
g_ReadEpID = pActiveEpO->ID;
g_WriteEpID = pActiveEpO->ID;
pActiveEpO = pActiveEpO->pNextActiveEpObj;
g_bUsbenumerated = TRUE;
3.. Turn on the USB_OTG_PRINT_DESCRIPTOR and USB_DEBUG macros for USB driver libraries and rebuild them. This prints out the complete descriptor info to the console.
4. If the object IDs and endpoints (see the function ParseConfigurationMemory() in the adi_usb_otg.c file) are already known, you could do something similar to what the above macros do. If the info is not known, use method #2 to retrieve it and pass it to adi_usb_PrintDeviceDescriptor();
Common functions like WriteMemory() and ReadMemory() are used for data transfer. The Host uses SendCommand() while the 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:
This FAQ was generated from the following discussion: How to transfer data across two EZ-KITs through USB?