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

The issue when using pc-ble-driver-py for nRF52840-Dongle

Dears,

I need to use the nRF52840-Dongle for BLE device to communicate with the end devices, the platform is ubuntu and the programming is python3.7, I have problem on it.

I have installed the nRF-Connect-Desktop, and written the fireware into the nRF-Dongle, cause I can operate the Dongle to scan and discover devices normally from the tool. Then I used the pc-ble-driver-py from GitHub trying to operate it with python. After installed the pc-ble-driver-py completely(including the pc-ble-driver and so on) according to the readme, I ran the example named serial_port_enum.py with the identifier arg ''NRF52". But I got the empty result returned by the BleDriver.enum_serial_ports() .  Is there something or procedure I missed? Or help me for more detailed procedure to use the pc-ble-driver-py for  nRF52480-Dongle. Thank you very much.

My purpose is to do the scan, connect, characteristic and etc(like bluepy) with nRF52480-Dongle normally.

Parents
  • Hi,

    What version of pc-ble-driver-py are you using? It may not use the same version of the connectivity firmware as what nRF Connect for Desktop uses. Have a look at Programming connectivity HEX files, in particular the sections on "Nordic USB based kits".

    Regards,
    Terje

  • Hi,

    Thank you for your reply. Initially, I installed the pc-ble-driver-py according to Building from source.  The version of my pc-ble-driver-py is pc-ble-driver-py==0.13.0a0, and the pc-ble-driver is 4.1.1(installed via vcpkg), and my nRF-Connect-Desktop is V3.2.0

    I flushed the DFU zip file downloaded by the vcpkg(name is connectivity_4.1.1_usb_with_s132_3.1.0_dfu_pkg.zip) using the command nrfutil as you previously mentioned. As the device programmed successfully, I also got the same issue(enum_serial_ports: 0 serial ports found)!

    I tried other DFU zip file(connectivity_4.1.1_usb_with_s132_5.1.0_dfu_pkg.zip), and I received same issue.

    For more trail, I downgraded the pc-ble-driver-py version to 0.11.4, and I got different failure(same with the two DFU zip files mentioned above):

       

    >python3 serial_port_enum.py NRF52
    >Traceback (most recent call last):
      File "serial_port_enum.py", line 83, in <module>
        init(sys.argv[1])
      File "serial_port_enum.py", line 48, in init
        from pc_ble_driver_py.ble_driver import BLEDriver, Flasher
      File "/usr/local/lib/python3.7/dist-packages/pc_ble_driver_py/ble_driver.py", line 112, in <module>
        driver = importlib.import_module(SWIG_MODULE_NAME)
      File "/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
      File "/usr/local/lib/python3.7/dist-packages/pc_ble_driver_py/lib/linux/x86_64/pc_ble_driver_sd_api_v3.py", line 28, in <module>
        _pc_ble_driver_sd_api_v3 = swig_import_helper()
      File "/usr/local/lib/python3.7/dist-packages/pc_ble_driver_py/lib/linux/x86_64/pc_ble_driver_sd_api_v3.py", line 24, in swig_import_helper
        _mod = imp.load_module('_pc_ble_driver_sd_api_v3', fp, pathname, description)
      File "/usr/lib/python3.7/imp.py", line 242, in load_module
        return load_dynamic(name, filename, file)
      File "/usr/lib/python3.7/imp.py", line 342, in load_dynamic
        return _load(spec)
    ImportError: dynamic module does not define module export function (PyInit__pc_ble_driver_sd_api_v3)
    

    Would you please help to check for me? Thank you very much!

  • In additional, I thought that the pc-ble-driver-py 0.13.0a0 and the connectivity_4.1.1_usb_with_s132_5.1.0_dfu_pkg.zip should be matched, because with the input arg "NRF52", the driver for the pc-ble-driver-py 0.13.0a0 is ds_api_v5:

    ble_driver.py:

    if nrf_sd_ble_api_ver == 2:
        import pc_ble_driver_py.lib.nrf_ble_driver_sd_api_v2 as driver
    
        ATT_MTU_DEFAULT = driver.GATT_MTU_SIZE_DEFAULT
    elif nrf_sd_ble_api_ver == 5:
        import pc_ble_driver_py.lib.nrf_ble_driver_sd_api_v5 as driver
    
        ATT_MTU_DEFAULT = driver.BLE_GATT_ATT_MTU_DEFAULT
    else:
        raise NordicSemiException(
            "SoftDevice API {} not supported".format(nrf_sd_ble_api_ver)
        )

    while the sd_api_ver in pc-ble-driver-py 0.11.4 is 3. So why it doesn't enum any nRF devices?

  • Hi,

    I am wondering from where you got version 0.13.0a0, as the latest tagged version of pc-ble-driver-py on github is version 0.12.0. Can you try with 0.12.0?

    The error messages from your trial with 0.11.4 is because of python version. 0.12.0 is the first version to use Python 3. All previous versions of pc-ble-driver-py used Python 2. Please consult the README.md for the particular pc-ble-driver-py version, for Python version requirements.

    Regards,
    Terje

  • Hello,

    Thank you for your reply. Yes, I pull the code from the github with the master branch, which is the version 0.13.0a0.  I will try the branch 0.12.0 to have a try.

Reply Children
No Data
Related