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

Does nrf toolbox (android) work on nrf52 related SD, e.g. S140?

Hello everybody!

Feel free to read this question for more background information:

devzone.nordicsemi.com/.../

I'll give everyone reading this a quick bulletin run down as to what happened to save time:

  • Migrating from nrf51 S110 to nrf52 S120
  • ble_hvx() function on my nrf52840 returns "0x00000008" "INVALID STATE" error.
  • Most likely the cccd handle wasn't set by my android app
  • But it worked flawlessly back in nrf51 S110
  • User Endnode here told me that it's very likely that the old android API function (not to be mistaken with the nrf51 MCU function I mentioned above, the successful establishment of the communication between android device and MCU requires many functions on both sides) setcharacteristicnotification, which use "WRITE" method on the GATT instead of "REQUEST" method, fails to trigger the proper set cccd handle operation, and is likely ignored altogether by the latest S140 SD.

So, I went on trying to find the relevant function, but couldn't. I'm here thinking, shouldn't nrf toolbox be working with S140 on Nrf52 series? If that's the case, I'll just use whatever function they are using from the android API, and mission accomplished?

I'm trying to git the APP source code to local, but at this point, I don't know if the tool box work at all, if it does, then it'll just be monkey see monkey do kind of deal, if not, I'm not going to spend my time on it.

Also, if you are familiar with this, feel free to tell me what function the toolbox use to set the cccd handle.

Cheers.

Parents
  • FormerMember
    0 FormerMember

    First, I would recommend you to read this thread regarding the problem you describe.

    The android part: Which phone/android version do you use?

    When I test here, nRF Toolbox (Huawei P10/ android 7.0)<--> nRF52840, S140 v.5.0.0-2.alpha, example ble_app_hrs works fine, it is not any problem to enable notifications.

    In nRF Toolbox: perhaps the function newWriteRequest()--> getWriteType() can be of any use when enabling notifications? Or, run nRF Toolbox in debug mode, set a breakpoint in newEnableNotificationsRequest()and check which write type the app will use for enabling notifications.

Reply
  • FormerMember
    0 FormerMember

    First, I would recommend you to read this thread regarding the problem you describe.

    The android part: Which phone/android version do you use?

    When I test here, nRF Toolbox (Huawei P10/ android 7.0)<--> nRF52840, S140 v.5.0.0-2.alpha, example ble_app_hrs works fine, it is not any problem to enable notifications.

    In nRF Toolbox: perhaps the function newWriteRequest()--> getWriteType() can be of any use when enabling notifications? Or, run nRF Toolbox in debug mode, set a breakpoint in newEnableNotificationsRequest()and check which write type the app will use for enabling notifications.

Children
  • Hello @Kristin, I actually have been going at that for some days now, is there a super early version of S140 which hasn't fixed the "bug" that I can use to isolate this problem? I just want to confirm this is actually the problem, because my Android code doesn't look quite different from the nrfTool box one?

  • Hi Mitch, so I dug deep into nRF Toolbox and I found out that I wasn't using a workaround to set the write type of a descriptor when enabling notifications/indications. Please read this issue (just reported it): github.com/.../33

    I have also immediately fixed it and you'll find a commit id in the issue. Please say it it fixes your issue.

  • Hi Mitch, so I dug deep into nRF Toolbox and I found out that I wasn't using a workaround to set the write type of a descriptor when enabling notifications/indications.

    @Aleksander Nowakowski Thank you Aleksander, I found the function too and it was not! So... what does this mean, that nrfTool box SHOULDN'T BE WORKING??? Whaaaaaaaa? So does it work or not? This is so positively confusing! Gosh I don't have much hair left to pull out !!! T_T

    God the whole thing is such a mess!

    Also @Aleksander Nowakowski what workaround do you use? It would be really, really nice of you if you can let me take a peek at your android code... or just point me to the right direction...

    Cheers - a downtrodden code monkey

  • nRf Toolbox should be working with all our DKs. It's a bit difficult for the above bug to appear. You have to have Android 5.1 or older phone, newest SD, write something to the char before you enable notifications/indications on it, and write without response.

    What do you mean be what workaround? All the code is on GitHub. I pointed you to the commit.

  • Hello @Aleksander, how do you mean by:

    write something to the char before you enable notifications/indications on it,

    ? Write something to what char?

    This is what I believe you should do to enable CCCD in an android program:

    1. call BluetoothGatt.setCharacteristicNotification on the right characteristic.
    2. Write 0x0001, in android, a byte[] of 0x01, 0x00 to the corresponding descriptor of the characteristic in step 1.
    3. No step 3, it's done!

    The problem is #2, I believe you should write 0x0001 using some sort of "request" instead of "write", but sadly I don't know how to do that, there are all sorts of "write" in android API it seems, but nothing about "request".

    And can you please help me find the right API/property setter??

    It'll be greatly appreciated.

Related