This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
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

How do I use Custom UUID , nrf51822

I want to use app(nrf uart 2.0)

so, I try to change UUID,

but I don't know how make custom uuid and use it

and I don't find function(ble_cs_init())

hlep me, please

Parents
  • So you want to use the UART service? Are you using the UART example code (Experimental: UART/Serial Port Emulation over BLE ) ? Have a look at the documentation for that example

    Under the section "Adding proprietary service and characteristic" you can see that the Nordic UART Service is added to the SoftDevice as follows in the ble_nus.c file:

     // Add custom base UUID.
    err_code = sd_ble_uuid_vs_add(&nus_base_uuid, &p_nus->uuid_type);
    if (err_code != NRF_SUCCESS)
    {
        return err_code;
    }
    ble_uuid.type = p_nus->uuid_type;
    ble_uuid.uuid = BLE_UUID_NUS_SERVICE;
    // Add service.
    err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY,
                        &ble_uuid,
                        &p_nus->service_handle);
    

    Here you can see that the base UUID is given in nus_base_uuid which is defined on line 227 in the same file. The UUID for the service and the TX/RX characteristics are defined in the header file. (ble_nus.h)

    #define BLE_UUID_NUS_SERVICE            0x0001  /**< The UUID of the Nordic UART Service. */
    #define BLE_UUID_NUS_TX_CHARACTERISTIC  0x0002  /**< The UUID of the TX Characteristic. */
    #define BLE_UUID_NUS_RX_CHARACTERISTIC  0x0003  /**< The UUID of the RX Characteristic. */
    
Reply
  • So you want to use the UART service? Are you using the UART example code (Experimental: UART/Serial Port Emulation over BLE ) ? Have a look at the documentation for that example

    Under the section "Adding proprietary service and characteristic" you can see that the Nordic UART Service is added to the SoftDevice as follows in the ble_nus.c file:

     // Add custom base UUID.
    err_code = sd_ble_uuid_vs_add(&nus_base_uuid, &p_nus->uuid_type);
    if (err_code != NRF_SUCCESS)
    {
        return err_code;
    }
    ble_uuid.type = p_nus->uuid_type;
    ble_uuid.uuid = BLE_UUID_NUS_SERVICE;
    // Add service.
    err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY,
                        &ble_uuid,
                        &p_nus->service_handle);
    

    Here you can see that the base UUID is given in nus_base_uuid which is defined on line 227 in the same file. The UUID for the service and the TX/RX characteristics are defined in the header file. (ble_nus.h)

    #define BLE_UUID_NUS_SERVICE            0x0001  /**< The UUID of the Nordic UART Service. */
    #define BLE_UUID_NUS_TX_CHARACTERISTIC  0x0002  /**< The UUID of the TX Characteristic. */
    #define BLE_UUID_NUS_RX_CHARACTERISTIC  0x0003  /**< The UUID of the RX Characteristic. */
    
Children
No Data
Related