This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Receiving onclientconnectionstate() - status=133 on custom Android BLE app that uses NUS service

Hello,

I am receiving the above error on Android BLE app while connecting to my pca10040 based board, and I developed this app with nRF Toolbox as a reference.

I am testing this on multiple Android versions and devices, out of which I dont face any problem on motorolla devic, or nexus device (android 7) or on one plus one with android 6.

I am specifically facing this issue on redmi 3s prime with android 6.0.1. On this device My connection handler will wait for some time and then it throws this error.

I have attached the logs with testing different devices:

 **Note : 1 = Connected state
         2 = Connecting state



Mi Redme 3s Prime (6.0.1 - Marshmallow)
Result: Fail

04-18 11:56:59.462 8852-8852/com.demo.bledoorlock D/BluetoothGatt: connect() - device: D0:35:52:F8:A9:59, auto: false
04-18 11:56:59.462 8852-8852/com.demo.bledoorlock D/BluetoothGatt: registerApp()
04-18 11:56:59.462 8852-8852/com.demo.bledoorlock D/BluetoothGatt: registerApp() - UUID=dd2097ce-ff94-42e4-a454-4c4401aa5482
04-18 11:56:59.466 8852-8892/com.demo.bledoorlock D/BluetoothGatt: onClientRegistered() - status=0 clientIf=5
04-18 11:56:59.467 8852-8852/com.demo.bledoorlock I/System.out: 2
04-18 11:57:00.740 8852-8888/com.demo.bledoorlock V/FA: Inactivity, disconnecting from the service
04-18 11:57:29.490 8852-8992/com.demo.bledoorlock D/BluetoothGatt: onClientConnectionState() - status=133 clientIf=5 device=D0:35:52:F8:A9:59
04-18 11:57:29.491 8852-8852/com.demo.bledoorlock I/System.out: 2



Mi Redme 2 Prime (5.1.1 - Lollipop)
Result: Pass

04-18 11:54:13.871 25251-25251/com.demo.bledoorlock D/BluetoothGatt: connect() - device: D0:35:52:F8:A9:59, auto: false
04-18 11:54:13.871 25251-25251/com.demo.bledoorlock D/BluetoothGatt: registerApp()
04-18 11:54:13.871 25251-25251/com.demo.bledoorlock D/BluetoothGatt: registerApp() - UUID=cb431bbb-bc5e-459b-bdcf-f7ed1929fa01
04-18 11:54:13.871 25251-25580/com.demo.bledoorlock D/BluetoothGatt: onClientRegistered() - status=0 clientIf=5
04-18 11:54:13.871 25251-25251/com.demo.bledoorlock I/System.out: 2
04-18 11:54:14.071 25251-25267/com.demo.bledoorlock D/BluetoothGatt: onClientConnectionState() - status=0 clientIf=5 device=D0:35:52:F8:A9:59
04-18 11:54:14.071 25251-25251/com.demo.bledoorlock I/System.out: 1
04-18 11:54:14.091 25251-25251/com.demo.bledoorlock D/BluetoothGatt: discoverServices() - device: D0:35:52:F8:A9:59
04-18 11:54:14.091 25251-25251/com.demo.bledoorlock I/ViewRootImpl: CPU Rendering VSync enable = true
04-18 11:54:14.091 25251-25580/com.demo.bledoorlock D/BluetoothGatt: onSearchComplete() = Device=D0:35:52:F8:A9:59 Status=0
04-18 11:54:14.101 25251-25580/com.demo.bledoorlock D/BluetoothGatt: setCharacteristicNotification() - uuid: 6e400003-b5a3-f393-e0a9-e50e24dcca9e enable: true



Oneplus One (6.0.1 - Marshmallow)
Result: Pass

04-18 11:58:16.768 28661-28661/com.demo.bledoorlock D/BluetoothGatt: connect() - device: D0:35:52:F8:A9:59, auto: false
04-18 11:58:16.768 28661-28661/com.demo.bledoorlock D/BluetoothGatt: registerApp()
04-18 11:58:16.768 28661-28661/com.demo.bledoorlock D/BluetoothGatt: registerApp() - UUID=a3af82f0-c095-4b06-a1fb-479d7d5f715e
04-18 11:58:16.770 28661-28674/com.demo.bledoorlock D/BluetoothGatt: onClientRegistered() - status=0 clientIf=5
04-18 11:58:16.777 28661-28661/com.demo.bledoorlock I/System.out: 2
04-18 11:58:17.073 28661-28675/com.demo.bledoorlock D/BluetoothGatt: onClientConnectionState() - status=0 clientIf=5 device=D0:35:52:F8:A9:59
04-18 11:58:17.074 28661-28661/com.demo.bledoorlock I/System.out: 1
04-18 11:58:17.086 28661-28661/com.demo.bledoorlock D/BluetoothGatt: discoverServices() - device: D0:35:52:F8:A9:59
04-18 11:58:17.089 28661-28674/com.demo.bledoorlock D/BluetoothGatt: onSearchComplete() = Device=D0:35:52:F8:A9:59 Status=0
04-18 11:58:17.092 28661-28674/com.demo.bledoorlock D/BluetoothGatt: setCharacteristicNotification() - uuid: 6e400003-b5a3-f393-e0a9-e50e24dcca9e enable: true
04-18 11:58:17.159 28661-28697/com.demo.bledoorlock V/RenderScript: 0xaeee3000 Launching thread(s), CPUs 4
04-18 11:58:17.571 28661-28693/com.demo.bledoorlock V/FA: Inactivity, disconnecting from the service

Please suggest how to fix this?

EDIT:

mi_logs.zip

working_phone_log.zip

I made the sniffer work on windows and I have attached the log of working communication as against the logs when connecting on redmi 3s phone. If anybody understands the procedure now, please suggest where is the problem.

  • If the Mi Redme 3s is sending a connection request, then it should show up in the sniffer log like the other phones. Do you have access to a Frontline/Elisys sniffer or similar? That way we could verify that the connection request is actually sent. Are you able to debug the application on the PCA10040 board? If yes, are any BLE events propagated to the application, e.g. BLE_GAP_EVT_CONNECTED or BLE_GAP_EVT_DISCONNECTED?

  • Yes that's true it should show up in the sniffer log, but the main problem is Mi phone is not able to send connection request, whereas others phone sends connection request..! I will post the logs by debugging on pca10040 shortly

  • Yes, if you do not get any BLE events from the SoftDevice while you attempt to connect using the Mi Redme 3s phone in addition to the fact that you do not see any connection request on the sniffer trace, then it suggests that the issue lies with the Mi Redme 3s phone.

  • Hi, I am adding the observations on Vivek's behalf:

    I have put logs in function on_ble_event(), in cases BLE_GAP_EVT_CONNECTED and BLE_GAP_EVT_DISCONNECTED, but I do not receive those logs in the case I do not see the connect request on sniffer. So as you suggested the problem might be in the phone; But that is not all.

    We went into the phone's settings, we tried to pair the pca10040 fromthere manually (which will fail ofcourse), and after that we tried connecting to the board through the app, then it connects succesfully. We observed all the logs in sniffer as well as on pca10040 according to the working phones sniffer I have attached. We have tried this multiple times, and it is confirmed that if we try to pair manually in device's settings, and then try to connect through the app, it works.

  • We are observing this issue on another phone as well. We can add the logs out of it shortly. But my point is if this is not limited to only a single phone, then is there any way there is missed out something from the BLE_manager? We are using the uart manager from nrf_toolbox, so whatever is managed from uart mnanger to ble manager, we haven't looked at it.

Related