Troubleshooting error logs in nrf52832 and Android app development

Hi,

I have developed a custom board using nrf52832 and an Android app that utilizes the Android-BLE-Library.
With the app, I am able to connect to two devices and collect data from them through notifications.

Information is on the below:

Device:

SDK:17.0.2
SEGGER Embeded studio

Android App:
https://github.com/NordicSemiconductor/Android-BLE-Library
Nokia 8.1 with OS android 11
Android Studio

In SDK 14.2, we used Peer Manager to handle passkey and bond events, but we faced issues when connecting to different types of cellphones.
So we removed Peer Manager in SDK 17.0.2 after verifying its functions by connecting to nRF Connect and Android-nRF-Toolbox.

When developing our Android app, we encountered the following error log and are having trouble debugging it.
Can you provide us with some advice?

2023-03-10 10:31:38.854  4746-4816  bt_btif                 com.android.bluetooth                E  bta_dm_acl_change new acl connetion:count = 1
2023-03-10 10:31:38.854  4746-4816  bt_stack                com.android.bluetooth                E  [ERROR:bta_gattc_cache.cc(733)] bta_gattc_cache_load: can't open GATT cache file /data/misc/bluetooth/gatt_cache_d9609ee94ca9 for reading, error: No such file or directory
2023-03-10 10:31:38.860  4556-4556  Developer               com.Android.offline.debug            E  onDeviceConnected
2023-03-10 10:31:38.861  4746-4746  BluetoothPhonePolicy    com.android.bluetooth                E  Received unexpected intent, action=android.bluetooth.device.action.ACL_CONNECTED
2023-03-10 10:31:39.155  4556-4556  Developer               com.Android.offline.debug            E  onBatchScanResults: 3
2023-03-10 10:31:39.161  4556-4556  Developer               com.Android.offline.debug            E  Manufacturer ID: 0
2023-03-10 10:31:39.164  4556-4556  Developer               com.Android.offline.debug            E  Manufacturer Data: [48, 49, 48, 48, 48, 54, 0]
2023-03-10 10:31:39.167  4556-4556  Developer               com.Android.offline.debug            E  Manufacturer Data (UTF-8): 010006??
2023-03-10 10:31:39.172  4556-4556  Developer               com.Android.offline.debug            E  D9:60:9E:E9:4C:A9
2023-03-10 10:31:39.544  4746-4787  bt_btif_gattc           com.android.bluetooth                E  btif_gattc_upstreams_evt: Unhandled event (8)!
2023-03-10 10:31:39.547  4556-4556  Developer               com.Android.offline.debug            E  onDeviceNotSupported
2023-03-10 10:31:39.548  4746-4816  bt_stack                com.android.bluetooth                E  [ERROR:bta_gattc_utils.cc(458)] bta_gattc_mark_bg_conn unable to find the bg connection mask for bd_addr=d9:60:9e:e9:4c:a9
2023-03-10 10:31:39.550  4556-4556  Developer               com.Android.offline.debug            E  onDeviceDisconnecting
2023-03-10 10:31:39.552  4556-4556  Developer               com.Android.offline.debug            E  onDeviceDisconnected
2023-03-10 10:31:40.674  4556-4556  Developer               com.Android.offline.debug            E  onBatchScanResults: 2
2023-03-10 10:31:40.888  4712-4712  STBMonitorReceiver      com.evenwell.stbmonitor              E  dropboxTag:data_app_wtf; dropboxTime:1678415499206
2023-03-10 10:31:41.022 17724-17724 HidlServiceManagement   pid-17724                            E  Service [email protected]::IQccsyshal/qccsyshal must be in VINTF manifest in order to register/get.
2023-03-10 10:31:41.022 17724-17724 qccsyshalservice        pid-17724                            E  [ERROR] registerAsService() failed with status: -2147483648
2023-03-10 10:31:26.567     0-0     BBox                    kernel                               E  :EHCS;51600:i:info_psy: B{id=194000 is=0 st=[Charging] ct=Fast l=59 ocv=3927252 v=3983388 c=-249999 r=201171 cc=4 13 26 38 42 42 37 25 :100% FV(BATT_PROFILE_VOTER)=4400000 FCC(BATT_PROFILE_VOTER)=3400000 stl=0 t=260(Good)} U{p=1 o=0/1 type=USB [Source attached (default current)] v=4589843 c=478867 USB_ICL(USB_PSY_VOTER)=500000} M{fv=4395000 cc=3400000 icl=3400000 t=337} S{} D{p=0 o=0 c_max=0}
2023-03-10 10:31:26.568     0-0     info_sts                kernel                               E  C{ 1006=03 1007=80 1009=79 100A=88 100B=96 100C=26 100D=70 100E=e4 1050=38 1051=02 1061=88 1070=79} O{ 1109=00 1152=00 1153=28} U{ 1306=01 1307=11 1308=01 1309=01 130B=80 130C=10 130D=80 130E=53 130F=08 1358=48 1359=73 135A=1b 1370=04} D{ 1406=00 1407=24 1408=01 1470=14} M{ 1606=02 1607=14 160A=40 160B=b5 1652=00}
2023-03-10 10:31:42.183  4556-4556  Developer               com.Android.offline.debug            E  onBatchScanResults: 3
2023-03-10 10:31:42.194  4556-4556  Developer               com.Android.offline.debug            E  Manufacturer ID: 0
2023-03-10 10:31:42.199  4556-4556  Developer               com.Android.offline.debug            E  Manufacturer Data: [48, 49, 48, 48, 48, 54, 0]
2023-03-10 10:31:42.204  4556-4556  Developer               com.Android.offline.debug            E  Manufacturer Data (UTF-8): 010006??
2023-03-10 10:31:42.214  4556-4556  Developer               com.Android.offline.debug            E  D9:60:9E:E9:4C:A9
2023-03-10 10:31:42.848  4556-4556  Developer               com.Android.offline.debug            E  onDeviceConnecting: 10
2023-03-10 10:31:43.266  4746-4816  bt_btif                 com.android.bluetooth                E  bta_dm_acl_change new acl connetion:count = 1

