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

Problem with connection

Hi, I created firmware to nRF51822 Development Kit but I have a problem with connection. PCA10004 board is programmed to advertising packets whole the time and measure battery voltage level every hour (APP_TIMER_PRESCALER 8, BATTERY_LEVEL_MEAS_INTERVAL APP_TIMER_TICKS(3600000, APP_TIMER_PRESCALER)) but from time to time I am connecting with it by USB dongle to read values from services. Everything works fine in short period after flash programing, but there is a problem after few hours or when I leave board to next day because I can't connect with it then. From Master Control Panel i am getting this logs:

[14:58:19.8] ConnectToDevice() [14:58:20.4] ---------------------------- [14:58:20.4] Received Connection Parameter Update Request [14:58:20.4] Connected to device [14:58:20.4] Role: 0 [14:58:20.4] PeerAddressType: 1 [14:58:20.4] PeerAddress (MSB): D2C54EA47F0C [14:58:20.4] Connection Interval: 20.0ms [14:58:20.4] Connection Latency: 0 [14:58:20.4] Supervision Timeout: 3000ms [14:58:20.4] Clock Accuracy: (1) [14:58:20.4] ---------------------------- [14:58:20.4] Connected to D2C54EA47F0C [14:58:20.4] Lost connection to device. Reason: BTLE_REMOTE_USER_TERMINATED_CONNECTION [14:58:20.4] ConnectionParameterUpdateResponse sent with ACCEPTED response [14:58:20.4] Connection Parameters Update sent. ConnInterval:40.0ms, SlaveLatency:0, SupervisionTimeout:4000.0ms [14:58:20.4] SERVER: Received packet <HciEvent: eventCode=0x0A> - <HciEvent: eventCode=0x0A> [14:58:20.4] SERVER: Received Link Loss

I have to make power reset and then everything works fine but after some time the whole situation has repeated. Do you have any idea whan can cause this problem?

Best regards,

P.S. I'm using softdevice 6.0 with SDK 5.1.

  • I have just checked that my problem occurs very often but not always and sometimes I can't connect with board in one moment but for example 10 minutes later I can.

  • Hi Martin,

    To me, it is a bit hard to understand the issue with this information. But I observe that your firmware (the nRF51822 application) is disconnecting as soon as it got connected.

    [14:58:20.4] Connected to D2C54EA47F0C [14:58:20.4] Lost connection to device. Reason: BTLE_REMOTE_USER_TERMINATED_CONNECTION

    From the reason BTLE_REMOTE_USER_TERMINATED_CONNECTION, it is clear that its your firmware that is requesting the S110 SoftDevice to disconnect for some reason. May I suggest you search your source code for the error code 'BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION' and see where it is being used?

    Cheers, Balaji

  • I have just discovered that issue may be caused by my second timer. I use it to disconnect with order "sd_ble_gap_disconnect(m_conn_handle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION)" after 2 minutes to protect by staying to long in connection mode and in that way extend battery life. It starts when device receives from stack "BLE_GAP_EVT_CONNECTED" event and I think that the problem is that this timer sometimes doesn't count this 2 minutes but reports interruption at once and make disconnection. The toughest part to understand this problem is that it occurs randomly. Do you have any suggestions?

  • If your objective is to have a longer battery life, then I suggest you use a longer connection interval in your application (instead of using timer to disconnect). Or you can also have a look at some good tips here on how to write low-power applications -> http://devzone.nordicsemi.com/index.php/how-to-minimize-current-consumption-for-ble-application-on-nrf51822#reply-5187

    There is one section titled 'Tuning connection parameters' in the above link which might come in handy for you.

    About the randomness you see with your timer: I am sorry but I am not sure what is wrong. Is it possible to share the code piece (either here or by Private Message) which creates/starts/and stops the timers?

  • As Balaji points out, it seems as if your application immediately disconnects on connection, so there seem to be some problem with the way your applicaiton handles this timer. If you can find the problem, can you please supply the complete code project you're working with, either by uploading it here or creating a regular support case?

    However, I'd also like to point out that given connection interval equal to the advertising interval, it's much cheaper power-wise to stay in a connection than advertising. The reason is that staying in a connection will keep all communication on one channel, while advertising will send and receive on all three advertising channels. You therefore may want to reconsider this timer, if not strictly needed.

Related