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

nrf52840 failure with connect desktop and wireshark

Hi all, I am trying to use the nrf52840 dongle with wireshark, I was having permission errors trying to open the device in the program section of the nrf desktop suite running on Ubuntu 20 and followed the suggestions found at https://devzone.nordicsemi.com/f/nordic-q-a/52546/nrf-connect-linux/211625#211625 , adding the user to the dialout group did not do anything, the method using https://github.com/NordicSemiconductor/nrf-udev and https://github.com/NordicSemiconductor/nrf-udev/releases made the dongle visible and readable.  In the program section of the desktop suite I selected to add the hex nrf802154_sniffer_dongle.hex and ran the 'write' option.  During or after it ran the write option i recieved the following log

2020-10-17T15:14:09.904Z INFO Parsing HEX file:  /home/david/nRF-Sniffer-for-802.15.4/nrf802154_sniffer/nrf802154_sniffer_dongle.hex
2020-10-17T15:14:10.036Z INFO File was last modified at  10/16/2020, 11:51:25 PM
2020-10-17T15:14:15.204Z INFO Using USB SDFU protocol to communicate with target
2020-10-17T15:14:15.271Z INFO Protocol Version:  1 found
2020-10-17T15:14:15.306Z INFO Hardware: 52840 found
2020-10-17T15:14:15.492Z INFO Firmware: Bootloader found
2020-10-17T15:14:15.494Z INFO Firmware: Application found
2020-10-17T15:14:51.577Z INFO Does not need to be reloaded:  /home/david/nRF-Sniffer-for-802.15.4/nrf802154_sniffer/nrf802154_sniffer_dongle.hex
2020-10-17T15:14:51.592Z INFO Hash is generated by SHA256
2020-10-17T15:14:51.605Z INFO Performing DFU. This may take a few seconds
2020-10-17T15:14:51.659Z INFO DFU procedure starts. This may take a few seconds.
2020-10-17T15:14:56.693Z INFO DFU for Application completed successfully!
2020-10-17T15:14:56.694Z INFO 0 dfu package(s) left.
2020-10-17T15:14:56.694Z INFO Waiting for device
2020-10-17T15:15:01.697Z ERROR Reopen device failed: Timeout while waiting for device  C621B478D146 to be attached and enumerated
2020-10-17T15:15:01.698Z INFO Nordic DFU Trigger Interface was not found.Please physically reset device.
2020-10-17T15:15:01.718Z ERROR Device not found due to failure during DFU
2020-10-17T15:15:25.178Z INFO Target device closed.

After this I had to press the reset button on the dongle for it to be recognized, but it did appear to show the hex in the dongles memory.  However, I cannot find any protocol in wireshark despite having added the appropriate python script to the wireshark extcap directory (I have wireshark working successfully with the nrf BLE protocol using  a dongle from Adafruit, so the pyserial and all that is in order) and wireshark does not see the dongle.

I'm very new to working with the wireless protocols and wireshark and the associated hardware so I'm not really sure where the real issue lies in this, if I've overlooked any imortant information please let me know.

Thanks,

