How to define the polling interval and max packet size

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How to define the polling interval and max packet size

419件の閲覧回数
uzslm
Contributor II

 SDK for LPC5516 and the example of "dev_hid_generic_lite_bm" :

I believe the polling interval and max packet size were defined  in usb_device_descriptor.c:

uint8_t g_UsbDeviceConfigurationDescriptor[] = {
 
..........................................................................................................................
..........................................................................................................................
 
    /* The address of the endpoint on the USB device
       described by this descriptor. */
    USB_ENDPOINT_INTERRUPT, /* This field describes the endpoint's attributes */
    USB_SHORT_GET_LOW(FS_HID_GENERIC_INTERRUPT_IN_PACKET_SIZE),
    USB_SHORT_GET_HIGH(FS_HID_GENERIC_INTERRUPT_IN_PACKET_SIZE),
    /* Maximum packet size this endpoint is capable of
       sending or receiving when this configuration is
       selected. */
    FS_HID_GENERIC_INTERRUPT_IN_INTERVAL, /* Interval for polling endpoint for data transfers. */

    USB_DESCRIPTOR_LENGTH_ENDPOINT, /* Size of this descriptor in bytes */
    USB_DESCRIPTOR_TYPE_ENDPOINT,   /* ENDPOINT Descriptor Type */
    USB_HID_GENERIC_ENDPOINT_OUT | (USB_OUT << USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_SHIFT),
    /* The address of the endpoint on the USB device
       described by this descriptor. */
    USB_ENDPOINT_INTERRUPT, /* This field describes the endpoint's attributes */
    USB_SHORT_GET_LOW(FS_HID_GENERIC_INTERRUPT_OUT_PACKET_SIZE),
    USB_SHORT_GET_HIGH(FS_HID_GENERIC_INTERRUPT_OUT_PACKET_SIZE),
    /* Maximum packet size this endpoint is capable of
       sending or receiving when this configuration is
       selected. */
    FS_HID_GENERIC_INTERRUPT_OUT_INTERVAL, /* Interval for polling endpoint for data transfers. */
};
 
but in hid_generic.c:
 
        case kUSB_DeviceEventSetConfiguration:
           
..........................................................................................................................
..........................................................................................................................
 
                if (USB_SPEED_HIGH == g_UsbDeviceHidGeneric.speed)
                {
                    epInitStruct.maxPacketSize = HS_HID_GENERIC_INTERRUPT_IN_PACKET_SIZE;
                    epInitStruct.interval      = HS_HID_GENERIC_INTERRUPT_IN_INTERVAL;
                }
                else
                {
                    epInitStruct.maxPacketSize = FS_HID_GENERIC_INTERRUPT_IN_PACKET_SIZE;
                    epInitStruct.interval      = FS_HID_GENERIC_INTERRUPT_IN_INTERVAL;
                }

                USB_DeviceInitEndpoint(handle, &epInitStruct, &epCallback);

                epCallback.callbackFn    = USB_DeviceHidGenericInterruptOut;
                epCallback.callbackParam = handle;

                epInitStruct.zlt          = 0U;
                epInitStruct.transferType = USB_ENDPOINT_INTERRUPT;
                epInitStruct.endpointAddress =
                    USB_HID_GENERIC_ENDPOINT_OUT | (USB_OUT << USB_DESCRIPTOR_ENDPOINT_ADDRESS_DIRECTION_SHIFT);
                if (USB_SPEED_HIGH == g_UsbDeviceHidGeneric.speed)
                {
                    epInitStruct.maxPacketSize = HS_HID_GENERIC_INTERRUPT_OUT_PACKET_SIZE;
                    epInitStruct.interval      = HS_HID_GENERIC_INTERRUPT_OUT_INTERVAL;
                }
                else
                {
                    epInitStruct.maxPacketSize = FS_HID_GENERIC_INTERRUPT_OUT_PACKET_SIZE;
                    epInitStruct.interval      = FS_HID_GENERIC_INTERRUPT_OUT_INTERVAL;
                }
 
..........................................................................................................................
..........................................................................................................................
 
 
I have been confused by two code blocks above;
As my previous project from other MCU, they have been defined and fixed in related descriptors entity;
Please kindly advise,mainly i want to define a high speed interrupt in and out endpoint with the best polling interval as 125us.
 
Thank you very much!
Kind Regards,
uzslm
 
0 件の賞賛
返信
1 返信

371件の閲覧回数
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @uzslm

Please tell us Is there any issue after your configuration with g_UsbDeviceConfigurationDescriptor []? 

Thank you.

 

BR

Alice

0 件の賞賛
返信