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

RemoteUserTerminatedConnection reason causes disconnection between central and peripheral

Hi all,

I am a new user to the BLE technology and to the Nordic's development tools/chips. I use the nRF51822 development kit and the nRFgo Starter kit to develop a BLE application and the PCA10000 USB dongle to receive data. The PCA10000 is the central (GATT client) and PCA10004 is the peripheral (GATT server). I have implemented a custom service with one characteristic in the peripheral, based on Nordic's template application. I have also implemented a computer software in C# to be connected with peripheral device. Central and peripheral are being connected successfully and I can send notification from the peripheral to the central. After about a minute the connection between them is lost. The DisconnectReason is "RemoteUserTerminatedConnection". I noticed that when I use the Master Control Panel software from Nordic with the peripheral, this disconnection does not happened. I also noticed that this also happens in the HealthThermoDemo example application and there the application is reconnecting.

Should this disconnection happen? I want to maintain the connection for longer than a minute. After disconnection, I try to connect again but I fail. After a connection request, using the masterEmulator.connect(), the peripheral seems to be connected (starter kit LED1 lights on and LED0 lights off) but C# software could not connect. Any thoughts ot recommendations about why disconnection happens only in C# software and not in Master Control Panel and how can avoid that or why C# software cannot reconnect, are appreciated.

I use SDK 5.1, softDevice 110 v.6.0 and Visual Studio Express 2012.

Thanks in advance, John

Parents
  • If it weren't for the disconnect reason, I'd guess that this disconnect happened due to connection parameters negotiation failing, but this should give the reason BLE_HCI_CONN_INTERVAL_UNACCEPTABLE. This would explain the different behavior of the MCP (which connects with 20 ms by default, but accepts any update request), HealthThermoDemo (which connects with 20 ms, and does not accept any updates) and your custom app (which most likely connects with some other interval, and may not accept updates). To accept updates, you must set a handler for the ConnectionUpdateRequest event on the MasterEmulator object, and reply by calling UpdateConnectionParameters.

    The reason you see is what would be expected if the Peripheral device disconnects the link voluntarily, typically by calling sd_ble_gap_disconnect() with this particular error code as a parameter. I would therefore not normally expect to see this unexpectedly, unless there is some code path in which your application does this.

    If you can't solve this problem, could you please supply the complete code of your project? If you can't share it here in the open, feel free to create a support case and submit it there. Any code shared there will be handled in confidentiality.

Reply
  • If it weren't for the disconnect reason, I'd guess that this disconnect happened due to connection parameters negotiation failing, but this should give the reason BLE_HCI_CONN_INTERVAL_UNACCEPTABLE. This would explain the different behavior of the MCP (which connects with 20 ms by default, but accepts any update request), HealthThermoDemo (which connects with 20 ms, and does not accept any updates) and your custom app (which most likely connects with some other interval, and may not accept updates). To accept updates, you must set a handler for the ConnectionUpdateRequest event on the MasterEmulator object, and reply by calling UpdateConnectionParameters.

    The reason you see is what would be expected if the Peripheral device disconnects the link voluntarily, typically by calling sd_ble_gap_disconnect() with this particular error code as a parameter. I would therefore not normally expect to see this unexpectedly, unless there is some code path in which your application does this.

    If you can't solve this problem, could you please supply the complete code of your project? If you can't share it here in the open, feel free to create a support case and submit it there. Any code shared there will be handled in confidentiality.

Children
Related