2

We developing device based on Nordic nRF51 bluetooth low energy chip, whitch acts in peripheral mode, and have android application, whitch acts as bluetooth central. Application starts advertising and our device makes pair with phone (popup dialog requesting PIN code appears).

We faced really strange problem on some phones, especially on Xiaomi phones (I use Xiaomi Redmi Note 3 Pro): bluetooth pairing works correctly only when phone connected to ADB:

  1. I start advertising without USB cable connected to phone
  2. PIN code dialog appeared
  3. I enter valid PIN code
  4. I can see that bluetooth pair has been created, but device stops communication and makes disconnect right after bluetooth pair has been created.

If I plug USB cable to phone to see logcat in Android studio everything works perfectly - Bluetooth pairing works fine and device can do communication to phone! This problem occures only in some models of phones. I also tried to modify "Release" settings in Android studio to disable optimisation and add bebug information in release build, but it is not solves the problem.

Logcat (Pairing works normally):

D/GATT: StartSearch

        [ 02-08 15:31:58.797  5676: 5875 E/         ]
        GKI_timer_update no work to be done when expected work
D/BluetoothGattServer: registerCallback()
D/BluetoothGattServer: registerCallback() - UUID=042e51cd-6278-4200-9b36-480576e8bcc0
D/BluetoothGattServer: onServerRegistered() - status=0 serverIf=5
D/BluetoothGattServer: addService() - service: 6e400004-b5a3-f393-e0a9-e50e24dcca9e
D/BluetoothGattServer: onServiceAdded() - service=6e400004-b5a3-f393-e0a9-e50e24dcca9estatus=0
D/GattServer: Our gatt server service was added.
D/BluetoothLeAdvertiser: onClientRegistered() - status=0 clientIf=6
D/advertise: onStartSuccess

             [ 02-08 15:31:59.397  5676: 5875 E/         ]
             GKI_timer_update no work to be done when expected work
D/BluetoothGattServer: onServerConnectionState() - status=0 serverIf=5 device=F9:D4:DB:18:27:49
D/GattServer: Our gatt server connection state changed, new state 
D/GattServer: 2

              [ 02-08 15:31:59.407  5676: 5875 E/         ]
              GKI_timer_update no work to be done when expected work
D/GattServer: Our gatt server descriptor was written.
I/GattServer: SUBSCRIBE !!!
D/BluetoothGattServer: onServerConnectionState() - status=0 serverIf=5 device=F9:D4:DB:18:27:49
D/GattServer: Our gatt server connection state changed, new state 
D/GattServer: 0
D/BluetoothGattServer: onServerConnectionState() - status=0 serverIf=5 device=F9:D4:DB:18:27:49
D/GattServer: Our gatt server connection state changed, new state 
D/GattServer: 2
D/QueryManager: Send command 06 02 62 

        [ 02-08 15:32:14.757  5676: 5875 E/         ]
        GKI_timer_update no work to be done when expected work
D/Gatt: Send data 00 06 02 62 00 , MAC: F9:D4:DB:18:27:49
D/GattServer: onNotificationSent
D/GattServer: We have received a write request for one of our hosted characteristics: 6e400002-b5a3-f393-e0a9-e50e24dcca9e
D/GattServer: data = 00 02 06 62 9B C1 C1 C1 C1 C1 C1 C1 00 
D/QueryManager: Send command 06 02 22 00 
D/GattServer: onNotificationSent
D/Gatt: Send data 00 06 02 22 C1 00 , MAC: F9:D4:DB:18:27:49
D/GattServer: We have received a write request for one of our hosted characteristics: 6e400002-b5a3-f393-e0a9-e50e24dcca9e
D/GattServer: data = 00 02 06 22 C1 00 
D/BluetoothGattServer: onServerConnectionState() - status=0 serverIf=5 device=F9:D4:DB:18:27:49
D/GattServer: Our gatt server connection state changed, new state 
D/GattServer: 0

May be there is some way to display logcat in app without making ADB conenction without USB or I missed something in log.

I also don't understand this line: GKI_timer_update no work to be done when expected work

Dezmond
  • 71
  • 4
  • Two notes about the redmi note 3 that may be useful. There's several different chipsets depending on what variant of the phone you have. At least for the MediaTek variant: * The phone doesn't reliably support the ability to publish gatt servers (seems to work fine as a client though) * the phone does not support "LE Privacy". This means it will not exchange an IRK during pairing which I have seen confuse the pairing state machine in some BLE stacks – chrisc11 Feb 20 '17 at 02:56
  • Hi, i am now in the same situation(we are developing device that works with BLE). If it's not problem for you - write to me on LinkedIn(https://www.linkedin.com/in/lucas63/), or on email(a.malynovskyi63@gmail.com) – lucas63 Nov 10 '17 at 23:17
  • Have you solved this issue since than? – Anatoly May 26 '20 at 14:33

0 Answers0