This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
It seems Index number (0) passed via USBDBulkInit() may refer to the (Bulk_Address) used in a Windows Bulk device client connection. Adding an address field to the hUSB Bulk device client handle compiles without error as shown below. The second TM4C launch pad when plugged into the USB Hub Windows PNP manager adds a second Bulk device -- that is not the second endpoint specified as Index 0.
It seems Tivaware project (usblib) has Not been stubbed out for more than one end point in the bulk device. Windows GUID class PNP driver automatically assigns the next Bulk address shown below. We should be able to pass the USB device address to windows. Question is where is the proper place to pass TM4C bulk address in the USB descriptor? Perhaps the Bulk device 2 end points defined in (usblib) should allow for up to 8 end points per device as there seems to be no way to access appended USB device addresses in Windows. It is our view a single USB device class should allow multiple Bulk device connections - up to 8 total per device.
Windows Bulk device initialization:
// Find our USB device and prepare it for communication. hUSB = InitializeDevice(BULK_VID, BULK_PID &(BULK_ADDRESS), (LPGUID)&(GUID_DEVINTERFACE_TIVA_BULK), &bDriverInstalled);
USB device initialization: // Pass our device information to the USB library and place the device on the bus. USBDBulkInit(0, &g_sBulkDevice);
Here's how we think Windows Bulk USB device handle (hUSB) could be compiled with a unique endpoint address. So each hub port can have a Bulk USB device and a total of 8 down stream end point addresses. I recall reading USB 2.0 standard each downstream hub can have 8 end points. So a 4 port hub could end up with 32 end points if 4 more hubs were plugged into first hubs 4 ports, or does it not accumulate end points like that?
// // Vendor and Product IDs for the generic bulk device. // #define BULK_VID 0x1cbe #define BULK_PID 0x0003 #define BULK_ADDRESS 0x0001 //USB End point 1-8
Hi Amit,
Was not attempting an exotic loop connect, just hard code the USB connection address in the Windows client to see if it would work.
Changing the USB interface descriptor Ports entry form 2 to 4 was causing the Code 10, on second device. Why has the interface descriptor been restricted at 2 ports? Two port required mouse/keyboard but a typical 4 port hub. The (USBEPToIndex >> 4) magically loops the End Point index via right shift in the Default end point (USB_EP_1) up to Seven? It works set at 2 ports only.
In that case the interface descriptor 2 ports do not represent an HUB ports? To set the USB in host mode 5 ports, 1 port is dedicated to the Hub's interface and the other 4 are pass through from Tivaware Interface descriptor. So there is 1 port used to connect OTG to a Hub and 2 ports must be for either Internal or External connected Hubs?
//***************************************************************************** // // The remainder of the configuration descriptor is stored in flash since we // don't need to modify anything in it at runtime. // //***************************************************************************** const uint8_t g_pui8BulkInterface[BULKINTERFACE_SIZE] = { // // Vendor-specific Interface Descriptor. // 9, // Size of the interface descriptor. USB_DTYPE_INTERFACE, // Type of this descriptor. 0, // The index for this interface. 0, // The alternate setting for this // interface. 2, // The number of endpoints used by this // interface. USB_CLASS_VEND_SPECIFIC, // The interface class 0, // The interface sub-class. 0, // The interface protocol for the sub-class // specified above. 4, // The string index for this interface. // // Endpoint Descriptor // 7, // The size of the endpoint descriptor. USB_DTYPE_ENDPOINT, // Descriptor type is an endpoint. USB_EP_DESC_IN | USBEPToIndex(DATA_IN_ENDPOINT), USB_EP_ATTR_BULK, // Endpoint is a bulk endpoint. USBShort(DATA_IN_EP_MAX_SIZE), // The maximum packet size. 0, // The polling interval for this endpoint. // // Endpoint Descriptor // 7, // The size of the endpoint descriptor. USB_DTYPE_ENDPOINT, // Descriptor type is an endpoint. USB_EP_DESC_OUT | USBEPToIndex(DATA_OUT_ENDPOINT), USB_EP_ATTR_BULK, // Endpoint is a bulk endpoint. USBShort(DATA_OUT_EP_MAX_SIZE), // The maximum packet size. 0, // The polling interval for this endpoint. };
BTW:
Anyone needing multiple Bulk devices, Amit's index loop suggestion can be far simpler. The USB port address can exist hard coded for each client. Perhaps add a function for (DWORD dwIndex) in a Boolean test for (*bOpenDataEndpoints) matching the USB address shown in first post as a 16bit value (0x0001).
LMFP is not incrementing the dwIndex if multiple ICID are plugged in to the Windows USB host. One or more LP thus have to unplugged order to Flash multiple devices one at a time. Humm LMFP gang banging seems plausible at least up to 7 devices via a USB hub.
Alternatively initiating device handles (BULK_ADDRESS) has to be replaced by incrementing (dwIndex) and testing if the (*bOpenDataEndpoints) flag changes state on matches to (dwIndex)?
Easy method used to invoke specific Windows device endpoints via BULK_ADDRESS:
// // Find our USB device and prepare it for communication. // hUSB = InitializeDeviceByIndex(BULK_VID, BULK_PID, (LPGUID)&(GUID_DEVINTERFACE_TIVA_BULK), BULK_ADDRESS, &bOpenDataEndpoints, &bDriverInstalled);
Hi Amit,
The point you make is the enumerated device index does not directly correlate to the endpoint being sent in the USB interface descriptor. Seemingly If the Tiva USB interface descriptor is working correctly we should be able to connect 4 bulk devices to Windows. Darn now we have to purchase 2 more EK-TM4C1294XL launch pads to test that idea!
Oddly the USB enumerated device Ports and Bulk device endpoint address mirrors the index value. Doesn't that suggest the index follows the endpoint address PNP manager assigns to each new USB end point. Of course that assumes there are no failed PNP devices assigned code 10 existing in the index table of enumerated devices.
The index ended up matching 2 Bulk Static address clients, 0x0001 and 0x0002 that connect to enumerated device port address 0x0001 and 0x0002. So the address field 0x0000.0000/0x0000.0001 enumerated USB devices are not the port address as first believed it was in top post.