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

Bluetooth write problem

I started with the blu_app_template on a 52840. I have advertising working. I can see that from an iOS app. I can also see the details of the service. I see the characteristic on the iOS side. I am having a problem with writing data on the characteristic from an iOS app. I am hoping for a push in the right direction to debug this issue. The write comes to the device but the the handle is incorrect for the characteristic that was published. Same as the example code: p_ble_evt->evt.gatts_evt.params.write.handle will have the value 0x0d while the handle for the characteristic is 0x10, i.e. p_our_service->char_handles.value_handle. Any hints on what I might have done wrong or where I should look?

Thanks in advance.

  • So you get a write event, but the value and handle is incorrect? Or just the handle? What is the expected handle? Are you sure that the write event you get are the write that you performed? How are you testing this?

  • Both the value seems to be incorrect and the handle is incorrect. I get the handle 0x0d but I would have expected it to be 0x10. I can see this on the iOS side. If I change the properties to/from write/ write with response, I can see those effects on the iOS side. I also only have one writable value. I think I may see an issue now. I am calling sd_ble_uuid_vs_add twice with the same base uuid, once for the service and once for the characteristic. Could that be the root of this issue?

  • Ok. Have you modified the ble_app_template? What app are you using on iOS? nRF Connect? Do you see the same behavior on Android? Are you sure that the write event you get are the write that you performed? How are you testing this? Calling sd_ble_uuid_vs_add() with the same base UUID shouldn't be a problem, the base will only be added to the SoftDevice once, and the same type reference will be returned in both cases.

  • Yes, I have modified the ble_app_template. I now have two service uuids with only one active at boot. I am attaching the same characteristic to either service. I can see the service and characteristic with LightBlue on iOS. With my own iOS app, I am sure that I am writing to the value as I can change it's properties and I see those changes in my iOS App. I am testing this by using my iOS and debugging the code on the 52840 with Eclipse.

  • Ok. Have you tried doing a sniffer trace?

1 2