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

NRF51-DK disconnects after second notification

So I'm currently trying my hand at some very simple things that one can do with the NRF51-DK.

One of those things involves sending notifications to a client on certain inputs.

I now have the following problem:

I can connect, register for notifications and then receive the first notification.

However upon the second notification what happens is that my client (smartphone with nrf master control panel on android) disconnects instead of receiving the notification. The notification interval is 40 seconds.

The error code for sd_ble_gatts_hvx is still NRF_SUCCESS.

I sniffed the traffic and it apparently disconnects with Connection Timeout, do I need to do some manual managing of connected devices to keep the connection alive? Also I wonder why the first notification works then?

It does work fine for the heart rate monitor example. However the gap connection parameters and timeouts are all the same. I really don't know what I'm doing wrong here.

Edit: It apparently sometimes survives a couple of notifications but usually its two. I'm attaching my bluetooth log file. It can be opened by wireshark if you want to take a look at it.

btsnoop_hci_new.log

Edit2: Ok so things are becoming strange. I'm now trying to set the value of that characteristic manually and just poll. This yields the behavior that it works for a bit and then the characteristic values on the client side change to 88-42, 1B-68 or 00-00. Disconnecting after this happens stops me from reconnecting to the NRF51 until resetting it.

It is however still running at this point and noticing connection events while the clients keeps being stuck at Discovering Services. This is definitely a problem with the NRF51 since restarting the smartphone yields no resultion while restarting the NRF solves the problem. I'm now extremely confused. Also the value set on the characteristic keeps returning NRF_SUCCESS and the length equals the length that was to be set.

Parents
  • Have you tried to place a breakpoint in the app_error_handler() to see if an error occurred from somewhere else in your program while sending the notifications.

    app_error_handler() is declared as [weak] in app_error.c so you can place the breaktpoint there unless you have re-declared it somewhere else. Also remember add "DEBUG" to the pre-processor defintions if you like to read out the error code,etc.

Reply
  • Have you tried to place a breakpoint in the app_error_handler() to see if an error occurred from somewhere else in your program while sending the notifications.

    app_error_handler() is declared as [weak] in app_error.c so you can place the breaktpoint there unless you have re-declared it somewhere else. Also remember add "DEBUG" to the pre-processor defintions if you like to read out the error code,etc.

Children
No Data
Related