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

NRF24LU1P nAN-22-based HID device issue

Dear All,

I'm using NRF24LU1P USB dongle to emulate mouse and keyboard. I've taken nAN-22 firmware as HID example and modified code to behave as 2xHID composite device.

What I did is that I set up two interfaces each with IN interrupt endpoints 81 and 82, and boot protocols 1 and 2 according to HID standard, and added all necessary descriptors.

After I flash my dongle, device enumerates successfully as 2xHID mouse+KB and USBView shows me that all descriptors and endpoints were setup correctly.

But I don't see any periodic data reports sent to PC nor from mouse and keyboard.

I digged down to code and made some debugging. Figured out that USB Endpoint Callbacks, e.g. ep_1_in_cb, are never called.

I expected to send HID report data inside them. Moreover, in USB HAL, the vector ivec in USB_ISR never has e.g. INT_EP1IN and respective callback is never called.

It only has value of INT_SUDAV.

So actually IN endpoint periodic communication is missing.

Am I doing something wrong?

Regards, Eugene                                                                                                                                          


Parents
  • Hi Eugene,

     

    Am I doing something wrong?

    Could be. Could you share your changes, so I can try it out?

     

    Kind regards,

    Håkon

  • Hi Håkon,

    Yes, of course ) Please find attached the modified project. It should compile without any additional files.

    nAN-22_v1.1_eugenePi.zip

    Regards, Eugene

  • This is what I actually see in Wireshark and UsbView:

    
    
        =========================== USB Port1 ===========================
    
    Connection Status        : 0x01 (Device is connected)
    Port Chain               : 1-1-1
    Properties               : 0x01
     IsUserConnectable       : yes
     PortIsDebugCapable      : no
     PortHasMultiCompanions  : no
     PortConnectorIsTypeC    : no
    
          ======================== USB Device ========================
    
            +++++++++++++++++ Device Information ++++++++++++++++++
    Device Description       : USB Input Device
    Device Path              : \\.\usb#vid_1915&pid_007b#6&1dd97943&0&1#{a5dcbf10-6530-11d2-901f-00c04fb951ed}
    Device ID                : USB\VID_1915&PID_007B\6&1DD97943&0&1
    Hardware IDs             : USB\VID_1915&PID_007B&REV_0100 USB\VID_1915&PID_007B
    Driver KeyName           : {745a17a0-74d3-11d0-b6fe-00a0c90f57da}\0005 (GUID_DEVCLASS_HIDCLASS)
    Driver                   : \SystemRoot\System32\drivers\hidusb.sys (Version: 6.3.9600.18340  Date: 2016-05-14)
    Driver Inf               : C:\Windows\inf\input.inf
    Legacy BusType           : PNPBus
    Class                    : HIDClass
    Class GUID               : {745a17a0-74d3-11d0-b6fe-00a0c90f57da} (GUID_DEVCLASS_HIDCLASS)
    Interface GUID           : {a5dcbf10-6530-11d2-901f-00c04fb951ed} (GUID_DEVINTERFACE_USB_DEVICE)
    Service                  : HidUsb
    Enumerator               : USB
    Location Info            : Port_#0001.Hub_#0002
    Location IDs             : PCIROOT(0)#PCI(1400)#USBROOT(0)#USB(1)#USB(1), ACPI(_SB_)#ACPI(PCI0)#ACPI(XHC1)#ACPI(RHUB)#ACPI(HS01)#USB(1), ACPI(_SB_)#ACPI(PCI0)#ACPI(XHC_)#ACPI(RHUB)#ACPI(HS01)#USB(1)
    Container ID             : {347bd12c-8bcc-11e8-830e-ee17d224410d}
    Manufacturer Info        : (Standard system devices)
    Capabilities             : 0x04 (Removable)
    Status                   : 0x01806400 (DN_HAS_PROBLEM, DN_DISABLEABLE, DN_REMOVABLE, DN_NT_ENUMERATOR, DN_NT_DRIVER)
    Problem Code             : 10 (CM_PROB_FAILED_START)
    Power State              : D3 (supported: D0, D2, D3, wake from D0, wake from D2)
    
            ---------------- Connection Information ---------------
    Connection Index         : 0x01 (1)
    Connection Status        : 0x01 (DeviceConnected)
    Current Config Value     : 0x00
    Device Address           : 0x13 (19)
    Is Hub                   : 0x00 (no)
    Number Of Open Pipes     : 0x00 (0)
    Device Bus Speed         : 0x01 (Full-Speed)
    
            --------------- Connection Information V2 -------------
    Connection Index         : 0x01 (1)
    Length                   : 0x10 (16 bytes)
    SupportedUsbProtocols    : 0x03
     Usb110                  : 1 (yes)
     Usb200                  : 1 (yes)
     Usb300                  : 0 (no)
     ReservedMBZ             : 0x00
    Flags                    : 0x00
     DevIsOpAtSsOrHigher     : 0 (Is not operating at SuperSpeed or higher)
     DevIsSsCapOrHigher      : 0 (Is not SuperSpeed capable or higher)
     DevIsOpAtSsPlusOrHigher : 0 (Is not operating at SuperSpeedPlus or higher)
     DevIsSsPlusCapOrHigher  : 0 (Is not SuperSpeedPlus capable or higher)
     ReservedMBZ             : 0x00
    
        ---------------------- Device Descriptor ----------------------
    bLength                  : 0x12 (18 bytes)
    bDescriptorType          : 0x01 (Device Descriptor)
    bcdUSB                   : 0x200 (USB Version 2.00)
    bDeviceClass             : 0x00 (defined by the interface descriptors)
    bDeviceSubClass          : 0x00
    bDeviceProtocol          : 0x00
    bMaxPacketSize0          : 0x20 (32 bytes)
    idVendor                 : 0x1915 (Nordic Semiconductor ASA)
    idProduct                : 0x007B
    bcdDevice                : 0x0100
    iManufacturer            : 0x01 (String Descriptor 1)
    iProduct                 : 0x02 (String Descriptor 2)
    iSerialNumber            : 0x00 (No String Descriptor)
    bNumConfigurations       : 0x01 (1 Configuration)
    
        ------------------ Configuration Descriptor -------------------
    bLength                  : 0x09 (9 bytes)
    bDescriptorType          : 0x02 (Configuration Descriptor)
    wTotalLength             : 0x003B (59 bytes)
    bNumInterfaces           : 0x02 (2 Interfaces)
    bConfigurationValue      : 0x01 (Configuration 1)
    iConfiguration           : 0x00 (No String Descriptor)
    bmAttributes             : 0x80
     D7: Reserved, set 1     : 0x01
     D6: Self Powered        : 0x00 (no)
     D5: Remote Wakeup       : 0x00 (no)
     D4..0: Reserved, set 0  : 0x00
    MaxPower                 : 0x32 (100 mA)
    
            ---------------- Interface Descriptor -----------------
    bLength                  : 0x09 (9 bytes)
    bDescriptorType          : 0x04 (Interface Descriptor)
    bInterfaceNumber         : 0x00
    bAlternateSetting        : 0x00
    bNumEndpoints            : 0x01 (1 Endpoint)
    bInterfaceClass          : 0x03 (HID - Human Interface Device)
    bInterfaceSubClass       : 0x01 (Boot Interface)
    bInterfaceProtocol       : 0x01 (Keyboard)
    iInterface               : 0x00 (No String Descriptor)
    
            ------------------- HID Descriptor --------------------
    bLength                  : 0x09 (9 bytes)
    bDescriptorType          : 0x21 (HID Descriptor)
    bcdHID                   : 0x0110 (HID Version 1.10)
    bCountryCode             : 0x00 (00 = not localized)
    bNumDescriptors          : 0x01
    Descriptor 1:
    bDescriptorType          : 0x22 (Class=Report)
    wDescriptorLength        : 0x003F (63 bytes)
    Error reading descriptor : ERROR_GEN_FAILURE
    
            ----------------- Endpoint Descriptor -----------------
    bLength                  : 0x07 (7 bytes)
    bDescriptorType          : 0x05 (Endpoint Descriptor)
    bEndpointAddress         : 0x81 (Direction=IN EndpointID=1)
    bmAttributes             : 0x03 (TransferType=Interrupt)
    wMaxPacketSize           : 0x0008 (8 bytes)
    bInterval                : 0x0A (10 ms)
    
            ---------------- Interface Descriptor -----------------
    bLength                  : 0x09 (9 bytes)
    bDescriptorType          : 0x04 (Interface Descriptor)
    bInterfaceNumber         : 0x01
    bAlternateSetting        : 0x00
    bNumEndpoints            : 0x01 (1 Endpoint)
    bInterfaceClass          : 0x03 (HID - Human Interface Device)
    bInterfaceSubClass       : 0x01 (Boot Interface)
    bInterfaceProtocol       : 0x02 (Mouse)
    iInterface               : 0x00 (No String Descriptor)
    
            ------------------- HID Descriptor --------------------
    bLength                  : 0x09 (9 bytes)
    bDescriptorType          : 0x21 (HID Descriptor)
    bcdHID                   : 0x0110 (HID Version 1.10)
    bCountryCode             : 0x00 (00 = not localized)
    bNumDescriptors          : 0x01
    Descriptor 1:
    bDescriptorType          : 0x22 (Class=Report)
    wDescriptorLength        : 0x0034 (52 bytes)
    Error reading descriptor : ERROR_GEN_FAILURE
    
            ----------------- Endpoint Descriptor -----------------
    bLength                  : 0x07 (7 bytes)
    bDescriptorType          : 0x05 (Endpoint Descriptor)
    bEndpointAddress         : 0x82 (Direction=IN EndpointID=2)
    bmAttributes             : 0x03 (TransferType=Interrupt)
    wMaxPacketSize           : 0x0003 (3 bytes)
    bInterval                : 0x0A (10 ms)
    
        ----------------- Device Qualifier Descriptor -----------------
    Error                    : ERROR_GEN_FAILURE
    
          -------------------- String Descriptors -------------------
    String descriptors are not available  (because the device has problem code CM_PROB_FAILED_START)
    
  • Hi,

     

    Thanks for the code. There's a couple of things that were missing, for instance the direction of the IN data you're sending (should be hal_usb_send_data(0x80 | EP, ...)).

    The reason why your EP callbacks are not running is due to the printf taking too long. I commented it out and now it runs as it should.

    I also count 4 bytes in your mouse descriptor, while in your application it is set to 3 (buttons + X + Y + wheel = 4 bytes).

     

    Seems to be working fine now:

     

    Here's the edited .zip: nod_edit_nAN-22_v1.1.zip

    Hopefully I haven't changed that much of your project settings.

     

    Kind regards,

    Håkon

Reply
  • Hi,

     

    Thanks for the code. There's a couple of things that were missing, for instance the direction of the IN data you're sending (should be hal_usb_send_data(0x80 | EP, ...)).

    The reason why your EP callbacks are not running is due to the printf taking too long. I commented it out and now it runs as it should.

    I also count 4 bytes in your mouse descriptor, while in your application it is set to 3 (buttons + X + Y + wheel = 4 bytes).

     

    Seems to be working fine now:

     

    Here's the edited .zip: nod_edit_nAN-22_v1.1.zip

    Hopefully I haven't changed that much of your project settings.

     

    Kind regards,

    Håkon

Children
  • Hi Håkon,

    Thanks a lot for helpful modifications, indeed I missed some important things! 

    After trying out modified project, and installing correct drivers, I finally got it working as needed )

    As my goal is to finally make a wireless device, I've noticed the nRFReady Desktop solution that seems to implement the

    RF connection nRF5x<->nRF24 and pairing for such devices as combo keyboard/mouse.

    What about its license, does it allow to use it in mass production for commercial use?

    Does it include demo boards, or is it just a firmware/library pack?

    Best regards,

    Eugene

Related