Android Question B4A BLE app works with Samsung phones but timesout with LG SP320

Alfonso Hermida

Member
Licensed User
I have a BLE app in B4A that works well with a few different Samsung phones. The app connects with BLE to an NRF52832 board (BLEUart code from Adafruit). All the Samsungs connect and work well, the LG SP320 connects to the board and maybe 5 to 6 seconds later it disconnects. The reason is "BLE_HCI_CONNECTION_TIMEOUT". I really don't know where to start debugging. Is it on the app side? Is there a setting on the LG SP320 I should be aware of?

Basically looking for pointers on where to start.

Thanks!
 

f0raster0

Well-Known Member
Licensed User
Longtime User
I have a BLE app in B4A that works well with a few different Samsung phones. The app connects with BLE to an NRF52832 board (BLEUart code from Adafruit). All the Samsungs connect and work well, the LG SP320 connects to the board and maybe 5 to 6 seconds later it disconnects. The reason is "BLE_HCI_CONNECTION_TIMEOUT". I really don't know where to start debugging. Is it on the app side? Is there a setting on the LG SP320 I should be aware of?

Basically looking for pointers on where to start.

Thanks!
Wich board are you using to run the tests?

Do you need to keep connected the Microcontroller nRF52832 all the time to your smartphone?
if yes, you can you try to keep the screen on to see what happen
 
Upvote 0

Alfonso Hermida

Member
Licensed User
I'm using the Adafruit NRF52832 and the 840 feather boards. Same thing happens in both. The time between the 1st moment they connect and disconnect is 5 to 6 seconds more or less. With the Samsung phones I can stay connected to the boards indefinitely.

Which screen? the phone's?
 
Upvote 0

f0raster0

Well-Known Member
Licensed User
Longtime User
yes, Smartphone's screen.

I don't have any LG phone to tests here.. probably that Smartphone try to go to sleep and disconnect the communication,
maybe?

Edit:
One idea:
Use the App of Nordic Semiconductor to test the connection between your Smartphone LG and the module Feather.
 
Upvote 0

Alfonso Hermida

Member
Licensed User
I used nRF Connect and connected the LG phone to the board with BLE. Here's the log from nRF Connect:

