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

Custom BLE code

I followed the custom BLE tutorial and got the output.



1.  The result increments till 19 , but after that the value 20 is appended with extra character. May i know the reason behind this?


A	09:31:39.095	"(0x) 1D" received
I	09:31:39.885	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 1E
A	09:31:39.885	"(0x) 1E" received
I	09:31:39.885	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 1E
A	09:31:39.885	"(0x) 1E" received
I	09:31:39.886	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 1E
A	09:31:39.886	"(0x) 1E" received
I	09:31:40.879	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 1F
A	09:31:40.879	"(0x) 1F" received
I	09:31:40.879	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 1F
A	09:31:40.879	"(0x) 1F" received
I	09:31:40.879	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 1F
A	09:31:40.879	"(0x) 1F" received
I	09:31:42.072	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 20, " "
A	09:31:42.072	"(0x) 20, " "" received
I	09:31:42.073	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 20, " "
A	09:31:42.073	"(0x) 20, " "" received
I	09:31:42.074	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 20, " "
A	09:31:42.074	"(0x) 20, " "" received
I	09:31:43.069	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 21, "!"
A	09:31:43.069	"(0x) 21, "!"" received
I	09:31:43.070	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 21, "!"
A	09:31:43.070	"(0x) 21, "!"" received
I	09:31:43.265	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 21, "!"
A	09:31:43.265	"(0x) 21, "!"" received
I	09:31:44.456	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 22, """
A	09:31:44.456	"(0x) 22, """" received
I	09:31:44.457	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 22, """
A	09:31:44.457	"(0x) 22, """" received
I	09:31:44.458	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 22, """
A	09:31:44.458	"(0x) 22, """" received
I	09:31:45.052	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 23, "#"
A	09:31:45.052	"(0x) 23, "#"" received
I	09:31:45.053	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 23, "#"
A	09:31:45.053	"(0x) 23, "#"" received
I	09:31:45.053	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 23, "#"
A	09:31:45.053	"(0x) 23, "#"" received
I	09:31:46.047	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 24, "$"
A	09:31:46.047	"(0x) 24, "$"" received
I	09:31:46.048	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 24, "$"
A	09:31:46.048	"(0x) 24, "$"" received
I	09:31:46.049	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 24, "$"
A	09:31:46.049	"(0x) 24, "$"" received
I	09:31:47.045	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 25, "%"
A	09:31:47.045	"(0x) 25, "%"" received
I	09:31:47.243	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 25, "%"
A	09:31:47.243	"(0x) 25, "%"" received
I	09:31:47.244	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 25, "%"
A	09:31:47.244	"(0x) 25, "%"" received
I	09:31:48.034	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 26, "&"
A	09:31:48.035	"(0x) 26, "&"" received
I	09:31:48.035	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 26, "&"
A	09:31:48.035	"(0x) 26, "&"" received
I	09:31:48.042	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 26, "&"
A	09:31:48.042	"(0x) 26, "&"" received
I	09:31:49.028	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 27, "'"
A	09:31:49.028	"(0x) 27, "'"" received
I	09:31:49.028	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 27, "'"
A	09:31:49.028	"(0x) 27, "'"" received
I	09:31:49.028	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 27, "'"
A	09:31:49.028	"(0x) 27, "'"" received
I	09:31:50.022	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 28, "("
A	09:31:50.022	"(0x) 28, "("" received
I	09:31:50.023	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 28, "("
A	09:31:50.023	"(0x) 28, "("" received
I	09:31:50.023	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 28, "("
A	09:31:50.023	"(0x) 28, "("" received
I	09:31:51.218	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 29, ")"
A	09:31:51.218	"(0x) 29, ")"" received
I	09:31:51.414	Notification received from f3641401-00b0-4240-ba50-05ca45bf8abc, value: (0x) 29, ")"

2.  How the change the name of "Unknown Service" and "Unknown characteristics" to a specific names?

3.  I tried to extend the code to add more characteristics to the same service,

      a. when i added the second characteristics, even if i enable the notifications, i cannot see the value on the front page. But i see the notifications.

                                                             

      b.  when i added the third characteristics, i could see the value for two of them and not the third.

                                                                         

4.  Is it possible to have one notification for all 3 characteristics? If so, what needs to be corrected.

5.    Is there any reference that shows how to use the nordic connect app for android? To configure GATT server. 

Parents
  • Hi,

    1.  The result increments till 19 , but after that the value 20 is appended with extra character. May i know the reason behind this?

    As explained by , this is just a matter of how it is displayed in the log. When the value is a valid ASCII value, it is displayed as that as well in the log. There is no additional character.

    2.  How the change the name of "Unknown Service" and "Unknown characteristics" to a specific names?

    There is no way to add a name to a service, so this is just interpreted by the nRF Connect app. Since it does not know which service it is, it shows it like that.

    3.  I tried to extend the code to add more characteristics to the same service,

          a. when i added the second characteristics, even if i enable the notifications, i cannot see the value on the front page. But i see the notifications.

    Where is the value missing? Please elaborate.

    4.  Is it possible to have one notification for all 3 characteristics? If so, what needs to be corrected.

    Yes. I cannot say without knowing more. Can you show you configure the characteristics on the nRF side as well as show it from nRF Connect?

    Is there any reference that shows how to use the nordic connect app for android? To configure GATT server. 

    I do not believe there is any documentation for that.

  • Thank you so much  for your answers. 

          In the Q3.b  image, The VALUE of the first characteristic is 0x0F, and second characteristic is 0x0A. But I cannot view            the third one. 

           Q5. Can you guide me regarding the "configure GATT server", option present?  how to configure it? 

  • Hi,

    There is nothing wrong with the code in your project (though I had to adjust the linker configuration a bit by moving the start address when using your project with SDK 15.3). Without changing any code I am able to read the value of all there characteristics. I am not able to test with Android though since I only have an iOS device at hand. Could it be as simple as that you forgot to press the read button (downwards arrow) for the third characteristic?

  • i am able to read, it appears on the notification, just not in the front view.

  • I see. It looks like a minor bug in nRF Connect for Android, then. I will try to get hold of one on Monday to verify.

  • Dear Einar,

    I have built a custom board with nrf52832 and im trying to run the ble_App_blinky example, and its getting stuck at ble_stack_init. Im using the software settings of PCA10040 board. WHat could be the reason?

     Its getting stuck at this instruction

  • Hi,

    The typical reason for sd_softdevice_enable() not returning is if your custom board does not have a 32.768 kHz crystal but your firmware is configured to use it. In that case, the SoftDevice will wait for the oscillator to start up, which it never will if the crystal is not present. To fix this, you should configure the SoftDevice to use the internal LFRC oscillator instead, as explained in this post.

Reply Children
Related