Tool/software: Linux
Team,
One my customers facing the delayed Advertisement after continuous testing(around 20secs delay) . Following are the details:
Please find observations below, regarding an issue "Ble advertising is getting delayed when continuously tested with remote BLE device(ios, android mobile phones)"
SDK: -TI Blutopia version:- 4.0.1.4.2
Hardware Module used:- TI WiLink(wifi+bt)
Driver:-BTWLINK
Remote Ble Devices:- Elika application on mobile phone(ios, android)
Application used from Device:- SmartAccessControl (based on sample app given with Blutopia SDK(LinuxGatm_SRV.c))
Use case:-
1. Device initializes Blutopia stack, as well platform manager(SS1BTPM).
API CALL:-
BTPM_Initialize((unsigned long)getpid(), NULL, ServerUnRegistrationCallback, NULL);
DEVM_RegisterEventCallback(DEVM_Event_Callback, NULL));
LOG:-
Initializing the Elika Bluetopia
BTPM_Initialize() Success: 0.
DEVM_RegisterEventCallback() Success: 5.
BT COMM PORT (/dev/ttymxc2): 1
Changing HCI baud rate to 3000000
Status: Executing BTS Script /lib/firmware/TIInit_11.8.32.bts.
Status: BTS Script successfully executed.
DEVM_PowerOnDevice() Success: 0.
2. The device starts advertising with device capabilities, services and mac-address associated with the device.
API CALL:- DEVM_UpdateLocalDeviceProperties(DEVM_UPDATE_LOCAL_DEVICE_PROPERTIES_DISCOVERABLE_MODE, &LocalDeviceProperties));
-GET LOCAL PROPERTIES:-
DEVM_QueryLocalDeviceProperties(&LocalDeviceProperties));
-REgister Call Back:-
GATM_RegisterEventCallback(GATM_Event_Callback, NULL));
DEVM_StartAdvertising(&AdvertisingInfo));
LOG:-
Attempting to set Discoverability Mode: General.
DEVM_UpdateLocalDeviceProperties() Success: 0.
Local Device Properties Changed.
Disc. Mode: TRUE , 0x00000001
DEVM_QueryLocalDeviceProperties() Success: 0.
GATM_RegisterEventCallback() Success: 1.
DEVM_UpdateLocalDeviceProperties() Success: 0.
3. The remote device (mobile phone) discovers advertisement from the device, matches preconfigured mac, and connects over BLE.
Remote Device Found.
BD_ADDR: 527970E4648F
Address Type: Resolvable Random Address.
Device Name:
LE Type: Single Mode
Device Flags: 0x40008000
LE RSSI: 0
LE Paired State : FALSE
LE Connect State: TRUE
LE Encrypt State: FALSE
GATT Services Known: FALSE
Remote Device Properties Changed.
BD_ADDR: 527970E4648F
Address Type: Resolvable Random Address.
LE Type: Single Mode
Device Flags: 0x40008000
LE Connect State: TRUE
GATM_Event_Callback:
GATT Connection Event
Ble Internal MEssage Received
->Remote Device is Connected Now
WORKING CASE
7. Device initiates disconnection with the remote device. As soon as the disconnection device starts advertising again.
API:-DEVM_DisconnectRemoteDevice(BD_ADDR, DisconnectFlags));
LOG:-
Disconnecting the Device
Attempting to Disconnect Remote Device.
DEVM_DisconnectRemoteDevice() Success: 0.
Connection Type: LE
Remote Address: 4D89A568183B
Local Device Properties Changed.
Device Flags: 0x80000000
LE Scan Mode: FALSE, 0x00000000
LE Adv Mode: FALSE, 0x00000000
LE Slv Mode: Not in Slave Mode
Remote Device Properties Changed.
BD_ADDR: 4D89A568183B
Address Type: Resolvable Random Address.
LE Type: Single Mode
Device Flags: 0x40000000
LE Connect State: FALSE
Ble Internal MEssage Received
-> Remote Device Disconnected
Local Device Properties Changed.
Device Flags: 0xC0020000
LE Scan Mode: FALSE, 0x00000000
LE Adv Mode: TRUE, 0x000927C0
LE Slv Mode: In Slave Mode
LE Advertising Started.
DEVM_StartAdvertising() Success: Duration 600000 seconds.
NON Working Case:-
BLE advertising is getting delayed (20 secs).
2018-02-26 19:19:18] GATM_Event_Callback:
[2018-02-26 19:19:18] Connection Type: LE
[2018-02-26 19:19:18] Remote Address: 43CD31D7F59E
[2018-02-26 19:19:18] New MTU: 100
[2018-02-26 19:19:18] Disconnecting the Device
[2018-02-26 19:19:18] Attempting to Disconnect Remote Device: .
[2018-02-26 19:19:18] DEVM_DisconnectRemoteDevice() Success: 0.
2018-02-26 19:19:38] Local Device Properties Changed.
[2018-02-26 19:19:38] Device Flags: 0x80000000
[2018-02-26 19:19:38] LE Scan Mode: FALSE, 0x00000000
[2018-02-26 19:19:38] LE Adv Mode: FALSE, 0x00000000
[2018-02-26 19:19:38] LE Slv Mode: Not in Slave Mode
[2018-02-26 19:19:38]
[2018-02-26 19:19:38] Remote Device Properties Changed.
[2018-02-26 19:19:38] BD_ADDR: 43CD31D7F59E
[2018-02-26 19:19:38] Address Type: Resolvable Random Address.
[2018-02-26 19:19:38] LE Type: Single Mode
[2018-02-26 19:19:38] Device Flags: 0x40000000
[2018-02-26 19:19:38] LE Connect State: FALSE
[2018-02-26 19:19:38] Ble Internal MEssage Received
[2018-02-26 19:19:38] -> Remote Device Disconnected
[2018-02-26 19:19:38] DEVM_StartAdvertising() Success: Duration 600000 seconds.
[2018-02-26 19:19:38] ->Device Started Advertising Again.
More information/observations:
- The issue observed with both Android and iPhone, but more frequent and re-creatable in Android.
- Mobile phones used Moto g4 with Android 6 (Marshmellow), and Moto g5 plus with Android 7 (Nougat).
-The disconnect event we are initiating from the target (BLE device), not from the smartphone
Attaching the BT logs as well.
Can you please help on this/suggest to avoid this delay ?
Best Regards,
Shiv