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

Multi BLE-Services in the modified Uart Example

Hello everybody,

I'll try to modify the ble uart example. The target is, to get data from two different nus Services (different characterisitv uuids). They are both initilised and I can subscribe both. Both services are based on the same structure but with other variables.

You can see both Services in the following picture.

When both Services are connected I can send data to ONLY ONE of the Services. If I want to send data first to the first Service and after that some other data to the second, the System is going into the HardFault. 

Maybe one of you has an idea, what's the Problem with it Slight smile

I'm using Keil v5, the NRF52832 with s132, sdk 15.3

Regards

Marius Slight smile

Parents
  • There are several things that may go wrong here, have you taken a look at:
    https://devzone.nordicsemi.com/nordic/short-range-guides/b/bluetooth-low-energy/posts/ble-characteristics-a-beginners-tutorial 

    There are also some useful comments below the tutorial that is useful.

    Typically it should be straight forward enough, make sure that each time you add a service or characteristic, that you have an overview of the handles, since those is needed once you want to send/receive data. This is described in the linked tutorial:

    handle: The SoftDevice needs to know what characteristic value we are working on. In applications with two or more characteristics naturally we will need to reference the handle of the specific characteristic value we want to use. Our example only has one characteristic and we will use the handle stored in p_our_service->char_handles.value_handle.

    If you are experiencing an assert, then the the application should typically jump to the fault_handler() and you can read out the file name, line number, and error code that is causing the assert by setting a breakpoint there (remember to also define DEBUG). Once you know that, it may be easier to know exactly which line of code is problematic.

Reply
  • There are several things that may go wrong here, have you taken a look at:
    https://devzone.nordicsemi.com/nordic/short-range-guides/b/bluetooth-low-energy/posts/ble-characteristics-a-beginners-tutorial 

    There are also some useful comments below the tutorial that is useful.

    Typically it should be straight forward enough, make sure that each time you add a service or characteristic, that you have an overview of the handles, since those is needed once you want to send/receive data. This is described in the linked tutorial:

    handle: The SoftDevice needs to know what characteristic value we are working on. In applications with two or more characteristics naturally we will need to reference the handle of the specific characteristic value we want to use. Our example only has one characteristic and we will use the handle stored in p_our_service->char_handles.value_handle.

    If you are experiencing an assert, then the the application should typically jump to the fault_handler() and you can read out the file name, line number, and error code that is causing the assert by setting a breakpoint there (remember to also define DEBUG). Once you know that, it may be easier to know exactly which line of code is problematic.

Children
Related