Skip to content

hf2: failed to open Adafruit nRF52 board #41

Open
@lucab

Description

@lucab

NB: I think this is the same root problem as #34, but I'm not sure, so I'm filing this separately.


I do have an Adafruit Feather nRF52840 Express board (this one).
According to the docs (here), it has an UF2-capable bootloader (source).
Before this, I updated the bootloader to the latest version available (0.6.0).

On my Linux workstation (Debian testing, kernel 5.10.0), I tried to upload a new application-firmware to it through cargo-hf2, but the detection logic failed.
The board is properly sitting in bootIoader mode (confirmed by leds status and by the mass-storage device) and waiting for uploads, but it looks like hf2 is not able to enumerate it:

$ lsusb | grep -i nrf52
Bus 001 Device 082: ID 239a:0029 Adafruit Feather nRF52840 Express

$ hf2 --vid 0x239a --pid 0x0029 info
thread 'main' panicked at 'Are you sure device is plugged in and in bootloader mode?: OpenHidDeviceError', ./hf2-cli-0.3.1/src/main.rs:17:14

At the same time, in the same setup I can properly upload my application in UF2 format to the mass storage device that the bootloader provides. These are the details provided by the board bootloader via the mass-storage device:

$ cat ./FTHR840BOOT/INFO_UF2.TXT 
UF2 Bootloader 0.6.0 lib/nrfx (v2.0.0) lib/tinyusb (0.10.1-41-gdf0cda2d) lib/uf2 (remotes/origin/configupdate-9-gadbb8c7)
Model: Adafruit Feather nRF52840 Express
Board-ID: nRF52840-Feather-revD
SoftDevice: S140 version 6.1.1
Date: Jun 19 2021

Looking at the USB descriptors, these are the interfaces I'm seeing:

$ lsusb -d 239a:0029 -v

Bus 001 Device 082: ID 239a:0029 Adafruit Feather nRF52840 Express

Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass          239 Miscellaneous Device
  bDeviceSubClass         2 
  bDeviceProtocol         1 Interface Association
  bMaxPacketSize0        64
  idVendor           0x239a Adafruit
  idProduct          0x0029 
  bcdDevice            1.00
  iManufacturer           1 Adafruit Industries
  iProduct                2 Feather nRF52840 Express
  iSerial                 3 793E13371B54BF84
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0062
    bNumInterfaces          3
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xa0
      (Bus Powered)
      Remote Wakeup
    MaxPower              100mA
    Interface Association:
      bLength                 8
      bDescriptorType        11
      bFirstInterface         0
      bInterfaceCount         2
      bFunctionClass          2 Communications
      bFunctionSubClass       2 Abstract (modem)
      bFunctionProtocol       0 
      iFunction               0 
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         2 Communications
      bInterfaceSubClass      2 Abstract (modem)
      bInterfaceProtocol      0 
      iInterface              4 nRF Serial
      CDC Header:
        bcdCDC               1.20
      CDC Call Management:
        bmCapabilities       0x00
        bDataInterface          1
      CDC ACM:
        bmCapabilities       0x02
          line coding and serial state
      CDC Union:
        bMasterInterface        0
        bSlaveInterface         1 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval              16
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass        10 CDC Data
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     80 Bulk-Only
      iInterface              5 nRF UF2
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
Device Status:     0x0000
  (Bus Powered)

I'm seeing three interfaces there, but none of them is an HID endpoint. Unfortunately I don't have any other hf2-capable board to compare, but I have a feeling that the problem is there. Do other supported devices directly expose an HID endpoint? How does the CDC endpoint fits in the picture?

It looks like this device supports UF2 uploads through the CDC+serial endpoint (and mass-storage too), but does not directly expose HID. Am I reading this right? If that is the case, is cargo-hf2 supposed to handle this "UF2 without HID" case?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions