Hello,
i have the following setup: nrf52 as peripheral, smartphone as central. Peripheral's purpose is to be an interface between appliance and smartphone. It has no pairing/bonding feature and it advertises with 22ms interval and public static address.
While iOS always performs connection in about 200ms, Android is very inconsistent. Sometimes it connects as fast as iOS, but most of the times it takes 4-5 seconds to get connected.
The peripheral has no low power restriction so it is setup to perform at its maximum, with connection interval, slave latency and supervisor timeout configured as low as possible, as defined in iOS Design Guidelines.
I have tried to analyze sniffer trace but there is no suitable information, the delay is seen between the connect action on Android, and the CONNECT_REQ on the sniffer.
I moved to HCI dump on Android side and i could see the delay, which looks like this:
No. Time Prot. Len Info
38272 1511777537.552557 HCI_CMD 29 Sent LE Create Connection
38273 1511777537.556675 HCI_EVT 7 Rcvd Command Status (LE Create Connection)
38274 1511777537.591402 HCI_EVT 22 Rcvd LE Meta (LE Connection Complete) //300ms, GOOD!
...
...
74093 1511781742.368168 HCI_CMD 29 Sent LE Create Connection
74094 1511781742.371541 HCI_EVT 7 Rcvd Command Status (LE Create Connection)
74095 1511781746.930870 HCI_EVT 22 Rcvd LE Meta (LE Connection Complete) //4.5s, BAD!
It can be seen that between frame 38273 and 38274 the delay is 0.3 seconds, while between 74093 and 74094 there is a 4.5 seconds time delay.
Android is connecting with autoConnect=false, so no backgound connection is performed.
This is the nordic sniffer trace, on a long connection delay case:
5430 49.623224000 Test_device <broadcast> 54 ADV_IND
5431 49.692073000 Test_device <broadcast> 54 ADV_IND
5432 49.698782000 6a:15:34:0b:f7:e0 dc:2c:8c:aa:c3:f7 60 CONNECT_REQ
5433 49.704162000 Master Slave 26 Empty Data PDU
5434 49.708205000 Slave Master 26 Empty Data PDU
5435 49.712125000 Master Slave 35 LL Control PDU: LL_FEATURE_REQ
5436 49.743382000 Master Slave 35 LL Control PDU: LL_FEATURE_REQ
Between the last ADV packet (5431) and the CONNECT_REQ (5432) there is only a 6ms delay, which should mean that the delay is all at the Android side.
Can anyone explain why is this happening? Is there any margin of improvement?
Thank you