Parents
  • Hello,

    What errors are you referring to?

    In the log above I see 

    [ERROR:bta_gattc_cache.cc(733)] bta_gattc_cache_load: can't open GATT cache file /data/misc/bluetooth/gatt_cache_d9609ee94ca9 for reading, error: No such file or directory

    and

    [ERROR:bta_gattc_utils.cc(458)] bta_gattc_mark_bg_conn unable to find the bg connection mask for bd_addr=d9:60:9e:e9:4c:a9

    but they come from Android and it's hard to say why.

    What issue do you observe? Could you share the log you get from the BLE Library (override "log" method and print logs created).

    If you weer using bonding before, and removed at some point, did you remember to "Forget" the devices in Bluetooth Settings?

  • Thanks for your help.

    What errors are you referring to?
    In the log above I see but they come from Android and it's hard to say why.

    I want to solve the connection error between the device, but I don't have a normal connection flow log to reference.

    Is there a good example for non-bonded BLE communication between a device and Android?

    What issue do you observe?
    it seems go into the onDeviceNotSupported and then disconnect the device from android app.

    This time I add a error log in connect function that return error is -2, 

    int REASON_DEVICE_NOT_SUPPORTED = -2;

    What does the error code mean?


    			for (BluetoothDevice device : Application.getScanResults()) {
    				if (device.getAddress().equalsIgnoreCase(mMAC) && mBluetoothDevice == null) {
    					mBluetoothDevice = device;
    					new Handler().postDelayed(
    							() -> mBleManager.connect(device)
    									.useAutoConnect(shouldAutoConnect())
    									.timeout(3500)
    									.fail((request, status) -> {
    										Log.e(TAG, "connect failed with status: " + status);
    									})
    									.enqueue(), 500);
    					break;
    				}
    			}


    2023-03-13 18:13:20.166  3877-3932  bt_stack                com.android.bluetooth                E  [ERROR:bta_gattc_utils.cc(458)] bta_gattc_mark_bg_conn unable to find the bg connection mask for bd_addr=d9:60:9e:e9:4c:a9
    2023-03-13 18:13:20.167 15537-15537 Developer               com.conzian.kneesup.offline.debug    E  onDeviceDisconnecting
    2023-03-13 18:13:20.170 15537-15537 Developer               com.conzian.kneesup.offline.debug    E  onDeviceDisconnected
    2023-03-13 18:13:20.175 15537-15537 BleProfileService       com.conzian.kneesup.offline.debug    E  connect failed with status: -2
    2023-03-13 18:13:19.821     0-0     BBox                    kernel                               E  :EHCS;51600:i:info_psy: B{id=196000 is=0 st=[Charging] ct=Fast l=79 ocv=4098639 v=4136219 c=-165527 r=217528 cc=0 1 3 6 6 8 5 2 :100% FV(BATT_PROFILE_VOTER)=4400000 FCC(BATT_PROFILE_VOTER)=3400000 stl=0 t=280(Good)} U{p=1 o=0/1 type=USB [Source attached (default current)] v=4707031 c=478867 USB_ICL(USB_PSY_VOTER)=500000} M{fv=4395000 cc=3400000 icl=3400000 t=361} S{} D{p=0 o=0 c_max=0}
    2023-03-13 18:13:19.822     0-0     info_sts                kernel                               E  C{ 1006=03 1007=80 1009=79 100A=88 100B=96 100C=26 100D=70 100E=e4 1050=38 1051=02 1061=88 1070=79} O{ 1109=00 1152=00 1153=28} U{ 1306=01 1307=11 1308=01 1309=01 130B=80 130C=10 130D=80 130E=53 130F=08 1358=48 1359=73 135A=1b 1370=04} D{ 1406=00 1407=24 1408=01 1470=14} M{ 1606=02 1607=14 160A=40 160B=b5 1652=00}
    2023-03-13 18:13:21.495 15537-15537 Developer               com.conzian.kneesup.offline.debug    E  onBatchScanResults: 8
    2023-03-13 18:13:21.505 15537-15537 Developer               com.conzian.kneesup.offline.debug    E  D9:60:9E:E9:4C:A9
    2023-03-13 18:13:22.184 15537-15537 Developer               com.conzian.kneesup.offline.debug    E  onDeviceConnecting: 10
    2023-03-13 18:13:22.240 22539-22539 HidlServiceManagement   pid-22539                            E  Service [email protected]::IQccsyshal/qccsyshal must be in VINTF manifest in order to register/get.
    2023-03-13 18:13:22.240 22539-22539 qccsyshalservice        pid-22539                            E  [ERROR] registerAsService() failed with status: -2147483648


    Could you share the log you get from the BLE Library (override "log" method and print logs created).
    Thank you for advising the method to log, but I don't know how to do that. Can you give me some examples? Or I can email you the code so that you can have a clearer understanding of the error.

    If you weer using bonding before, and removed at some point, did you remember to "Forget" the devices in Bluetooth Settings?
    Yes, I have forget the device in the setting of android.

  • After checking the BASE_UUID and UUID of the CHARACTERISTIC and SERVICE on the custom board, I found that some numbers were different from what I had set in Android.Then fix the problem.

Reply Children
No Data
Related