This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

changing the BLE device name, BLE service and GATT Characteristics dynamically

Hi, I am using nRF52832 module (GAP peripheral, GATT server) with nRF5SDK, ble_app_uart_pca10040_s112 application.

I need some help on dynamically changing the BLE device name, BLE service and GATT Characteristics.

What I tried:
In main(), I initialized only the UART module. Once UART is up, the nRF module receives data from an application chip (MCU).
In uart_event_handle function, I use a function call to process the received data and set the BLE device name accordingly, inside this function call I am initializing BLE stack, GAP parameters, GATT Init, Services Init followed by BLE advertisement.

This way, I was successfully able to set BLE device name and Services dynamically. However, after few minutes of communication with a GATT client, incorrect/incomplete data is being transmitted to that peer device.

Is it good to initialize BLE this way? If not, what should be done?

Also, I have found few of the forum discussions on how to change the BLE Device name in run time, but not seen anything related to changing GATT characteristics dynamically.
Please help, Thank you in advance.

  • Hi, thank you for your response.

    In general, what you have described might work. However, it might not be possible to change dynamically services and characteristics without updating attribute table and that would require terminating the connection.

    I understand that, attribute table needs to be updated for changing the services and characteristics. 

    In my application, the BLE initialization is performed based on data received at run time. If that can work without an issue, then may I know what could be the reason for transmitting incorrect/incomplete data to a GATT client after some point of time? I am not able to debug it since I am not having a Jlink debugger.

    Kindly help, Thank you.

  • Hi,

    Indication suggests to the central to do service discovery without the guarantee that this is immediate action. Service discovery is usually done on next re-connection.

    In general, it is not  recommended to do attribute table change dynamically.
    Could you be more specific about your use case? Is there a specific reason why you need to do it dynamically?

    Best regards,
    Dejan

  • Hi,

    Could you be more specific about your use case? Is there a specific reason why you need to do it dynamically?

    I have added the use case in this nRF_usecase document, please check. Thank you.

  • Hi,

    In addition to the name, could you provide more information about service and characteristics?
    How do you want to change characteristics dynamically and when (in relation to the reset)?

    Best regards,
    Dejan

  • Hi,

    I have added additional information on how I'm changing services and characteristics w.r.t reset in this updated_pseudocode text file. Kindly check.

    Thank you!

Related