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

Bluetooth automatic reconnection nRF51

Hi, The situation: nRF51 has established a connection with the iOS/Android (custom made)App. The nRF51 goes out of the Bluetooth range. Eventually, the Bluetooth connection is disconnected. The nRF51 comes into the Bluetooth range. The App reconnects with the nRF51 automatically. The nRF51 receives BLE_GAP_EVT_CONNECTED event and upon reception of this event, the nRF51 sends initial data to be populated in the characteristics of the App. The nRF51 keeps sending initial data to be populated until it receives the BLE_EVT_TX_COMPLETE event from the App (meaning the App has received the info sent by the nRF51). But, for some reason,(from the logs of the App), the App (tested with iOS) doesnot receive this initial data. If nRF51 sends out initial data continuously for 300 times in a row, then, the App receives the last 5 attempts(the 295 attempts are lost!). Instead of using the magic number 300, what is the proper way of populating the characteristics of the App upon reconnection? PS: If in the App, the connection is deliberately disconnected and reconnected, then, the App receives the initial data to be populated. The problem occurs only upon automatic reconnection.

Parents
  • The problem was in the iOS set up during automatic reconnection. This is because at reconnection the app takes a little of time to start receiving notification. It needs to perform the following sequential operations: connection->discover services->discover characteristics->subscribe notification. During this time, it has missed the initial reception from nRF51.

Reply
  • The problem was in the iOS set up during automatic reconnection. This is because at reconnection the app takes a little of time to start receiving notification. It needs to perform the following sequential operations: connection->discover services->discover characteristics->subscribe notification. During this time, it has missed the initial reception from nRF51.

Children
No Data
Related