David

  • Hi Vidar,

    When I  run it from terminal I get the following

    sudo wireshark
    QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
    from: too many arguments
    /usr/bin/env: ‘python3\r’: No such file or directory
    /usr/bin/env: ‘python3\r’: No such file or directory
    from: too many arguments

    running it without sudo gets many more, but they seem to all be permissions issues as expected.  I looked through the GUI System Log Viewer but didn't see anything that seems related at all.  If there's a specific log to check let me now and I can have a look.

    I did have the idea that since Ubuntu 20 seems like it does not parse python as either python2 or python3, I checked the header of sudo '/usr/lib/x86_64-linux-gnu/wireshark/extcap/nrf802154_sniffer.py' and it was originally just python.  I changed it to python3 and it didn't seem to change anything, when I tried changing it to python2 I got this

    sudo wireshark
    QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
    Traceback (most recent call last):
    File "/usr/lib/x86_64-linux-gnu/wireshark/extcap/nrf802154_sniffer.py", line 62, in <module>
    from serial import Serial, serialutil
    ImportError: No module named serial
    from: too many arguments
    /usr/bin/env: ‘python3\r’: No such file or directory
    from: too many arguments
    /usr/bin/env: ‘python3\r’: No such file or directory
    Traceback (most recent call last):
    File "/usr/lib/x86_64-linux-gnu/wireshark/extcap/nrf802154_sniffer.py", line 62, in <module>
    from serial import Serial, serialutil
    ImportError: No module named serial

    so it does seem like it is accessing the nrf802154_sniffer.py file. 

  • Hi David,

    david613 said:
    /usr/bin/env: ‘python3\r’: No such file or directory

     Looks like this is the problem. Can you try editing the py script again and remove the '\r' at the end. I forgot to mention earlier that I also had to change from 'python' to 'python3' in the script.

    And it looks like it's failing with python2 because it does not have the 'pyserial' dependency installed.

  • It does have pyserial installed for python3, and it works with the Bluetooth protocols.  I'm not sure what '\r' I would need to delete, the header for the script is '#!/usr/bin/env python3'. 

    Thanks for all the help Vidar!

  • Yes, the missing pyserial dependency was reported when you tried Python2. I'm not sure either why '\r' is appended to the line, would it make sense to try this in another text editor? The nrf_serial_ble.py script for the BLE sniffer has the exact same line and that is apparently working fine on your setup ( #!/usr/bin/env python3)

  • OK, I got the '\r' issue resolved, I tried running each of the python scripts individually to see if there was a particular one that was causing the error but none of them gave that error.  So I ran -

    apt install dos2unix

    sudo dos2unix '/usr/lib/x86_64-linux-gnu/wireshark/extcap/nrf802154_sniffer.py' 

    sudo dos2unix '/usr/lib/x86_64-linux-gnu/wireshark/extcap/nrf_sniffer_ble.py' 

    and after this

    sudo wireshark
    QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'

    However, even after running 'Capture > Refresh Interfaces', exiting and restarting wireshark I'm still not seeing any protocol for the nrf52840.

    I was just about to get listings of the extcap folders to make sure I'm not missing anything and found something else that could be of interest.  When I run 'sudo wireshark' I get 'QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root''

    Then no further terminal output until I open the extcap folder from 'Help > About Wireshark > Folders' then I get

    13:57:54.817 Main Warn QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
    RuntimeError: object at 0x7f70b405f380 of type RenameMenu is not initialized
    RuntimeError: object at 0x7f70b40acbc0 of type FolderColorMenu is not initialized

    then if I open the SnifferAPI folder in the extcap folder I get

    Traceback (most recent call last):
    File "/usr/share/caja-python/extensions/dejadup.py", line 156, in get_file_items
    include_paths = self.dejadup.get_dejadup_paths('include-list')
    File "/usr/share/caja-python/extensions/dejadup.py", line 70, in get_dejadup_paths
    paths = ast.literal_eval([stdout][0]) # Convert shell dump to list
    File "/usr/lib/python3.8/ast.py", line 99, in literal_eval
    return _convert(node_or_string)
    File "/usr/lib/python3.8/ast.py", line 98, in _convert
    return _convert_signed_num(node)
    File "/usr/lib/python3.8/ast.py", line 75, in _convert_signed_num
    return _convert_num(node)
    File "/usr/lib/python3.8/ast.py", line 66, in _convert_num
    _raise_malformed_node(node)
    File "/usr/lib/python3.8/ast.py", line 63, in _raise_malformed_node
    raise ValueError(f'malformed node or string: {node!r}')
    ValueError: malformed node or string: b"['$HOME']\n"
    RuntimeError: object at 0x7f70b405f380 of type RenameMenu is not initialized
    RuntimeError: object at 0x7f70b40acbc0 of type FolderColorMenu is not initialized

    That being said, I have the following contents for the global extcap folder

    /usr/lib/x86_64-linux-gnu/wireshark/extcap$ ls
    androiddump       dpauxmon                           nrf_sniffer_ble.py     sdjournal            sshdump
    ciscodump           nrf802154_sniffer.py           randpktdump           SnifferAPI           udpdump

Related