This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

USB out endpoint maximum size of one packet

Hi,Nordic I have one nRF24LU1P device, when I make it as USB Dongle, I will use :

hal_usb_endpoint_config(uint8_t ep_num, uint8_t ep_size, hal_usb_cb_endpoint_t endpoint_isr)
{
}

from this function comment:

/** Function to register callbacks for given endpoints

  • To register a callback one have to have a function with an argument list equal to usb_endpoint_cb_t.
  • @param ep_num Endpoint number. If MSB is set it indicates this is an IN endpoint.
  • @param ep_size The maximum size of one packet for this endpoint
  • @param endpoint_isr Pointer to function that is called when host issues a request on the given endpoint. Set to 0 to unregister function. */

but for param ep_size, it only :

// Dummy use of variable to get rid of warning

ep_size = 0;

why only set size to 0?  If this, I can not change size, right?  If I want to use custom usb in/out endpoint size, how could I do?

Thanks

Parents
  • Hi,

    This function does not use the variable "ep_size", therefore it's set to '0' to suppress warnings. The data transfer size of an endpoint is set in your USB descriptor (normally located in usb_desc.c or similar named file). In your descriptor, you would normally have a REPORT_SIZE and REPORT_COUNT with a given parameter, like this example (32*8 = 256 bit = 32 byte):

    0x75, 0x08,                    //     REPORT_SIZE (8)
    0x95, 0x20,                    //     REPORT_COUNT (32)
    

    Cheers, Håkon

Reply
  • Hi,

    This function does not use the variable "ep_size", therefore it's set to '0' to suppress warnings. The data transfer size of an endpoint is set in your USB descriptor (normally located in usb_desc.c or similar named file). In your descriptor, you would normally have a REPORT_SIZE and REPORT_COUNT with a given parameter, like this example (32*8 = 256 bit = 32 byte):

    0x75, 0x08,                    //     REPORT_SIZE (8)
    0x95, 0x20,                    //     REPORT_COUNT (32)
    

    Cheers, Håkon

Children
Related