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

Buttonless DFU without BLE

My application is on the nRF52840 Dongle using ESB protocol, receiving data from an number of PTXs, . The device appears as an HID.

I would like to add Buttonless DFU, without adding BLE.

Can you outline the steps required to get nRF_Connect to recognize my device as capable of Buttonless DFU, and then actually triggering it?

Parents Reply Children
  • NRF_DFU_TRIGGER_USB_INTERFACE_NUM is set to 1, since there is only one other interface (the HID).

    BOARDS_WITH_USB_DFU_TRIGGER is not defined. Where should it be -- in sdk_config.h or Preprocessor Definitions?

  • Add it as a preprocessor define. Then bsp_board_init() will run nrf_dfu_trigger_usb_init().

    Snippet:

    void bsp_board_init(uint32_t init_flags)
    {
        #if defined(BOARDS_WITH_USB_DFU_TRIGGER) && defined(BOARD_PCA10059)
        (void) nrf_dfu_trigger_usb_init();
        #endif
        
    .
    .
    .

  • I've done that.

    My code is based on the example usbd_hid_generic_pca10056 -- with suitable changes for the pca10059 Dongle.

    The problem is that bsp_board_init() is called before app_usbd_init(), resulting in a run-time error.

    In particular nrf_dfu_trigger_usb_init() fails when calling app_usbd_class_append(), since nrf_drv_usbd_is_initialized() returns false.

  • Ok, you can try to use the same approach as in the connectivity/ble_connectivity/ser_s140_usb_hci example, where nrf_dfu_trigger_usb_init() is called in usbd_enable().

  • Sorry for the delay -- other projects.

    Without the DFU Trigger, USBlyzer tells me this:

    Connection Status Device connected 
    Current Configuration 1 
    Speed Full (12 Mbit/s) 
    Device Address 9 
    Number Of Open Pipes 2 
    
    Device Descriptor HT4 Receiver
    Offset Field Size Value Description 
    0 bLength 1 12h  
    1 bDescriptorType 1 01h Device 
    2 bcdUSB 2 0200h USB Spec 2.0 
    4 bDeviceClass 1 00h Class info in Ifc Descriptors 
    5 bDeviceSubClass 1 00h  
    6 bDeviceProtocol 1 00h  
    7 bMaxPacketSize0 1 40h 64 bytes 
    8 idVendor 2 1915h Linksys 
    10 idProduct 2 521Bh  
    12 bcdDevice 2 0401h 4.01 
    14 iManufacturer 1 01h "Vald Performance Pty Ltd" 
    15 iProduct 1 02h "HT4 Receiver" 
    16 iSerialNumber 1 03h "D2E6D7700216" 
    17 bNumConfigurations 1 01h  
    
    Configuration Descriptor 1 Bus Powered, 100 mA
    Offset Field Size Value Description 
    0 bLength 1 09h  
    1 bDescriptorType 1 02h Configuration 
    2 wTotalLength 2 0029h  
    4 bNumInterfaces 1 01h  
    5 bConfigurationValue 1 01h  
    6 iConfiguration 1 04h "Default configuration" 
    7 bmAttributes 1 A0h Bus Powered, Remote Wakeup 
     4..0: Reserved  ...00000   
     5: Remote Wakeup  ..1.....  Yes 
     6: Self Powered  .0......  No, Bus Powered 
     7: Reserved (set to one)
    (bus-powered for 1.0)  1.......   
    8 bMaxPower 1 32h 100 mA 
    
    Interface Descriptor 0/0 HID, 2 Endpoints
    Offset Field Size Value Description 
    0 bLength 1 09h  
    1 bDescriptorType 1 04h Interface 
    2 bInterfaceNumber 1 00h  
    3 bAlternateSetting 1 00h  
    4 bNumEndpoints 1 02h  
    5 bInterfaceClass 1 03h HID 
    6 bInterfaceSubClass 1 00h  
    7 bInterfaceProtocol 1 00h  
    8 iInterface 1 00h  
    
    HID Descriptor 
    Offset Field Size Value Description 
    0 bLength 1 09h  
    1 bDescriptorType 1 21h HID 
    2 bcdHID 2 0111h 1.11 
    4 bCountryCode 1 00h  
    5 bNumDescriptors 1 01h  
    6 bDescriptorType 1 22h Report 
    7 wDescriptorLength 2 0021h 33 bytes 
    
    Endpoint Descriptor 81 1 In, Interrupt, 1 ms
    Offset Field Size Value Description 
    0 bLength 1 07h  
    1 bDescriptorType 1 05h Endpoint 
    2 bEndpointAddress 1 81h 1 In 
    3 bmAttributes 1 03h Interrupt 
     1..0: Transfer Type  ......11  Interrupt 
     7..2: Reserved  000000..   
    4 wMaxPacketSize 2 0040h 64 bytes 
    6 bInterval 1 01h 1 ms 
    
    Endpoint Descriptor 01 1 Out, Interrupt, 1 ms
    Offset Field Size Value Description 
    0 bLength 1 07h  
    1 bDescriptorType 1 05h Endpoint 
    2 bEndpointAddress 1 01h 1 Out 
    3 bmAttributes 1 03h Interrupt 
     1..0: Transfer Type  ......11  Interrupt 
     7..2: Reserved  000000..   
    4 wMaxPacketSize 2 0040h 64 bytes 
    6 bInterval 1 01h 1 ms 
    
    Interface 0 HID Report Descriptor Vendor-Defined 1
    Item Tag (Value) Raw Data 
    Usage Page (Vendor-Defined 1) 06 00 FF  
    Usage (Vendor-Defined 1) 09 01  
    Collection (Application) A1 01  
        Usage Minimum (Vendor-Defined 1) 19 01  
        Usage Maximum (Vendor-Defined 64) 29 40  
        Logical Minimum (0) 15 00  
        Logical Maximum (255) 26 FF 00  
        Report Size (8) 75 08  
        Report Count (64) 95 40  
        Input (Data,Ary,Abs) 81 00  
        Usage Minimum (Vendor-Defined 1) 19 01  
        Usage Maximum (Vendor-Defined 16) 29 10  
        Report Size (8) 75 08  
        Report Count (16) 95 10  
        Output (Data,Ary,Abs,NWrp,Lin,Pref,NNul,NVol,Bit) 91 00  
    End Collection C0  
    

    After adding in DFU Trigger (as above);

    Connection Status Device connected 
    Current Configuration 1 
    Speed Full (12 Mbit/s) 
    Device Address 10 
    Number Of Open Pipes 2 
    
    Device Descriptor HT4 Receiver
    Offset Field Size Value Description 
    0 bLength 1 12h  
    1 bDescriptorType 1 01h Device 
    2 bcdUSB 2 0200h USB Spec 2.0 
    4 bDeviceClass 1 00h Class info in Ifc Descriptors 
    5 bDeviceSubClass 1 00h  
    6 bDeviceProtocol 1 00h  
    7 bMaxPacketSize0 1 40h 64 bytes 
    8 idVendor 2 1915h Linksys 
    10 idProduct 2 521Bh  
    12 bcdDevice 2 0401h 4.01 
    14 iManufacturer 1 01h "Vald Performance Pty Ltd" 
    15 iProduct 1 02h "HT4 Receiver" 
    16 iSerialNumber 1 03h "D2E6D7700216" 
    17 bNumConfigurations 1 01h  
    
    Configuration Descriptor 1 Bus Powered, 100 mA
    Offset Field Size Value Description 
    0 bLength 1 09h  
    1 bDescriptorType 1 02h Configuration 
    2 wTotalLength 2 003Bh  
    4 bNumInterfaces 1 02h  
    5 bConfigurationValue 1 01h  
    6 iConfiguration 1 04h "Default configuration" 
    7 bmAttributes 1 A0h Bus Powered, Remote Wakeup 
     4..0: Reserved  ...00000   
     5: Remote Wakeup  ..1.....  Yes 
     6: Self Powered  .0......  No, Bus Powered 
     7: Reserved (set to one)
    (bus-powered for 1.0)  1.......   
    8 bMaxPower 1 32h 100 mA 
    
    Interface Descriptor 0/0 HID, 2 Endpoints
    Offset Field Size Value Description 
    0 bLength 1 09h  
    1 bDescriptorType 1 04h Interface 
    2 bInterfaceNumber 1 00h  
    3 bAlternateSetting 1 00h  
    4 bNumEndpoints 1 02h  
    5 bInterfaceClass 1 03h HID 
    6 bInterfaceSubClass 1 00h  
    7 bInterfaceProtocol 1 00h  
    8 iInterface 1 00h  
    
    HID Descriptor 
    Offset Field Size Value Description 
    0 bLength 1 09h  
    1 bDescriptorType 1 21h HID 
    2 bcdHID 2 0111h 1.11 
    4 bCountryCode 1 00h  
    5 bNumDescriptors 1 01h  
    6 bDescriptorType 1 22h Report 
    7 wDescriptorLength 2 0021h 33 bytes 
    
    Endpoint Descriptor 81 1 In, Interrupt, 1 ms
    Offset Field Size Value Description 
    0 bLength 1 07h  
    1 bDescriptorType 1 05h Endpoint 
    2 bEndpointAddress 1 81h 1 In 
    3 bmAttributes 1 03h Interrupt 
     1..0: Transfer Type  ......11  Interrupt 
     7..2: Reserved  000000..   
    4 wMaxPacketSize 2 0040h 64 bytes 
    6 bInterval 1 01h 1 ms 
    
    Endpoint Descriptor 01 1 Out, Interrupt, 1 ms
    Offset Field Size Value Description 
    0 bLength 1 07h  
    1 bDescriptorType 1 05h Endpoint 
    2 bEndpointAddress 1 01h 1 Out 
    3 bmAttributes 1 03h Interrupt 
     1..0: Transfer Type  ......11  Interrupt 
     7..2: Reserved  000000..   
    4 wMaxPacketSize 2 0040h 64 bytes 
    6 bInterval 1 01h 1 ms 
    
    Interface Descriptor 1/0 Vendor-Specific, 0 Endpoints
    Offset Field Size Value Description 
    0 bLength 1 09h  
    1 bDescriptorType 1 04h Interface 
    2 bInterfaceNumber 1 01h  
    3 bAlternateSetting 1 00h  
    4 bNumEndpoints 1 00h  
    5 bInterfaceClass 1 FFh Vendor-Specific 
    6 bInterfaceSubClass 1 01h  
    7 bInterfaceProtocol 1 01h  
    8 iInterface 1 00h  
    
    Unrecognized Class-Specific Descriptor 
    Offset Field Size Value Description 
    0 bLength 1 09h  
    1 bDescriptorType 1 21h  
    2  7 09 00 00 00 00 10 01   
    
    Interface 0 HID Report Descriptor Vendor-Defined 1
    Item Tag (Value) Raw Data 
    Usage Page (Vendor-Defined 1) 06 00 FF  
    Usage (Vendor-Defined 1) 09 01  
    Collection (Application) A1 01  
        Usage Minimum (Vendor-Defined 1) 19 01  
        Usage Maximum (Vendor-Defined 64) 29 40  
        Logical Minimum (0) 15 00  
        Logical Maximum (255) 26 FF 00  
        Report Size (8) 75 08  
        Report Count (64) 95 40  
        Input (Data,Ary,Abs) 81 00  
        Usage Minimum (Vendor-Defined 1) 19 01  
        Usage Maximum (Vendor-Defined 16) 29 10  
        Report Size (8) 75 08  
        Report Count (16) 95 10  
        Output (Data,Ary,Abs,NWrp,Lin,Pref,NNul,NVol,Bit) 91 00  
    End Collection C0  
    

    nRF Connect Programmer doesn't find the DFU Trigger, and shows:

    2019-08-15T23:51:33.879Z ERROR Error while probing usb device at bus.address 1.11: LIBUSB_ERROR_NOT_FOUND. Please check that a libusb-compatible kernel driver is bound to this device, see https://github.com/NordicSemiconductor/pc-nrfconnect-core/blob/master/doc/win32-usb-troubleshoot.md

Related