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

nRF52 Ble Peripheral Example - ble_app_blinky not showing led/button service

Hi I have run a few peripheral examples ok and now move to evaluation of ble_peripheral also.

I'm using this version of the SDK....

If I program the softdevice and then the application hex file into board using the files shown below the led 1 turns on as expected. 

Using rfConnect I can connect to "Nordic Blinky" and the led 2 turns on and led 1 turns off. However in the list of services I see there is not one showing for the Led/Button.

Using the blinky app for Android to connect I get a message indicating the "Device does not have the required services".

I checked the code in sdk_config.h to see if the service was enabled and this looks ok...

Looking at the help for the application at this link http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk%2Fdita%2Fsdk%2Fnrf5_sdk.html

I think I have done things correctly so I am now looking for some ideas/support to move forward please.

Regards MPH

Parents
  • Hi Martin

    It's quite peculiar that the example advertises and connects, but doesn't show the normal services. 

    Which services do you see when you connect through nRF Connect?

    Are you using nRF Connect for Android, iOS or desktop?

    Can you let me know which model and version of the kit you have, as printed on the white sticker?

    How are you flashing the kit? 
    Are you using nrfjprog, or one of the supported IDE's?

    Best regards
    Torbjørn

  • Hi Torbjørn

    I see these services using nRF Connect for Android..

    Generic Access, Generic Attribute, Blood pressure, Battery Service, Device Information.

    White sticker shows..

    PCA10040

    1.2.4

    2018.12

    682351679

    Flashing the kit by dragging and dropping the hex files onto the on-board drive.

    Also have Segger IDE installed and can build & program the project ok from there also.

    BR MPH

  • Hi Martin

    I can report the issue to our app developers and see if they have some input. 

    Can you check what Android version the phone is running?

    I am using the app on a number of Android devices without any issues, but we mostly test the app on high end devices like the Nexus phones, Samsung Galaxy S phones and similar. 

    Best regards
    Torbjørn

  • Hi Torbjørn

    The Phone has Android 8.0.0 loaded.

    I also downloaded Blinky app from GitHub and it compiles ok but when i get to debug on my phone the App closes shortly after attemtping to run.

    The reason for wanting to use this more simplistic App and embedded project is to use it as a basis for modification with out too many variables etc.

    BR Martin and thanks

  • Hi Martin

    One thing we could try is to change the BLE address, and see if it improves the situation. Some phones could have issues reconnecting to a device with the same BLE address if the services change. 

    To try this out please add the following code to the gap_params_init() function of the blinky example:

    ble_gap_addr_t ble_address = {.addr_type = BLE_GAP_ADDR_TYPE_RANDOM_STATIC,
                                                      .addr_id_peer = 0,
                                                      .addr = {0xC3,0x11,0x22,0x33,0x44,0xFF}};
    err_code = sd_ble_gap_addr_set(&ble_address);
    APP_ERROR_CHECK(err_code);

    Best regards
    Torbjørn

  • Hi Torbjørn

    That is a positive change as the Blinky App now discovers the services ok, thank you very much. I can see the change of button state but if I toggle the LED using the App it has only worked once. Meaning repeated toggling has no effect and the LED is Off.

    If I use nrf Connect to toggle the LED that appears to work along with reading the button state.

    BR Martin

  • Hi Martin

    It is good to hear that you have had some progress. 

    Are you running the Blinky App in the Android debugger?

    It would be interesting to see the ADB log when you are trying to toggle the LED, to see if it has any information that might be related to the issue. 

    Best regards
    Torbjørn

