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

How to change my NUS_BASE_UUID

I want to modify the uuid through the serial port. What variables can I use to describe this define? Is there any code for reference?

#define BLE_UUID_NUS_TX_CHARACTERISTIC 0x0003               /**< The UUID of the TX Characteristic. */
#define BLE_UUID_NUS_RX_CHARACTERISTIC 0x0002               /**< The UUID of the RX Characteristic. */
#define NUS_BASE_UUID                  {{0x9E, 0xCA, 0xDC, 0x24, 0x0E, 0xE5, 0xA9, 0xE0, 0x93, 0xF3, 0x27, 0x05, 0x00, 0x00, 0x40, 0x6E}} /**< Used vendor specific UUID. */

Best wishes and regards!

John

Parents
  • Hi John

    If you look at the top of the ble_nus_init(..) function, on line 252 of ble_nus.c, you can see where the nus_base_uuid variable is created using the NUS_BASE_UUID define to set its value. 

    It is definitely possible to change the ble_nus_init function to take the UUID as a parameter instead, so that you can change this at runtime. 

    Please note that you can not change a service already in the SoftDevice, so if you have configured the SoftDevice already you need to disable it, enable it again, and configure the services again with the new UUID. 

    Also, I don't recommend changing the SDK files directly. If you want to make changes to the ble_nus.c implementation I recommend making a local copy of the file in your project folder, and rename the file and the functions to make it clear that you are not using the standard Nordic UART service anymore, but your own proprietary service.

    Best regards
    Torbjørn

Reply
  • Hi John

    If you look at the top of the ble_nus_init(..) function, on line 252 of ble_nus.c, you can see where the nus_base_uuid variable is created using the NUS_BASE_UUID define to set its value. 

    It is definitely possible to change the ble_nus_init function to take the UUID as a parameter instead, so that you can change this at runtime. 

    Please note that you can not change a service already in the SoftDevice, so if you have configured the SoftDevice already you need to disable it, enable it again, and configure the services again with the new UUID. 

    Also, I don't recommend changing the SDK files directly. If you want to make changes to the ble_nus.c implementation I recommend making a local copy of the file in your project folder, and rename the file and the functions to make it clear that you are not using the standard Nordic UART service anymore, but your own proprietary service.

    Best regards
    Torbjørn

Children
No Data
Related