Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Example apps do not line up with the documentation.

The developer kit is impressive, and I was able to get a test app running quickly using the UART thru the USB connection. However, the example BLE apps feel a great deal like I'm trying to hack my way thru some downloaded garage-shop freeware. I am able to get the demo to run and advertise, and it's remarkably easy with the firmware automatically downloaded upon compile. But they just don't line up with the documentation, with just enough connection to suggest that I do indeed have the correct docs for the code. I am running the CGMS demo, and going step-by-step thru the provided instructions, referenced by number below.

1) Compile and it's advertising. So far so good.

2) nRF Connect, seems to work. Once I figured out that the little anonymous starburst thingy is the "settings button", I got past that. The rest of this step sometimes appears to work, sometimes not ("Pairing" remains red). However, the serial port reports bonding to a previously connected device, when Pairing stays red. OK.

3) What "Play" button? I see nothing that says Play, nor anything the looks like a play button, and none of the buttons offer any hover text. My best guess at this point is that the little arrows on the left that expand each of the 6 displayed areas under the device might also serve to "Play". If I open the Battery Service section, for instance, and now find what looks to be a Play button on the Battery Level subarea, and I see notifications every 10 seconds, or every 3 seconds by modifying the code in the demo.

4) I think I "started a play session" by opening the Continuous Glucose Monitoring section, and finding and then clicking what appears to be a Play button on the CGM Measurement subtopic. Writing 1A to the Specific Operations subtopic yields the documented 1C 1A 01 response perhaps one time in 20. The Write and Indicate buttons never seem to do anything that would be suggested by their names. It appears that the only way to have the 1A accepted is to press Enter immediately after typing a value; none of the buttons seem to work.

5) After I figured out it wants Enter, I get the expected 1C 1A 01 response.

6) "Observe that measurement notifications are received on the Measurement characteristic (UUID 0x2AA7)." This is the whole point of the exercise - and no matter what I do, there is no Measurement characteristic displayed.

If I could get the above sorted out I can probably hack my way thru the rest, but it surely doesn't feel very professional. I keep looking for some kind of configuration utility or even a configuration file whereby I can declare the BLE variables, linkages, update intervals, etc. Hints?

Here are the instructions from the Nordic documentation for reference:

Testing

Test the Continuous Glucose Monitoring Application with the nRF Toolbox app, which is available on both iOS (App Store) and Android (Google Play).

You can also test the application with nRF Connect by performing the following steps:

  1. Compile and program the application. Observe that the BSP_INDICATE_ADVERTISING state is indicated.
  2. Connect to the device from nRF Connect (the device is advertising as 'Nordic_CGMS'), then bond to the device. To bond, click the settings button for the device in nRF Connect, select "Pair", check "Perform Bonding", and click "Pair". Wait until the bond is established before you continue. Observe that the BSP_INDICATE_CONNECTED state is indicated.
  3. Observe that the services are shown in the connected device and that you can start receiving values by clicking the 'Play' button. Battery Level notifications are received every ten seconds.
  4. Start a CGM session by clicking the 'Play' button and then write '1A' to the Specific Operations Control Point (UUID 0x2AAC).
  5. Observe that the notification '1C 1A 01' (Response code 1C - Session start 1A - Success 01) is received on the Specific Operations Control Point (UUID 0x2AAC)
  6. Observe that measurement notifications are received on the Measurement characteristic (UUID 0x2AA7). An example measurement is '06 00 05 00 01 00' (length 06, flags 00, Glucose Concentration 0005, offset 0001).
  7. Do a Read all records operation:
    • Write '01 01' (OpCode : REPORT_STORED_RECORDS, Operator : ALL_STORED_RECORDS) to Record Access Control Point Characteristic (UUID 0x2A52).
    • Observe that you receive notifications of the glucose measurements(UUID 0x2AA7) and one indication of the RACP indicating success (06000101).
  8. Read the number of stored records:
    • Write '04 01' (OpCode: REPORT_NUM_STORED_RECORDS, Operator: ALL_STORED_RECORDS) to Record Access Control Point (UUID 0x2A52).
    • Observe that you get an indication of the RACP giving you the number of records. For example, 05000400 is 4 records (Number of records response opcode 05, Operator 00, least significant byte of record number 04, most significant byte of record number 00).
  9. Test the Bond Management Service by deleting the bond that the application has with nRF Connect:
    • Disconnect the device and reconnect in nRF Connect. Observe that the devices are still bonded. (Link encryption is ON.)
    • Observe that the Feature characteristic (0x2AA5) of the Bond Management Service (0x181E) displays '20 08 00'. This means that the deletion of the bonds for the current connection is supported.
    • Write '03 41 42 43 44' (Command to delete current bond 03, authorization code ABCD) to the Bond Management Service Control Point characteristic (0x2AA4).
    • Disconnect the device. This will trigger the bond deletion procedures.
    • Connect to the device again and observe that the pairing request fails, ending in a link loss. (BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION)