B4X:
nRF Connect, 2020-12-06
WarmB (C6:E7:27:27:BB:AD)
D    18:54:51.041    gatt.close()
D    18:54:51.043    wait(200)
V    18:54:51.244    Connecting to C6:E7:27:27:BB:AD...
D    18:54:51.245    gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE)
D    18:54:52.172    [Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED
D    18:54:52.209    [Callback] Connection state changed with status: 0 and new state: CONNECTED (2)
I    18:54:52.209    Connected to C6:E7:27:27:BB:AD
V    18:54:52.249    Discovering services...
D    18:54:52.249    gatt.discoverServices()
D    18:54:52.260    [Callback] Services discovered with status: 0
I    18:54:52.260    Services discovered
V    18:54:52.328    Generic Access (0x1800)
- Device Name [R W] (0x2A00)
- Appearance [R] (0x2A01)
- Peripheral Preferred Connection Parameters [R] (0x2A04)
- Central Address Resolution [R] (0x2AA6)
Generic Attribute (0x1801)
- Service Changed [I] (0x2A05)
   Client Characteristic Configuration (0x2902)
Device Firmware Update Service (00001530-1212-efde-1523-785feabcd123)
- DFU Packet [WNR] (00001532-1212-efde-1523-785feabcd123)
- DFU Control Point [N W] (00001531-1212-efde-1523-785feabcd123)
   Client Characteristic Configuration (0x2902)
- DFU Version [R] (00001534-1212-efde-1523-785feabcd123)
Device Information (0x180A)
- Model Number String [R] (0x2A24)
- Serial Number String [R] (0x2A25)
- Firmware Revision String [R] (0x2A26)
- Software Revision String [R] (0x2A28)
- Manufacturer Name String [R] (0x2A29)
Nordic UART Service (6e400001-b5a3-f393-e0a9-e50e24dcca9e)
- TX Characteristic [N] (6e400003-b5a3-f393-e0a9-e50e24dcca9e)
   Client Characteristic Configuration (0x2902)
   Characteristic User Description (0x2901)
- RX Characteristic [W WNR] (6e400002-b5a3-f393-e0a9-e50e24dcca9e)
   Characteristic User Description (0x2901)
Battery Service (0x180F)
- Battery Level [N R] (0x2A19)
   Client Characteristic Configuration (0x2902)
D    18:54:52.329    gatt.setCharacteristicNotification(00002a05-0000-1000-8000-00805f9b34fb, true)
D    18:54:52.336    gatt.setCharacteristicNotification(6e400003-b5a3-f393-e0a9-e50e24dcca9e, true)
D    18:54:52.339    gatt.setCharacteristicNotification(00002a19-0000-1000-8000-00805f9b34fb, true)
D    18:54:55.553    [Callback] Connection state changed with status: 8 and new state: DISCONNECTED (0)
E    18:54:55.554    Error 8 (0x8): GATT CONN TIMEOUT
I    18:54:55.554    Disconnected
D    18:54:55.576    [Broadcast] Action received: android.bluetooth.device.action.ACL_DISCONNECTED

Its all good and all the sudden it disconnects. I'll check the phone's sleep settings etc now.
 
Upvote 0

f0raster0

Well-Known Member
Licensed User
Longtime User
I used nRF Connect and connected the LG phone to the board with BLE. Here's the log from nRF Connect:

B4X:
nRF Connect, 2020-12-06
WarmB (C6:E7:27:27:BB:AD)
D    18:54:51.041    gatt.close()
D    18:54:51.043    wait(200)
V    18:54:51.244    Connecting to C6:E7:27:27:BB:AD...
D    18:54:51.245    gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE)
D    18:54:52.172    [Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED
D    18:54:52.209    [Callback] Connection state changed with status: 0 and new state: CONNECTED (2)
I    18:54:52.209    Connected to C6:E7:27:27:BB:AD
V    18:54:52.249    Discovering services...
D    18:54:52.249    gatt.discoverServices()
D    18:54:52.260    [Callback] Services discovered with status: 0
I    18:54:52.260    Services discovered
V    18:54:52.328    Generic Access (0x1800)
- Device Name [R W] (0x2A00)
- Appearance [R] (0x2A01)
- Peripheral Preferred Connection Parameters [R] (0x2A04)
- Central Address Resolution [R] (0x2AA6)
Generic Attribute (0x1801)
- Service Changed [I] (0x2A05)
   Client Characteristic Configuration (0x2902)
Device Firmware Update Service (00001530-1212-efde-1523-785feabcd123)
- DFU Packet [WNR] (00001532-1212-efde-1523-785feabcd123)
- DFU Control Point [N W] (00001531-1212-efde-1523-785feabcd123)
   Client Characteristic Configuration (0x2902)
- DFU Version [R] (00001534-1212-efde-1523-785feabcd123)
Device Information (0x180A)
- Model Number String [R] (0x2A24)
- Serial Number String [R] (0x2A25)
- Firmware Revision String [R] (0x2A26)
- Software Revision String [R] (0x2A28)
- Manufacturer Name String [R] (0x2A29)
Nordic UART Service (6e400001-b5a3-f393-e0a9-e50e24dcca9e)
- TX Characteristic [N] (6e400003-b5a3-f393-e0a9-e50e24dcca9e)
   Client Characteristic Configuration (0x2902)
   Characteristic User Description (0x2901)
- RX Characteristic [W WNR] (6e400002-b5a3-f393-e0a9-e50e24dcca9e)
   Characteristic User Description (0x2901)
Battery Service (0x180F)
- Battery Level [N R] (0x2A19)
   Client Characteristic Configuration (0x2902)
D    18:54:52.329    gatt.setCharacteristicNotification(00002a05-0000-1000-8000-00805f9b34fb, true)
D    18:54:52.336    gatt.setCharacteristicNotification(6e400003-b5a3-f393-e0a9-e50e24dcca9e, true)
D    18:54:52.339    gatt.setCharacteristicNotification(00002a19-0000-1000-8000-00805f9b34fb, true)
D    18:54:55.553    [Callback] Connection state changed with status: 8 and new state: DISCONNECTED (0)
E    18:54:55.554    Error 8 (0x8): GATT CONN TIMEOUT
I    18:54:55.554    Disconnected
D    18:54:55.576    [Broadcast] Action received: android.bluetooth.device.action.ACL_DISCONNECTED

Its all good and all the sudden it disconnects. I'll check the phone's sleep settings etc now.

The App also disconnect when the screen is on using nRF-App?
Check if that LG phone is running is safe-battery mode or something like taht?
 
Upvote 0

Alfonso Hermida

Member
Licensed User
The App also disconnect when the screen is on using nRF-App?

Yes, you can see it in the log at the end (starting on line 45 o the log). I guess its not the App since I'm using the nRF Connect and its behaving the same as the App I did in B4A. They both connect and a few seconds later disconnect. I'm looking at the phone's settings but can't find something that might help.
 
Upvote 0
Top