This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2642R: more than 16 bit UUID handling

Part Number: CC2642R

sorry for this noob question 

I've already create custom service by hand working great with 16bit UUID 

now I'm trying to use service generator https://dev.ti.com/tirex/explore/content/simplelink_academy_cc13x2_26x2sdk_5_10_00_00/modules/ble5stack/ble_01_custom_profile/ble_01_custom_profile.html#example-service-generator to create a service compliant with nordic semiconductor Uart service (NUS) https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v14.0.0%2Fble_sdk_app_nus_eval.html

looks not so hard but UUID are more than 16 bits  (and more than 128 too) 

NUS UUID : 6E400001-B5A3-F393-E0A9-E50E24DCCA9E (16-bit offset: 0x0001).

Nordic’s UART Service includes the following characteristics:

Name
TX
RX

Mandatory
Yes
Yes

UUID
0x0002
0x0003

Type
U8[20]
U8[20]

R

X

W
X

N

X

I

RX Characteristic UUID: 6E400002-B5A3-F393-E0A9-E50E24DCCA9E (16-bit offset: 0x0002).

TX Characteristic UUID: 6E400003-B5A3-F393-E0A9-E50E24DCCA9E (16-bit offset: 0x0003).

if I keep only 16bit offsetted uuid my NUS_SERV_UUID (0x0001) is in conflicting with  PZ_SERVICE_CFG_EVT in ProjectZero_processApplicationMessage

  • NUS_service.h

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    /**********************************************************************************************
    * Filename: NUS.h
    *
    * Description: This file contains the NUS service definitions and
    * prototypes.
    *
    * Copyright (c) 2015-2019, Texas Instruments Incorporated
    * All rights reserved.
    *
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
    *
    * * Redistributions of source code must retain the above copyright
    * notice, this list of conditions and the following disclaimer.
    *
    * * Redistributions in binary form must reproduce the above copyright
    * notice, this list of conditions and the following disclaimer in the
    * documentation and/or other materials provided with the distribution.
    *
    * * Neither the name of Texas Instruments Incorporated nor the names of
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    NUS_service.c

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    /**********************************************************************************************
    * Filename: NUS.c
    *
    * Description: This file contains the implementation of the service.
    *
    * Copyright (c) 2015-2019, Texas Instruments Incorporated
    * All rights reserved.
    *
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
    *
    * * Redistributions of source code must retain the above copyright
    * notice, this list of conditions and the following disclaimer.
    *
    * * Redistributions in binary form must reproduce the above copyright
    * notice, this list of conditions and the following disclaimer in the
    * documentation and/or other materials provided with the distribution.
    *
    * * Neither the name of Texas Instruments Incorporated nor the names of
    * its contributors may be used to endorse or promote products derived
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • Hello,

    The example service generator in the linked SimpleLink Academy module has support to generate 128-bit UUIDs. I don't believe additional modifications are required to support this so you can use the templates provided by the service generator.

  • ok but if I set simple a 128 bit uuid in generator (0x6E400001B5A3F393E0A9E50E24DCCA9E) 

     pzCharacteristicData_t struct still using 16bit value for uuid

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    typedef struct
    {
    uint16_t svcUUID; // UUID of the service
    uint16_t dataLen; //
    uint8_t paramID; // Index of the characteristic
    uint8_t data[]; // Flexible array member, extended to malloc - sizeof(.)
    } spCharacteristicData_t;
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    and when sending message to main task it simply don't fits 

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    static void user_NUS_ValueChangeCB(uint16_t connHandle,
    uint8_t paramID, uint16_t len,
    uint8_t *pValue)
    {
    pzCharacteristicData_t *pValChange =
    ICall_malloc(sizeof(pzCharacteristicData_t) + len);
    if(pValChange != NULL)
    {
    pValChange->svcUUID = NUS_SERV_UUID;
    pValChange->paramID = paramID;
    memcpy(pValChange->data, pValue, len);
    pValChange->dataLen = len;
    ProjectZero_enqueueMsg(PZ_SERVICE_WRITE_EVT, pValChange);
    }
    }
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

  • even TI_BASE_UUID_128 macro is getting erro with too large int

  • Apologies for any confusion. Project Zero by default is setup to use 128-bit UUIDs for the service and the characteristics.

    I would take a look at data_service.c (as an example, I believe the other profiles in Project Zero can also be referenced). When the profile is written to, the Data_Service_WriteAttrCB is called. At this stage, the characteristic is searched for using Data_Service_findCharParamId. It is at this layer that the UUID is fully checked. Once the characteristic is identified, indexes are passed up to the application layer. This takes us to ProjectZero_DataService_ValueChangeCB, where the pzCharacteristicData_t shown above comes into play. At this stage the peripheral already knows what svcUUID is being written to (the callback from the profile was already triggered), so only a 16-bit identifier is used to communicate to the application.

    Hope this helps.