Read nRF52840's MAC address across usb or serial tty?

Is there a way to read the mac address from the serial tty of an nRF52840?  I have multiple dongles programmed with the BLE sniffer (nrf_sniffer_for_bluetooth_le_4.1.0) and am trying to map the HW ID of the device to the MAC printed on the dongle:

$ls /dev/serial/by-id/*
lrwxrwxrwx 1 root root 13 Jun 7 12:19 usb-ZEPHYR_nRF_Sniffer_for_Bluetooth_LE_5F88E7362DA8XXXX-if00 -> ../../ttyACM0

lrwxrwxrwx 1 root root 13 Jun 7 12:19 usb-ZEPHYR_nRF_Sniffer_for_Bluetooth_LE_86CA22D6DF10XXXX-if00 -> ../../ttyACM1

I don't have a JLink attached to it, so I can't use nrfjprog to read the memory and nothing under /sys/class/tty/ttyACM[0|1] shows any mac related info.    This is through an Ubuntu 20.04 machine. 

Parents
  • Not aware of any way you can do this (or get the mac address), but you may look into using the 'lsbusb -v' command that possibly can help:

    lsbusb -v
    Bus 001 Device 016: ID 1915:522a Nordic Semiconductor ASA nRF Sniffer for Bluetooth LE
    Device Descriptor:
      bLength                18
      bDescriptorType         1
      bcdUSB               2.00
      bDeviceClass            0
      bDeviceSubClass         0
      bDeviceProtocol         0
      bMaxPacketSize0        64
      idVendor           0x1915 Nordic Semiconductor ASA
      idProduct          0x522a
      bcdDevice            2.04
      iManufacturer           1 ZEPHYR
      iProduct                2 nRF Sniffer for Bluetooth LE
      iSerial                 3 C2E15977A9D11709
      bNumConfigurations      1
      Configuration Descriptor:
        bLength                 9
        bDescriptorType         2
        wTotalLength       0x004b
        bNumInterfaces          2
        bConfigurationValue     1
        iConfiguration          0
        bmAttributes         0xc0
          Self Powered
        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              0
          CDC Header:
            bcdCDC               1.10
          CDC Call Management:
            bmCapabilities       0x02
              use DataInterface
            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     0x0010  1x 16 bytes
            bInterval              10
        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     0x82  EP 2 IN
            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     0x01  EP 1 OUT
            bmAttributes            2
              Transfer Type            Bulk
              Synch Type               None
              Usage Type               Data
            wMaxPacketSize     0x0040  1x 64 bytes
            bInterval               0
    Device Status:     0x0001
      Self Powered

    Best regards,
    Kenneth

  • Sadly, nothing in lsusb shows me the MAC of the device.  I also examined by probing under /sys/class.  I'd be fine if there were a C or Python program I could run that could pull the MAC off the serial connection.

  • I don't think you can find the MAC address no, but can't you use a different identifier to know this is the nRF sniffer dongle?

    I don't understand why you need the MAC address in specific, this is a BLE sniffer in any case, so the MAC address of the sniffer should not be important here.

    Best regards,
    Kenneth

  • The project I'm doing this for has multiple sniffer devices and wants to know which one gets what MAC at what orientation (say left or right).  But unlike the DK, which populates with the HW ID stamped on it, making for easy identification, the dongles have MAC printed, but no HW ID, so there's a disconnect.  It makes it a bit of a pain in the butt and I was hoping for some programatic way of identifying them rather than manually plugging in each dongle and copying the HW ID and its MAC into some spreadsheet.

Reply
  • The project I'm doing this for has multiple sniffer devices and wants to know which one gets what MAC at what orientation (say left or right).  But unlike the DK, which populates with the HW ID stamped on it, making for easy identification, the dongles have MAC printed, but no HW ID, so there's a disconnect.  It makes it a bit of a pain in the butt and I was hoping for some programatic way of identifying them rather than manually plugging in each dongle and copying the HW ID and its MAC into some spreadsheet.

Children
Related