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

NRF52 Running S132V3.0 Soft Device as a Central can't maintain a connection with a Samsung Galaxy S7 peripheral

Hardware: I have an nRF52 device running the S132 running as a Central. I have 6 iOS/Android devices running as peripherals.

Background: I am attempting to have my central device maintain a connection with a variety of devices. My phone app is running the Uart Service following the Nordic Uart Service example. I've extended the UART Central Service on my hardware to accept multiple concurrent UART channels.

I am successfully able to connect and maintain a connections with: Samsung Galaxy S6, Note5 (devices running Android 6.0.1) iPhone 5S, iPhone6, and iPhone7 Nexus/Pixel running Android 7.1.1

I am, however, having trouble maintaining a connection with anything that is running Android 7.0.

Question: On the Galaxy S7 (Android 7.0) I'm seeing that a valid Bluetooth connection is established, my UART service discovery is successful (I get valid looking UART handles), and before I'm able to send anything to the phone the connection is dropped. This issue seems to affect the Android 7.0 phone I have for testing, but I'm not sure if it is an issue with Android 7.0 specifically or it is an issue with my Central code.

In the Multi-Connection Central example the Central continues to scan for peripherals after the first connection is made. During the Scanning window I'm seeing that no other Central bluetooth actions can take place. Is it possible that if my peripheral device has a 20 ms connection interval but my scan window is 200 ms that my peripherals would be disconnected during my scan window, since I could miss 10 connection intervals? Does the Soft Device have a way to guard against this?

For reference, this is how I have my scanning and connection intervals setup for my Central device.

SCAN_INTERVAL_SLOW             MSEC_TO_UNITS(2000, UNIT_0_625_MS) 
SCAN_WINDOW_SLOW               MSEC_TO_UNITS(200, UNIT_0_625_MS) 
SCAN_TIMEOUT_SLOW              MSEC_TO_UNITS(0, UNIT_0_625_MS)  

MIN_CONNECTION_INTERVAL   MSEC_TO_UNITS(7.5, UNIT_1_25_MS)  
MAX_CONNECTION_INTERVAL   MSEC_TO_UNITS(100, UNIT_1_25_MS) 
SLAVE_LATENCY             4  
SUPERVISION_TIMEOUT       MSEC_TO_UNITS(6000, UNIT_10_MS) 
  • Yes I have written my own application to act as a Peripheral. My Nordic device is a Central maintaining 6 concurrent UART connections. I'm experiencing the same issue: it will connect, I can send/receive data via UART from the phone to the Nordic device for 15-30 seconds and eventually I stop receiving data and the connection times out (with BLE_HCI_CONNECTION_TIMEOUT). I'm also getting 0x13 as the Disconnect Reason (USER TERMINATED), but my Peripheral application isn't issuing any disconnect commands. I'm stepping through WireShark of the btsnoop_hci log files generated by my Android device but I haven't seen anything obvious. I get a write request from my remote device (Nordic Hardware) and my phone (Device_4) and then the host commands the controller to disconnect.

    1296	220.326488	remote ()	localhost (DEVICE_4)	ATT	14	Rcvd Write Request, Handle: 0x002b (Unknown: Nordic UART Rx: Client Characteristic Configuration)
    
    1297	220.331496	host	controller	HCI_CMD	7	Sent Disconnect
    
  • Could you test with SLAVE_LATENCY set to 0? Slave latency is typically used to save power on the peripheral device, but I don't think this will have a large impact on the phone battery life. I tested without slave latency, and is able to keep a connection with these settings. There might be a bug in Android 7.0, not implementing slave latency correctly. Do you know if there is any API in Android to set this manually?

  • I will try the slave latency set to 0 on the central side. On the phone side there is no API in the Cordova Plugin I'm using to set any connection parameters, so setting any sort of preference is out of the question. The "peripheral mode" on Android/ iOS seems to be lacking some pretty basic features IMO.

  • Progress (maybe...)! I made the Slave Latency '0' and my Nexus 5X running Android 7.0 can connect!! Interestingly enough every 30 seconds (30 seconds exactly, +/- 100 ms) the phone disconnects. It takes about 5 seconds for the phone to go through the reconnect process, but it does reconnect and is able to send/receive commands. However, this did nothing to correct the Galaxy S7 running Android 7.0 issue. The Galaxy S7 connects, my hardware goes through service discovery of the phone, it finds the UART service, and then the phone writes some data to the UART characteristics (as it normally does), and immediately disconnects. I'm having a harder time stopwatching how long it is connected because it disconnects so quickly. Suffice it to say it doesn't stay connected long enough to do anything useful.

  • That's strange. Could you send me your application so I can test with my phone? I'm able to connect and keep the connection indefinetly with SLAVE_LATENCY set to 0. Does this only happen if you have multiple peripherals connected or do scanning in background when connecting?

Related