Reply Children
  • Hi Torbjørn

    I tried a couple of Android projects, the Thingy 52 and the Blinky Apps. Using Android Studio, Thingy runs in debug mode using my phone but Blinky does not. It starts but immediately thereafter the app closes on the phone. I have not investigated why as yet.

    Best Regards Martin

  • Hi Martin

    Thanks for the update. 

    If you capture the ADB log when the Blinky app crashes I can show it to the app developers, and they might have some input. 

    Best regards
    Torbjørn

  • Ok this is what I get in the adb log when trying to run Blinky App on my phone......


    10/01 13:27:58: Launching app
    $ adb install-multiple -r -t C:\Users\Martin\Documents\GitHub\Android-nRF-Blinky\app\build\intermediates\split-apk\debug\slices\slice_4.apk C:\Users\Martin\Documents\GitHub\Android-nRF-Blinky\app\build\intermediates\resources\instant-run\debug\resources-debug.apk C:\Users\Martin\Documents\GitHub\Android-nRF-Blinky\app\build\intermediates\split-apk\debug\slices\slice_5.apk C:\Users\Martin\Documents\GitHub\Android-nRF-Blinky\app\build\intermediates\split-apk\debug\slices\slice_3.apk C:\Users\Martin\Documents\GitHub\Android-nRF-Blinky\app\build\intermediates\split-apk\debug\slices\slice_0.apk C:\Users\Martin\Documents\GitHub\Android-nRF-Blinky\app\build\intermediates\split-apk\debug\slices\slice_1.apk C:\Users\Martin\Documents\GitHub\Android-nRF-Blinky\app\build\intermediates\split-apk\debug\slices\slice_2.apk C:\Users\Martin\Documents\GitHub\Android-nRF-Blinky\app\build\intermediates\split-apk\debug\slices\slice_7.apk C:\Users\Martin\Documents\GitHub\Android-nRF-Blinky\app\build\intermediates\split-apk\debug\dep\dependencies.apk C:\Users\Martin\Documents\GitHub\Android-nRF-Blinky\app\build\intermediates\split-apk\debug\slices\slice_6.apk C:\Users\Martin\Documents\GitHub\Android-nRF-Blinky\app\build\intermediates\split-apk\debug\slices\slice_8.apk C:\Users\Martin\Documents\GitHub\Android-nRF-Blinky\app\build\intermediates\split-apk\debug\slices\slice_9.apk C:\Users\Martin\Documents\GitHub\Android-nRF-Blinky\app\build\intermediates\instant-run-apk\debug\app-debug.apk
    Split APKs installed
    $ adb shell am start -n "no.nordicsemi.android.nrfblinky/no.nordicsemi.android.blinky.SplashScreenActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -D
    Waiting for application to come online: no.nordicsemi.android.nrfblinky | no.nordicsemi.android.nrfblinky.test
    Waiting for application to come online: no.nordicsemi.android.nrfblinky | no.nordicsemi.android.nrfblinky.test
    Connecting to no.nordicsemi.android.nrfblinky
    Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.
    W/ActivityThread: Application no.nordicsemi.android.nrfblinky is waiting for the debugger on port 8100...
    I/System.out: Sending WAIT chunk
    I/zygote64: Debugger is active
    I/System.out: Debugger has connected
    waiting for debugger to settle...
    I/System.out: waiting for debugger to settle...
    I/System.out: waiting for debugger to settle...
    Connected to the target VM, address: 'localhost:8601', transport: 'socket'
    I/System.out: waiting for debugger to settle...
    I/System.out: waiting for debugger to settle...
    I/System.out: waiting for debugger to settle...
    I/System.out: debugger has settled (1356)
    I/zygote64: no shared libraies, dex_files: 1
    I/InstantRun: starting instant run server: is main process
    D/AndroidRuntime: Shutting down VM
    E/AndroidRuntime: FATAL EXCEPTION: main
    Process: no.nordicsemi.android.nrfblinky, PID: 26198
    java.lang.RuntimeException: Unable to get provider android.arch.lifecycle.ProcessLifecycleOwnerInitializer: java.lang.ClassNotFoundException: Didn't find class "android.arch.lifecycle.ProcessLifecycleOwnerInitializer" on path: DexPathList[[zip file "/data/app/no.nordicsemi.android.nrfblinky-Abaq71A2nyPIFytIPBL22w==/base.apk", zip file "/data/app/no.nordicsemi.android.nrfblinky-Abaq71A2nyPIFytIPBL22w==/split_lib_dependencies_apk.apk", zip file "/data/app/no.nordicsemi.android.nrfblinky-Abaq71A2nyPIFytIPBL22w==/split_lib_resources_apk.apk", zip file "/data/app/no.nordicsemi.android.nrfblinky-Abaq71A2nyPIFytIPBL22w==/split_lib_slice_0_apk.apk", zip file "/data/app/no.nordicsemi.android.nrfblinky-Abaq71A2nyPIFytIPBL22w==/split_lib_slice_1_apk.apk", zip file "/data/app/no.nordicsemi.android.nrfblinky-Abaq71A2nyPIFytIPBL22w==/split_lib_slice_2_apk.apk", zip file "/data/app/no.nordicsemi.android.nrfblinky-Abaq71A2nyPIFytIPBL22w==/split_lib_slice_3_apk.apk", zip file "/data/app/no.nordicsemi.android.nrfblinky-Abaq71A2nyPIFytIPBL22w==/split_lib_slice_4_apk.apk", zip file "/data/app/no.nordicsemi.android.nrfblinky-Abaq71A2nyPIFytIPBL22w==/split_lib_slice_5_apk.apk", zip file "/data/app/no.nordicsemi.android.nrfblinky-Abaq71A2nyPIFytIPBL22w==/split_lib_slice_6_apk.apk", zip file "/data/app/no.nordicsemi.android.nrfblinky-Abaq71A2nyPIFytIPBL22w==/split_lib_slice_7_apk.apk", zip file "/data/app/no.nordicsemi.android.nrfblinky-Abaq71A2nyPIFytIPBL22w==/split_lib_slice_8_apk.apk", zip file "/data/app/no.nordicsemi.android.nrfblinky-Abaq71A2nyPIFytIPBL22w==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/no.nordicsemi.android.nrfblinky-Abaq71A2nyPIFytIPBL22w==/lib/arm64, /system/lib64, /system/vendor/lib64]]
    at android.app.ActivityThread.installProvider(ActivityThread.java:6581)
    at android.app.ActivityThread.installContentProviders(ActivityThread.java:6133)
    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6043)
    at android.app.ActivityThread.-wrap1(Unknown Source:0)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1764)
    at android.os.Handler.dispatchMessage(Handler.java:105)
    at android.os.Looper.loop(Looper.java:164)
    at android.app.ActivityThread.main(ActivityThread.java:6944)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
    E/AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "android.arch.lifecycle.ProcessLifecycleOwnerInitializer" on path: DexPathList[[zip file "/data/app/no.nordicsemi.android.nrfblinky-Abaq71A2nyPIFytIPBL22w==/base.apk", zip file "/data/app/no.nordicsemi.android.nrfblinky-Abaq71A2nyPIFytIPBL22w==/split_lib_dependencies_apk.apk", zip file "/data/app/no.nordicsemi.android.nrfblinky-Abaq71A2nyPIFytIPBL22w==/split_lib_resources_apk.apk", zip file "/data/app/no.nordicsemi.android.nrfblinky-Abaq71A2nyPIFytIPBL22w==/split_lib_slice_0_apk.apk", zip file "/data/app/no.nordicsemi.android.nrfblinky-Abaq71A2nyPIFytIPBL22w==/split_lib_slice_1_apk.apk", zip file "/data/app/no.nordicsemi.android.nrfblinky-Abaq71A2nyPIFytIPBL22w==/split_lib_slice_2_apk.apk", zip file "/data/app/no.nordicsemi.android.nrfblinky-Abaq71A2nyPIFytIPBL22w==/split_lib_slice_3_apk.apk", zip file "/data/app/no.nordicsemi.android.nrfblinky-Abaq71A2nyPIFytIPBL22w==/split_lib_slice_4_apk.apk", zip file "/data/app/no.nordicsemi.android.nrfblinky-Abaq71A2nyPIFytIPBL22w==/split_lib_slice_5_apk.apk", zip file "/data/app/no.nordicsemi.android.nrfblinky-Abaq71A2nyPIFytIPBL22w==/split_lib_slice_6_apk.apk", zip file "/data/app/no.nordicsemi.android.nrfblinky-Abaq71A2nyPIFytIPBL22w==/split_lib_slice_7_apk.apk", zip file "/data/app/no.nordicsemi.android.nrfblinky-Abaq71A2nyPIFytIPBL22w==/split_lib_slice_8_apk.apk", zip file "/data/app/no.nordicsemi.android.nrfblinky-Abaq71A2nyPIFytIPBL22w==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/no.nordicsemi.android.nrfblinky-Abaq71A2nyPIFytIPBL22w==/lib/arm64, /system/lib64, /system/vendor/lib64]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:93)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
    at android.app.ActivityThread.installProvider(ActivityThread.java:6566)
    ... 10 more
    Suppressed: java.io.IOException: No original dex files found for dex location (arm64) /data/app/no.nordicsemi.android.nrfblinky-Abaq71A2nyPIFytIPBL22w==/split_lib_resources_apk.apk
    at dalvik.system.DexFile.openDexFileNative(Native Method)
    at dalvik.system.DexFile.openDexFile(DexFile.java:353)
    at dalvik.system.DexFile.<init>(DexFile.java:100)
    at dalvik.system.DexFile.<init>(DexFile.java:74)
    at dalvik.system.DexPathList.loadDexFile(DexPathList.java:374)
    at dalvik.system.DexPathList.makeDexElements(DexPathList.java:337)
    at dalvik.system.DexPathList.<init>(DexPathList.java:157)
    at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:65)
    at dalvik.system.PathClassLoader.<init>(PathClassLoader.java:64)
    at com.android.internal.os.PathClassLoaderFactory.createClassLoader(PathClassLoaderFactory.java:43)
    at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:69)
    at android.app.ApplicationLoaders.getClassLoader(ApplicationLoaders.java:36)
    at android.app.LoadedApk.createOrUpdateClassLoaderLocked(LoadedApk.java:678)
    at android.app.LoadedApk.getClassLoader(LoadedApk.java:711)
    at android.app.LoadedApk.getResources(LoadedApk.java:944)
    at android.app.ContextImpl.createAppContext(ContextImpl.java:2303)
    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5943)
    ... 8 more

    BR Martin

  • Hi Martin

    Sorry for all the requests, but could you also do a log with the "nrfblinky" filter applied, so that only the app messages are shown?

    Best regards
    Torbjørn

  • Not sure about the filter but I set up this in logcat...

    and then the debug log was abbreviated to this...

    10-01 17:12:03.074 2997-3031/? D/ViewRootImpl@64340e2[nrfblinky]: setView = DecorView@d7da730[nrfblinky] TM=true MM=false
    10-01 17:12:03.078 2997-3031/? D/ViewRootImpl@64340e2[nrfblinky]: dispatchAttachedToWindow
    10-01 17:12:03.099 2997-3031/? D/ViewRootImpl@64340e2[nrfblinky]: Relayout returned: old=[0,0][0,0] new=[32,775][1047,1217] result=0x7 surface={valid=true 543709986816} changed=true
    10-01 17:12:03.101 2997-3031/? D/ViewRootImpl@64340e2[nrfblinky]: MSG_WINDOW_FOCUS_CHANGED 1
    10-01 17:12:03.127 2997-3031/? D/ViewRootImpl@64340e2[nrfblinky]: MSG_RESIZED_REPORT: frame=Rect(32, 775 - 1047, 1217) ci=Rect(0, 0 - 0, 0) vi=Rect(0, 0 - 0, 0) or=1
    10-01 17:12:03.152 2997-3031/? D/ViewRootImpl@64340e2[nrfblinky]: ViewPostIme pointer 0
    10-01 17:12:03.161 2997-3031/? D/ViewRootImpl@64340e2[nrfblinky]: dispatchDetachedFromWindow
    10-01 17:12:03.190 2997-3031/? W/ViewRootImpl@64340e2[nrfblinky]: Dropping event due to root view being removed:
    10-01 17:12:03.190 2997-3031/? E/ViewRootImpl@64340e2[nrfblinky]: mStopped=false mHasWindowFocus=true mPausedForTransition=false
    10-01 17:12:05.124 2997-3031/? D/ViewRootImpl@6248433[nrfblinky]: setView = DecorView@ea2fd69[nrfblinky] TM=true MM=false
    10-01 17:12:05.128 2997-3031/? D/ViewRootImpl@6248433[nrfblinky]: dispatchAttachedToWindow
    10-01 17:12:05.145 2997-3031/? D/ViewRootImpl@6248433[nrfblinky]: Relayout returned: old=[0,0][0,0] new=[32,775][1047,1217] result=0x7 surface={valid=true 543710330880} changed=true
    10-01 17:12:05.149 2997-3031/? D/ViewRootImpl@6248433[nrfblinky]: MSG_WINDOW_FOCUS_CHANGED 1
    10-01 17:12:05.179 2997-3031/? D/ViewRootImpl@6248433[nrfblinky]: MSG_RESIZED_REPORT: frame=Rect(32, 775 - 1047, 1217) ci=Rect(0, 0 - 0, 0) vi=Rect(0, 0 - 0, 0) or=1
    10-01 17:12:05.330 2997-3031/? D/ViewRootImpl@6248433[nrfblinky]: ViewPostIme pointer 0
    10-01 17:12:05.344 2997-3031/? D/ViewRootImpl@6248433[nrfblinky]: dispatchDetachedFromWindow
    10-01 17:12:05.368 2997-3031/? W/ViewRootImpl@6248433[nrfblinky]: Dropping event due to root view being removed:
    10-01 17:12:05.368 2997-3031/? E/ViewRootImpl@6248433[nrfblinky]: mStopped=false mHasWindowFocus=true mPausedForTransition=false
    10-01 17:12:07.820 2997-3031/? D/ViewRootImpl@2625381[nrfblinky]: setView = DecorView@1d8ee14[nrfblinky] TM=true MM=false
    10-01 17:12:07.839 2997-3031/? D/ViewRootImpl@2625381[nrfblinky]: dispatchAttachedToWindow
    10-01 17:12:07.906 2997-3031/? D/ViewRootImpl@2625381[nrfblinky]: Relayout returned: old=[0,0][0,0] new=[32,775][1047,1217] result=0x27 surface={valid=true 543710629888} changed=true
    10-01 17:12:07.912 2997-3031/? D/ViewRootImpl@2625381[nrfblinky]: MSG_WINDOW_FOCUS_CHANGED 1
    10-01 17:12:07.940 2997-3031/? D/ViewRootImpl@2625381[nrfblinky]: MSG_RESIZED_REPORT: frame=Rect(32, 775 - 1047, 1217) ci=Rect(0, 0 - 0, 0) vi=Rect(0, 0 - 0, 0) or=1
    10-01 17:12:08.803 2997-3031/? D/ViewRootImpl@2625381[nrfblinky]: ViewPostIme pointer 0
    10-01 17:12:08.956 2997-3031/? D/ViewRootImpl@2625381[nrfblinky]: ViewPostIme pointer 1
    10-01 17:12:08.963 2997-3031/? D/ViewRootImpl@2625381[nrfblinky]: dispatchDetachedFromWindow
    10-01 17:12:49.571 2997-3089/? D/ViewRootImpl@b3a2ec4[nrfblinky]: setView = DecorView@ee32ce2[nrfblinky] TM=true MM=false
    10-01 17:12:49.572 2997-3089/? D/ViewRootImpl@b3a2ec4[nrfblinky]: dispatchAttachedToWindow
    10-01 17:12:49.584 2997-3089/? D/ViewRootImpl@b3a2ec4[nrfblinky]: Relayout returned: old=[0,0][0,0] new=[0,0][1080,1920] result=0x7 surface={valid=true 543383703552} changed=true
    10-01 17:12:49.586 2997-3089/? D/ViewRootImpl@b3a2ec4[nrfblinky]: MSG_RESIZED_REPORT: frame=Rect(0, 0 - 1080, 1920) ci=Rect(0, 72 - 0, 0) vi=Rect(0, 72 - 0, 0) or=1
    10-01 17:12:49.769 2997-3031/? D/ViewRootImpl@f97cfe4[nrfblinky]: setView = DecorView@1b34049[nrfblinky] TM=true MM=false
    10-01 17:12:49.772 2997-3031/? D/ViewRootImpl@f97cfe4[nrfblinky]: dispatchAttachedToWindow
    10-01 17:12:49.799 2997-3031/? D/ViewRootImpl@f97cfe4[nrfblinky]: Relayout returned: old=[0,0][0,0] new=[32,624][1047,1368] result=0x7 surface={valid=true 543711801344} changed=true
    10-01 17:12:49.801 2997-3031/? D/ViewRootImpl@f97cfe4[nrfblinky]: MSG_WINDOW_FOCUS_CHANGED 1
    10-01 17:12:49.889 2997-3031/? D/ViewRootImpl@f97cfe4[nrfblinky]: MSG_RESIZED_REPORT: frame=Rect(32, 624 - 1047, 1368) ci=Rect(0, 0 - 0, 0) vi=Rect(0, 0 - 0, 0) or=1
    10-01 17:12:52.044 2997-3031/? D/ViewRootImpl@f97cfe4[nrfblinky]: ViewPostIme pointer 0
    10-01 17:12:52.109 2997-3031/? D/ViewRootImpl@f97cfe4[nrfblinky]: dispatchDetachedFromWindow
    10-01 17:12:52.306 2997-3031/? D/ViewRootImpl@d6fcd[nrfblinky]: setView = DecorView@85a4393[nrfblinky] TM=true MM=false
    10-01 17:12:52.308 2997-3031/? D/ViewRootImpl@d6fcd[nrfblinky]: dispatchAttachedToWindow
    10-01 17:12:52.317 2997-3031/? D/ViewRootImpl@d6fcd[nrfblinky]: Relayout returned: old=[0,0][0,0] new=[32,775][1047,1217] result=0x7 surface={valid=true 543304855552} changed=true
    10-01 17:12:52.319 2997-3031/? D/ViewRootImpl@d6fcd[nrfblinky]: MSG_WINDOW_FOCUS_CHANGED 1
    10-01 17:12:52.334 2997-3031/? D/ViewRootImpl@d6fcd[nrfblinky]: MSG_RESIZED_REPORT: frame=Rect(32, 775 - 1047, 1217) ci=Rect(0, 0 - 0, 0) vi=Rect(0, 0 - 0, 0) or=1
    10-01 17:12:53.143 2997-3089/? D/ViewRootImpl@b3a2ec4[nrfblinky]: dispatchDetachedFromWindow
    10-01 17:12:54.930 2997-3031/? D/ViewRootImpl@d6fcd[nrfblinky]: ViewPostIme pointer 0
    10-01 17:12:55.046 2997-3031/? D/ViewRootImpl@d6fcd[nrfblinky]: ViewPostIme pointer 1
    10-01 17:12:55.056 2997-3031/? D/ViewRootImpl@d6fcd[nrfblinky]: dispatchDetachedFromWindow

    Might need to advise on the filter, thanks.

    BR Martin

Related