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

HID_Generic slow data rate

Hi all,

I am using the Adafruit Feather nRF52840 as my central device. My peripheral is a nRF52832 with a 9DoF IMU. (SDK17.02)

I need to stream 26 Bytes of IMU data at 100 Hz from the peripheral to the central and then pass this to a PC via the USB HID. I will ultimately increase the number of peripheral devices and also increase the data length to 100 bytes.

My peripheral is working great with a custom service with 6 characteristics. It is setup to use 2MBPS PHY. However, when testing with my Win10 pc is connects over 1MBPS PHY (understandable). The data is also timestamped.

For my central, I have merged the usbd_hid_generic example with the ble_app_multilink_central example. I have also tailored the multilink_central to support my custom service and characteristics. 

The central connects to my peripheral and is able to receive the data successfully. I am also able to send this to my PC via the USB HID. 

The speed issue:

My C# HID app is receiving data, however, I only receive around 60 packets per second (not consistent either). This is all accurately timestamped on the peripheral. I have confirmed that i am sending 26 bytes at 100 Hz from the peripheral and receiving it at the central, so the bottleneck is in the HID part.

below is my Report descriptor. I am using an OUT endpoint and IN endpoint with a HID_REP_SIZE  64.

Can anyone suggest a reason why i am unable to receive the data at 100 Hz on the Windows end?

thanks

 

#define USBD_GENERIC_REPORT_DESCRIPTOR(HID_INPUT_REPORT_BYTES) { \
0x06, 0x00, 0xFF,       /* Usage Page = 0xFF00 (Vendor Defined Page 1) */\
0x09, 0x01,             /* Usage (Vendor Usage 1) */\
0xA1, 0x01,             /* Collection (Application) */\
/* Input report */\
0x19, 0x01,             /* Usage Minimum */\
0x29, 0x40,             /* Usage Maximum */\
0x15, 0x00,             /* Logical Minimum (data bytes in the report may have minimum value = 0x00) */\
0x26, 0xFF, 0x00,       /* Logical Maximum (data bytes in the report may have maximum value = 0x00FF = unsigned 255) */\
0x75, 0x08,             /* Report Size: 8-bit field size */\
0x95, HID_INPUT_REPORT_BYTES,/* Report Count */\
0x81, 0x02,             /* Input (Data, Array, Abs) */\
/* Output report */\
0x19, 0x01,             /* Usage Minimum */\
0x29, 0x40,             /* Usage Maximum */\
0x75, 0x08,             /* Report Size: 8-bit field size */\
0x95, HID_INPUT_REPORT_BYTES,/* Report Count */\
0x91, 0x02,             /* Output (Data, Array, Abs) */\
0xC0, /* End Collection */\
}

 

Parents
  • After some more testing, it does appear that i am not able to achieve the 100 Hz data rate through the USB HID with my Win10 app. Does anyone know why this would be happening? Could it be the usbd driver? or the default polling interval? 

    Would greatly appreciate some feedback.

  • some additional info that might help

    Information for device Motion HID (VID=0x1920 PID=0x525C):
    
    ------------------------------
    Connection Information:
    ------------------------------
    Device current bus speed: FullSpeed
    Device supports USB 1.1 specification
    Device supports USB 2.0 specification
    Device address: 0x0027
    Current configuration value: 0x01
    Number of open pipes: 2
    
    
    ------------------------------
    Device Descriptor:
    ------------------------------
    0x12	bLength
    0x01	bDescriptorType
    0x0200	bcdUSB
    0x00	bDeviceClass      
    0x00	bDeviceSubClass   
    0x00	bDeviceProtocol   
    0x40	bMaxPacketSize0   (64 bytes)
    0x1920	idVendor
    0x525C	idProduct
    0x0100	bcdDevice
    0x01	iManufacturer   "temp"
    0x02	iProduct        "Motion HID"
    0x03	iSerialNumber   "000000000000"
    0x01	bNumConfigurations
    
    
    -------------------------
    Configuration Descriptor:
    -------------------------
    0x09	bLength
    0x02	bDescriptorType
    0x0029	wTotalLength   (41 bytes)
    0x01	bNumInterfaces
    0x01	bConfigurationValue
    0x04	iConfiguration   "Default configuration"
    0xE0	bmAttributes   (Self-powered Device, Remote-Wakeup)
    0x32	bMaxPower      (100 mA)
    
    Interface Descriptor:
    ------------------------------
    0x09	bLength
    0x04	bDescriptorType
    0x00	bInterfaceNumber
    0x00	bAlternateSetting
    0x02	bNumEndPoints
    0x03	bInterfaceClass      (Human Interface Device Class)
    0x01	bInterfaceSubClass   
    0x00	bInterfaceProtocol   
    0x00	iInterface
    
    HID Descriptor:
    ------------------------------
    0x09	bLength
    0x21	bDescriptorType
    0x0111	bcdHID
    0x00	bCountryCode
    0x01	bNumDescriptors
    0x22	bDescriptorType   (Report descriptor)
    0x0021	bDescriptorLength
    
    Endpoint Descriptor:
    ------------------------------
    0x07	bLength
    0x05	bDescriptorType
    0x81	bEndpointAddress  (IN endpoint 1)
    0x03	bmAttributes      (Transfer: Interrupt / Synch: None / Usage: Data)
    0x0040	wMaxPacketSize    (1 x 64 bytes)
    0x01	bInterval         (1 frames)
    
    Endpoint Descriptor:
    ------------------------------
    0x07	bLength
    0x05	bDescriptorType
    0x01	bEndpointAddress  (OUT endpoint 1)
    0x03	bmAttributes      (Transfer: Interrupt / Synch: None / Usage: Data)
    0x0040	wMaxPacketSize    (1 x 64 bytes)
    0x01	bInterval         (1 frames)
    
    Microsoft OS Descriptor is not available. Error code: 0x0000001F
    
    
    --------------------------------
    String Descriptor Table
    --------------------------------
    Index  LANGID  String
    0x00   0x0000  0x0409 
    0x01   0x0409  "temp"
    0x02   0x0409  "Motion HID"
    0x03   0x0409  "000000000000"
    0x04   0x0409  "Default configuration"
    
    ------------------------------
    
    Connection path for device: 
    USB xHCI Compliant Host Controller
    Root Hub
    Motion HID (VID=0x1920 PID=0x525C) Port: 1
    
    Running on: Windows 10 or greater (Build Version 19041)
    
    Brought to you by TDD v2.17.0, Feb 23 2021, 14:04:02
    

  • Hi,

     

    The bInterval seems to be set to 1 ms, so that should not be the issue.

    A shot in the dark, as there's not much info to go on why the firmware runs slow; could it be that NRF_LOG_ENABLED is set to '1' ? Try disabling this and re-flash the device to see if this has any impact.

     

    If it still runs slow, try to set/clear a gpio when you enter and exit sleep; then if it is continuously processing, you have to check the firmware on where its slowing down.

     

    Kind regards,

    Håkon

  • Hi Håkon,

    Apologies for the late reply. I have confirmed that it was on my C# side. have now fixed this.
    As always, thanks for the great support.

Reply Children
Related