Parents
  • Hi again.

    SteveHx said:
    I'm not sure either. I can't find any documentation as to what this "Bond" feature is, what it is good for, how to turn it on or off, etc.

    Pairing: Devices that are initially connected can exchange encryption keys and encrypt the link. When they have,
    the link is secure and they are paired.

    Bonding: Paired devices can be bonded. This means that they store the keys that have already been exchanged when
    they paired and use those again the next time they connect.

    This means that when you delete the bond information on just one of the devices,
    the other device will try to reconnect using the old bonding information. This will not match the deleted device,
    so the connection drops.

    SteveHx said:
    1) How to configure a particular application as to BLE parameters, choice of variables to expose on the BLE interface, options as to those variables (read-only, write-only, etc.)?

    We do have nRF Connect,  where you can change the connection interval and so on. This is not possible on most
    phones, because the OS handles that.
    I don't know what it is you want to change, but in general you have to make changes to the code to acheive this. If you tell me more specific what parameters you want to change, I can help you track down the part of the code you will need to change.

    SteveHx said:
    choice of variables to expose on the BLE interface

    What do you mean by this?
    Are you talking about Services and Characteristics?
    Or what information that is advertised by your device?

    We have a tutorial section here on devzone that you might want to take a look at.
    We have an advertising/service/characteristic tutorial. They were made with reference to SDK 11. But apart from some API changes etc, there is a lot of useful information.
    One of my colleagues also have a Custom Service Tutorial on his GitHub, which is compatible with SDK 14.2.0.

    SteveHx said:
    2) How to correct the examples so they will connect reliably with either nRF Connect or with an actual user device?

    The examples works just as expected when I try it myself. There is no step in the instructions that doesn't work when I try this.
    The connection is consistent, it advertises as expected, connects, bonds and runs just as explained.

    Maybe you could tell me which part of the code you made changes to, if you made any changes?

    SteveHx said:
    Step 1 works. When I connect, I can't even get to the bonding at step 2, because even my fast fingers can't get there before it decides to reject me. When I first tried this, it would at least let me make the selections and click the final "Pair" button before tossing me out on my ear, with the same errors.

    This suggests that you have deleted the bond information in nRF Connect, but not in your application.

    SteveHx said:
    <info> app: Connected to a previously bonded device.

    Your device tries to connect to nRF Connect using the keys stored when you bonded the device. This information is deleted in nRF Connect, so the connection is dropped.
    Try erasing your board, download the application again, delete any bond information in nRF Connect and try again.

    I would also like to note that you are testing an experimental example in our SDK.

    Best regards.

  • It sounds like you've hit the nail very precisely on the head, and I have some reading to do. That's exactly what I was asking for, some pointers to cut thru the mass of documentation. One remaining unclear item: You mention a need to erase my target board as a separate step from writing the firmware to it. I would expect, based on many dozens of device programmers that I've used in the past 4 decades, that the J-link would by default erase before programming, and would require special steps to avoid that erase step. I'm running it from within Visual Studio, which hides most of such details. How would I perform the "erase" step that you describe?

  • And I'm sorry to keep repeating as well. As I've asked before, how do I delete the bonding information in the dev kit, so that I can delete it on both sides and start afresh. According to what you've told me and what I've observed, just reloading the firmware with a new build does not seem to do it.

    I will switch back to using the desktop version of nRFconnect as you suggest adn see what progress I can make there. But ultimately I need to show the client a reliable way to connect with their iPhone(s).

  • I have now come full-circle. I took your advice to go back to basics, run the example exactly as instructed. Am I using the correct instructions, as shown under Testing back up at the start of this thread? I compile, download, and run a pristine copy of the CGMS app. I start nRF Connect on the PC. In step 2 I am supposed to Bond by starting at the Settings button for the device. There is no such button that I can see. There is a starburst thing on the host device, and when I click it and select "Security parameters", that seems to open a settings dialog, the only thing I can find that is remotely close, like this:

    Since I am supposed to be Bonding, I turn on "Perform Bonding" and then "Apply". By now the CGMS app has timed out from advertising, so I press Button 1 on the dev kit to restart, then click Connect on nRF Connect. That yields

    You can see the error log in nRF Connect in the screenshots. Here is the log captured from the device via the serial port:

    <warning> nrf_sdh_ble: RAM starts at 0x20005668, can be adjusted to 0x200020E0.
    <warning> nrf_sdh_ble: RAM size can be adjusted to 0xDF20.
    <info> app: Continuous Glucose Monitoring example started.
    <info> app: Directed advertising.
    <info> app: Fast advertising with whitelist.
    <info> app: Slow advertising with whitelist.
    <warning> nrf_sdh_ble: RAM starts at 0x20005668, can be adjusted to 0x200020E0.
    <warning> nrf_sdh_ble: RAM size can be adjusted to 0xDF20.
    <info> app: Continuous Glucose Monitoring example started.
    <info> app: Directed advertising.
    <info> app: Fast advertising with whitelist.
    <info> app: Slow advertising with whitelist.

    PLEASE just tell me what I'm doing wrong, and why following the instructions to the best of my ability gets me absolutely nowhere.

  • Could you try using another example from our SDK, i.e the ble_app_hrs, and see if you get the same error?

    Here's what I do when testing the CGMS example:

    1. I erase my nRF52-DK using nRFgo Studio, because simply re-flashing the example might not erase any encryption keys present.

    2. I erase any bond information in nRF Connect.

    3. I flash the pre-compiled hex file from the SDK to my nRF52-DK.

    4. When I observe that the DK is advertising, I start the scan in nRF Connect.

    5. Connect to the device advertising as Nordic_CGMS and then pair/bond (see pictures below.)

    After that, the example works just as expected, and the connection is stable.

    Also, the connection issue you have now, is not that related to the original question. So you could preferrably start a new thread solving this.

    Cheers,
    Joakim.

  • I spent about two hours on the phone with tech support Monday and they duplicated exactly the issues I was having. They were able to work thru it with me, and the immediate bonding issue is apparently resolved. The original subject line still stands, however. You may close this ticket, and work to have the documentation improved as pertains to bonding and what it takes to actually erase the bonding information in the dev kit, which i asked you about several weeks ago.

  • Ok, I don't know who you were talking to, but I'm glad you were able to solve the issue.

    I'm sorry I wasn't able to help you, but I will forward your concern regarding the documentation.

    Best regards.

Reply Children
No Data
Related