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
  • I'm sorry too. I have a client anxiously awaiting results, and although the meat of the application is performing beautifully, I can't yet get the BLE connection to be reliable.

    Since I spoke of "pressing Enter", and there is nothing labeled so on the mobile nRF Connect, I was clearly using the desktop version as you suggest. However, I have also procured and set up the mobile app, and it sometimes works quite nicely, sometimes not. I decided to power everything down, load firmware from scratch, etc., before having my client try it, and now I get "Authentication failed" and "Fault" crash messages on the serial port most of the time, though it will occasionally connect. Once it connects I can stream data nicely from my hardware to the displayed value, and have explored changes of scaling and update rates quite successfully.

    My two biggest questions at this point are:

    1) How to enter the "ABCD" authentication string on nRF Connect so I can get past that authentication.

    2) How to configure the base BLE connection. There is surely an application, or at least a source file, wherein all the GATT variables and their characteristics are defined. I have used MicroChip's TCPIP Configuration utility for years, although it took me a while to find out about that. I'm hoping to avoid the same time-sink here in hunting for the actual tools.

Reply
  • I'm sorry too. I have a client anxiously awaiting results, and although the meat of the application is performing beautifully, I can't yet get the BLE connection to be reliable.

    Since I spoke of "pressing Enter", and there is nothing labeled so on the mobile nRF Connect, I was clearly using the desktop version as you suggest. However, I have also procured and set up the mobile app, and it sometimes works quite nicely, sometimes not. I decided to power everything down, load firmware from scratch, etc., before having my client try it, and now I get "Authentication failed" and "Fault" crash messages on the serial port most of the time, though it will occasionally connect. Once it connects I can stream data nicely from my hardware to the displayed value, and have explored changes of scaling and update rates quite successfully.

    My two biggest questions at this point are:

    1) How to enter the "ABCD" authentication string on nRF Connect so I can get past that authentication.

    2) How to configure the base BLE connection. There is surely an application, or at least a source file, wherein all the GATT variables and their characteristics are defined. I have used MicroChip's TCPIP Configuration utility for years, although it took me a while to find out about that. I'm hoping to avoid the same time-sink here in hunting for the actual tools.

Children
  • Hi!
    Sorry for the delay.

    1)
    I'm not quite sure what you mean by this.
    When you write "03 41 42 43 44" to the "Bond Management Service Control Point" characteristic, you delete the bond
    that the application has with nRF Connect.

    When you then disconnect the device from nRF Connect and try to reconnect,
    you will get an error.
    To reconnect you will have to delete the bond information in nRF Connect as well.



    2)
    You can change some of the connection parameters in nRF Connect, such as the connection interval etc.
    Also, you are free to open the CGMS example and modify the code as you please.

    Best regards.

  • At 2018-03-06 06:26 AM, Nordic DevZone wrote:
    Sorry for the delay.

    I can certainly understand about being swamped. Hopefully this is not typical of Nordic support.

    1)
    I'm not quite sure what you mean by this.
    When you write "03 41 42 43 44" to the "Bond Management Service Control Point" characteristic, you delete the bond
    that the application has with nRF Connect.


    When you then disconnect the device from nRF Connect and try to reconnect,
    you will get an error.
    To reconnect you will have to delete the bond information in nRF Connect as well.


    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.

    2)
    You can change some of the connection parameters in nRF Connect, such as the connection interval etc.
    Also, you are free to open the CGMS example and modify the code as you please.

    No kidding. That's exactly what I've been doing. Right now I'm doing battle with getting it to connect reliably. RF link is solid, RSSI runs about -30 dBm, so that's not it. It will often connect on the first start of the day and run fine for a while. But later it either refuses to connect at all, or connects and immediately disconnects.

    Given the number of options available in the BLE stack, surely there must be a configuration utility of some sort, to set all the options and make sure everything is consistent, and especially to designate what variables are exposed on BLE. Microchip did a fine job of that with their config utility for their TCPIP stack, but they similarly hid it where I didn't discover it until I had wasted a lot of time trying to configure header files manually. Surely there is something similar here. I have tried both of the glucose examples, with enough success at times to make me believe they can actually work, but never a solid reliable application, even just compiling them straight out of the box. I have searched all over the various files and cannot find anything that selects what variables are exposed on BLE, etc. So please answer the specific questions:

    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.)?

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

    Steve Hendrix
  • I can't wait a week for each answer, and I can't deliver a house of cards to my client. The whole BLE implementation here seems quite shaky. I have fallen back to testing just the unmodified CGMS application. I can get to step 2 of the instructions:

    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.

    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.

    nRF Connect shows this:

    15:40:21.1400
    Scan started
    15:40:29.9580
    Connecting to device
    15:40:29.9860
    Connected to device E7:BF:CF:EA:F0:0D
    15:40:30.2540
    Attribute value read, handle: 0x03, value (0x): 4E-6F-72-64-69-63-5F-43-47-4D-53
    15:40:34.0120
    Authentication failed with status BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP
    15:40:34.0330
    Disconnected from device E7:BF:CF:EA:F0:0D, reason: BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION

    and the serial port on the PCA10040 shows this:

    <info> app: Continuous Glucose Monitoring example started.
    <info> app: Directed advertising.
    <info> app: Fast advertising with whitelist.
    <info> app: Connected to a previously bonded device.
    <info> app: Connected
    <info> app: Failed to secure connection. Disconnecting.
    <info> app: Disconnected
    <info> app: Directed advertising.
    <info> app: Fast advertising with whitelist.
    <info> app: Slow advertising with whitelist.

    I'm STILL begging for some actual instructions that work on the supplied examples (latest versions, just downloaded last week), and then for documentation on how to set up an application with custom variables exposed to the BLE interface. If Nordic can't help, are there any users out there who could give just enough guidance to get me past my frustration with non-working documentation?

Related