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

pc-ble-driver connection problem

Hello, I am developing with pc-ble-driver using python. I noticed that the Bluetooth connection becomes disconnected when I alt tab out of the gui I made. Is there a solution for this and why is this happening. When this happens nothing appears on the command prompt like ble_disconnect message. When I try to reuse the bluetooth feature like to advertise I get Error code: 12289 from the driver.

I think the the nrf52 board I am using as a central device is not working correctly? Is the softdevice provided for these not enough in order to make a project? and if not how do I need to modify the code.

I am using nrf52 chip and I tested for both 115K and 1M softdevice. I using a pyqt as my gui api.

Thank you ahead,

Parents
  • Also, When the central device is advertising and trying to connect with the perperial device, it would give me these errors sometime. What does these error mean and what do I need to do to fix them

    New connection: 0
    Disconnected: 0 BLEHci.conn_failed_to_be_established
    Traceback (most recent call last):
      File "heart_rate_collector.py", line 187, in <module>
        main(serial_port)
      File "heart_rate_collector.py", line 151, in main
        conn_handle = collector.connect_and_discover()
      File "heart_rate_collector.py", line 90, in connect_and_discover
        att_mtu = self.adapter.att_mtu_exchange(new_conn)
      File "C:\Python27\lib\site-packages\pc_ble_driver_py\ble_adapter.py", line 166, in att_mtu_exchange
        return self.db_conns[conn_handle].att_mtu
    KeyError: 0L
    
    
    -------------------------------------------------------------------------------------------------------------
    
    Connection: 1, 0x2A37 (Standard.heart_rate) = [22L, 220L, 121L, 1L, 120L, 1L, 119L, 1L, 118L, 1L, 117L, 1L, 116L, 1L]
    Received advertisment report, address: 0xDC6CA5B384C1, device_name: Nordic_HRM
    Connection: 0, 0x2A37 (Standard.heart_rate) = [21L, 14L, 1L, 175L, 1L, 174L, 1L, 173L, 1L, 172L, 1L, 171L, 1L, 170L, 1L]
    Connection: 0, 0x2A37 (Standard.heart_rate) = [5L, 24L, 1L]
    Connection: 0, 0x2A37 (Standard.heart_rate) = [5L, 34L, 1L]
    Connection: 1, 0x2A37 (Standard.heart_rate) = [6L, 230L]
    Connection: 1, 0x2A37 (Standard.heart_rate) = [6L, 240L]
    Connection: 1, 0x2A37 (Standard.heart_rate) = [22L, 250L, 115L, 1L, 114L, 1L, 113L, 1L, 112L, 1L, 111L, 1L, 110L, 1L]
    Connection: 1, 0x2A37 (Standard.heart_rate) = [7L, 4L, 1L]
    Connection: 0, 0x2A19 (Standard.battery_level) = [88L]
    Connection: 0, 0x2A37 (Standard.heart_rate) = [21L, 44L, 1L, 169L, 1L, 168L, 1L, 167L, 1L, 166L, 1L, 165L, 1L, 164L, 1L]
    Connection: 0, 0x2A37 (Standard.heart_rate) = [5L, 34L, 1L]
    New connection: 2
    Connection: 1, 0x2A37 (Standard.heart_rate) = [7L, 14L, 1L]
    Connection: 1, 0x2A37 (Standard.heart_rate) = [23L, 24L, 1L, 109L, 1L, 108L, 1L, 107L, 1L, 106L, 1L, 105L, 1L, 104L, 1L]
    Connection: 0, 0x2A37 (Standard.heart_rate) = [5L, 24L, 1L]
    Connection: 0, 0x2A37 (Standard.heart_rate) = [21L, 14L, 1L, 163L, 1L, 162L, 1L, 161L, 1L, 160L, 1L, 159L, 1L, 158L, 1L]
    Connection: 1, 0x2A37 (Standard.heart_rate) = [7L, 34L, 1L]
    Connection: 0, 0x2A37 (Standard.heart_rate) = [5L, 4L, 1L]
    Disconnected: 2 BLEHci.conn_failed_to_be_established
    Connection: 1, 0x2A37 (Standard.heart_rate) = [7L, 44L, 1L]
    Connection: 0, 0x2A37 (Standard.heart_rate) = [4L, 250L]
    Connection: 1, 0x2A37 (Standard.heart_rate) = [23L, 34L, 1L, 103L, 1L, 102L, 1L, 101L, 1L, 100L, 1L, 99L, 1L, 98L, 1L]
    Connection: 0, 0x2A37 (Standard.heart_rate) = [20L, 240L, 157L, 1L, 156L, 1L, 155L, 1L, 154L, 1L, 153L, 1L, 152L, 1L]
    
    Traceback (most recent call last):
      File "heart_rate_collector.py", line 189, in <module>
        main(serial_port)
      File "heart_rate_collector.py", line 151, in main
        conn_handle = collector.connect_and_discover()
      File "heart_rate_collector.py", line 90, in connect_and_discover
        att_mtu = self.adapter.att_mtu_exchange(new_conn)
      File "C:\Python27\lib\site-packages\pc_ble_driver_py\ble_adapter.py", line 166, in att_mtu_exchange
        return self.db_conns[conn_handle].att_mtu
    KeyError: 2L
    
