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.

使用am3359的usb-host读取设备时出现babble错误该怎么办

你好,我使用的devkit8600开发板,仿照starterware02.00.00.07上的usb_host_msc工程修改了代码,现在枚举部分已经正常,可以正常读取设备的描述符。枚举成功后调用下面这个函数依据端点描述符来创建PIPE:

static void *
USBHMSCOpen(tUSBHostDevice *pDevice, unsigned int ulInstance)
{
    int iIdx;
    tEndpointDescriptor *pEndpointDescriptor;
    tInterfaceDescriptor *pInterface;

    tUSBHMSCInstance *sUSBHMSCDevice;

    sUSBHMSCDevice = (tUSBHMSCInstance *)ulInstance;
    
    unsigned int ulIndex = sUSBHMSCDevice->ulIndex;

    //
    // Don't allow the device to be opened without closing first.
    //
    if(sUSBHMSCDevice->pDevice)
    {
        return(0);
    }

    //
    // Save the device pointer.
    //
    sUSBHMSCDevice->pDevice = pDevice;

    //
    // Get the interface descriptor.
    //
    pInterface = USBDescGetInterface(pDevice->pConfigDescriptor, 0, 0);

    //
    // Loop through the endpoints of the device.
    //
    for(iIdx = 0; iIdx < 3; iIdx++)
    {
        //
        // Get the first endpoint descriptor.
        //
        pEndpointDescriptor =
            USBDescGetInterfaceEndpoint(pInterface, iIdx,
                                        pDevice->ulConfigDescriptorSize);

        //
        // If no more endpoints then break out.
        //
        if(pEndpointDescriptor == 0)
        {
            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.
                //
                sUSBHMSCDevice->ulBulkInPipe =
                    USBHCDPipeAllocSize(ulIndex, USBHCD_PIPE_BULK_IN_DMA,
                                        pDevice->ulAddress,
                                        pEndpointDescriptor->wMaxPacketSize,
                                        0);
                //
                // Configure the USB pipe as a Bulk IN endpoint.
                //
                USBHCDPipeConfig(ulIndex, sUSBHMSCDevice->ulBulkInPipe,
                                 pEndpointDescriptor->wMaxPacketSize,
                                 0,
                                 (pEndpointDescriptor->bEndpointAddress &
                                  USB_EP_DESC_NUM_M));
            }
            else
            {
                //
                // Allocate the USB Pipe for this Bulk OUT endpoint.
                //
                sUSBHMSCDevice->ulBulkOutPipe =
                    USBHCDPipeAllocSize(ulIndex, USBHCD_PIPE_BULK_OUT_DMA,
                                        pDevice->ulAddress,
                                        pEndpointDescriptor->wMaxPacketSize,
                                        0);
                //
                // Configure the USB pipe as a Bulk OUT endpoint.
                //
                USBHCDPipeConfig(ulIndex, sUSBHMSCDevice->ulBulkOutPipe,
                                 pEndpointDescriptor->wMaxPacketSize,
                                 0,
                                 (pEndpointDescriptor->bEndpointAddress &
                                  USB_EP_DESC_NUM_M));
            }
        }
    }

    //
    // If the callback exists, call it with an Open event.
    //
    if(sUSBHMSCDevice->pfnCallback != 0)
    {
       sUSBHMSCDevice->pfnCallback((unsigned int)sUSBHMSCDevice,
                                    MSC_EVENT_OPEN, 0);
    }

    //
    // Return the only instance of this device.
    //
    return(sUSBHMSCDevice);
}

之后再调用接口 USBHCDPipeRead(unsigned int ulIndex, unsigned int ulPipe,unsigned char *pucData, unsigned int ulSize)来读取设备数据时,总是在:

            else if(g_sUSBHCD[ulIndex].ulUSBHIntEvents & INT_EVENT_BABBLE_FAULT)
            {
                //
                // Update the Pipe status
                //
                g_sUSBHCD[ulIndex].USBINPipes[ulPipeIdx].eState = PIPE_ERROR;        
                printf("INT_EVENT_BABBLE_FAULT\n");

                continue;
            }

这里打印BABBLE这个错误,并且一直循环,不能成功的使用bulk-in来读取usb设备上的数据,请问我在哪里的使用有问题吗? 谢谢。