Good afternoon,
I have been trying to get the FT4232H chip to work in my sys/bios project.
I started by integrating the usb library from starterware and getting the mouse demo working and then moved onto the FT232R and I have both of these working well.
Up until today I was making good progress getting the FT4232H going but have now come up against a wall. The device connects fine and I am able to setup all of the baud rates etc for the 4 ports however I cannot write to the pipes for the extra three ports. The device reports 4 interfaces and 2 endpoints on each and this is how I have modified the code that allocates the endpoint to accomodate this.
for(InterfaceNo = 0; (InterfaceNo < pDevice->pConfigDescriptor->bNumInterfaces) && (InterfaceNo < MAX_INTERFACES); InterfaceNo++) { // // Get the interface descriptor. // pInterface = USBDescGetInterface(pDevice->pConfigDescriptor, InterfaceNo, 0); // // Loop through the endpoints of the device. // for(iIdx = 0; iIdx < pInterface->bNumEndpoints; iIdx++) { // // Get the first endpoint descriptor. // pEndpointDescriptor = USBDescGetInterfaceEndpoint(pInterface, iIdx, pDevice->ulConfigDescriptorSize); // // If no more endpoints then break out. // if(pEndpointDescriptor == 0) { // // should actually never happen // break; } // // See if this is a bulk endpoint. // if((pEndpointDescriptor->bmAttributes & USB_EP_ATTR_TYPE_M) == USB_EP_ATTR_BULK) { // // See if this is bulk IN or bulk OUT. // if(pEndpointDescriptor->bEndpointAddress & USB_EP_DESC_IN) { // // Allocate the USB Pipe for this Bulk IN endpoint. // g_USBHFTDIDevice.ulBulkInPipe[InterfaceNo] = USBHCDPipeAllocSize(ulIndex, USBHCD_PIPE_BULK_IN, //USBHCD_PIPE_BULK_IN_DMA, pDevice->ulAddress, pEndpointDescriptor->wMaxPacketSize, USBHCDInPipeCallback); // // Configure the USB pipe as a Bulk IN endpoint. // USBHCDPipeConfig(ulIndex, g_USBHFTDIDevice.ulBulkInPipe[InterfaceNo], pEndpointDescriptor->wMaxPacketSize, PIPE_BULK_IN_POLLING_INTERVAL, // polling interval in frames (typically milli seconds) (pEndpointDescriptor->bEndpointAddress & USB_EP_DESC_NUM_M)); } else { // // Allocate the USB Pipe for this Bulk OUT endpoint. // g_USBHFTDIDevice.ulBulkOutPipe[InterfaceNo] = USBHCDPipeAllocSize(ulIndex, USBHCD_PIPE_BULK_OUT, // USBHCD_PIPE_BULK_OUT_DMA, pDevice->ulAddress, pEndpointDescriptor->wMaxPacketSize, 0); // // Configure the USB pipe as a Bulk OUT endpoint. // USBHCDPipeConfig(ulIndex, g_USBHFTDIDevice.ulBulkOutPipe[InterfaceNo], pEndpointDescriptor->wMaxPacketSize, pEndpointDescriptor->bInterval, (pEndpointDescriptor->bEndpointAddress & USB_EP_DESC_NUM_M)); } } } }
This part now works and does not report any errors however when ever I try to write to a port other than the first one I get an error at the following point (around line 1112) in usbhostenum.c
else if(ulEPStatus & USB_HOST_OUT_ERROR) { g_sUSBHCD[ulIndex].USBOUTPipes[ulPipeIdx].eState = PIPE_ERROR; continue; }
To get to this point I had to change USBIndexWrite() and USBIndexRead() in usb.c which asserted on any endpoint other than 0-3. But I cannot see why adding the remaining endpoints would cause a problem.
However if I setup the second interface first then this works and the first doesn't. Does anybody have any experience with anything similar?
It seems to me that there is a weakness in the Starterware USB library when you try to use more than one set of IN and OUT endpoints, any ideas of what I could try or where I should be looking for the issue?
Many thanks
Sean