Reply
  • Also, When the central device is advertising and trying to connect with the perperial device, it would give me these errors sometime. What does these error mean and what do I need to do to fix them

    New connection: 0
    Disconnected: 0 BLEHci.conn_failed_to_be_established
    Traceback (most recent call last):
      File "heart_rate_collector.py", line 187, in <module>
        main(serial_port)
      File "heart_rate_collector.py", line 151, in main
        conn_handle = collector.connect_and_discover()
      File "heart_rate_collector.py", line 90, in connect_and_discover
        att_mtu = self.adapter.att_mtu_exchange(new_conn)
      File "C:\Python27\lib\site-packages\pc_ble_driver_py\ble_adapter.py", line 166, in att_mtu_exchange
        return self.db_conns[conn_handle].att_mtu
    KeyError: 0L
    
    
    -------------------------------------------------------------------------------------------------------------
    
    Connection: 1, 0x2A37 (Standard.heart_rate) = [22L, 220L, 121L, 1L, 120L, 1L, 119L, 1L, 118L, 1L, 117L, 1L, 116L, 1L]
    Received advertisment report, address: 0xDC6CA5B384C1, device_name: Nordic_HRM
    Connection: 0, 0x2A37 (Standard.heart_rate) = [21L, 14L, 1L, 175L, 1L, 174L, 1L, 173L, 1L, 172L, 1L, 171L, 1L, 170L, 1L]
    Connection: 0, 0x2A37 (Standard.heart_rate) = [5L, 24L, 1L]
    Connection: 0, 0x2A37 (Standard.heart_rate) = [5L, 34L, 1L]
    Connection: 1, 0x2A37 (Standard.heart_rate) = [6L, 230L]
    Connection: 1, 0x2A37 (Standard.heart_rate) = [6L, 240L]
    Connection: 1, 0x2A37 (Standard.heart_rate) = [22L, 250L, 115L, 1L, 114L, 1L, 113L, 1L, 112L, 1L, 111L, 1L, 110L, 1L]
    Connection: 1, 0x2A37 (Standard.heart_rate) = [7L, 4L, 1L]
    Connection: 0, 0x2A19 (Standard.battery_level) = [88L]
    Connection: 0, 0x2A37 (Standard.heart_rate) = [21L, 44L, 1L, 169L, 1L, 168L, 1L, 167L, 1L, 166L, 1L, 165L, 1L, 164L, 1L]
    Connection: 0, 0x2A37 (Standard.heart_rate) = [5L, 34L, 1L]
    New connection: 2
    Connection: 1, 0x2A37 (Standard.heart_rate) = [7L, 14L, 1L]
    Connection: 1, 0x2A37 (Standard.heart_rate) = [23L, 24L, 1L, 109L, 1L, 108L, 1L, 107L, 1L, 106L, 1L, 105L, 1L, 104L, 1L]
    Connection: 0, 0x2A37 (Standard.heart_rate) = [5L, 24L, 1L]
    Connection: 0, 0x2A37 (Standard.heart_rate) = [21L, 14L, 1L, 163L, 1L, 162L, 1L, 161L, 1L, 160L, 1L, 159L, 1L, 158L, 1L]
    Connection: 1, 0x2A37 (Standard.heart_rate) = [7L, 34L, 1L]
    Connection: 0, 0x2A37 (Standard.heart_rate) = [5L, 4L, 1L]
    Disconnected: 2 BLEHci.conn_failed_to_be_established
    Connection: 1, 0x2A37 (Standard.heart_rate) = [7L, 44L, 1L]
    Connection: 0, 0x2A37 (Standard.heart_rate) = [4L, 250L]
    Connection: 1, 0x2A37 (Standard.heart_rate) = [23L, 34L, 1L, 103L, 1L, 102L, 1L, 101L, 1L, 100L, 1L, 99L, 1L, 98L, 1L]
    Connection: 0, 0x2A37 (Standard.heart_rate) = [20L, 240L, 157L, 1L, 156L, 1L, 155L, 1L, 154L, 1L, 153L, 1L, 152L, 1L]
    
    Traceback (most recent call last):
      File "heart_rate_collector.py", line 189, in <module>
        main(serial_port)
      File "heart_rate_collector.py", line 151, in main
        conn_handle = collector.connect_and_discover()
      File "heart_rate_collector.py", line 90, in connect_and_discover
        att_mtu = self.adapter.att_mtu_exchange(new_conn)
      File "C:\Python27\lib\site-packages\pc_ble_driver_py\ble_adapter.py", line 166, in att_mtu_exchange
        return self.db_conns[conn_handle].att_mtu
    KeyError: 2L
    
Children
No Data
Related