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.

CC2564 BLE custom profile

Other Parts Discussed in Thread: CC2564

Hi,

I am working on a project based on CC2564B and MSP430F543x.

I need to make a custom profile in order to read/write a value of 20 Bytes.

I use the SPPLE demo as a reference and made my own profile with custom uuid well (see the following )

static Byte_t phoneNumberServiceValue[20];

static BTPSCONST GATT_Primary_Service_128_Entry_t PHONENUMBER_Service_UUID =
{
   PHONENUMBER_SERVICE_BLUETOOTH_UUID_CONSTANT
};

   /* The PHONENUMBER RX Characteristic Declaration.                          */
static BTPSCONST GATT_Characteristic_Declaration_128_Entry_t PHONENUMBER_Rx_Declaration =
{
   (GATT_CHARACTERISTIC_PROPERTIES_WRITE_WITHOUT_RESPONSE),
   PHONENUMBER_RX_CHARACTERISTIC_BLUETOOTH_UUID_CONSTANT
};

   /* The PHONENUMBER RX Characteristic Value.                                */
static BTPSCONST GATT_Characteristic_Value_128_Entry_t  PHONENUMBER_Rx_Value =
{
   PHONENUMBER_RX_CHARACTERISTIC_BLUETOOTH_UUID_CONSTANT,
   0,
   NULL
};
  
/* The PHONENUMBER Rx Credits Characteristic Declaration.                  */
static BTPSCONST GATT_Characteristic_Declaration_128_Entry_t PHONENUMBER_Rx_Credits_Declaration =
{
   (GATT_CHARACTERISTIC_PROPERTIES_READ|GATT_CHARACTERISTIC_PROPERTIES_WRITE|GATT_CHARACTERISTIC_PROPERTIES_EXTENDED_PROPERTIES),//|GATT_CHARACTERISTIC_PROPERTIES_WRITE_WITHOUT_RESPONSE),
   PHONENUMBER_RX_CREDITS_CHARACTERISTIC_BLUETOOTH_UUID_CONSTANT
};

   /* The PHONENUMBER Rx Credits Characteristic Value.                        */
static BTPSCONST GATT_Characteristic_Value_128_Entry_t PHONENUMBER_Rx_Credits_Value =
{
   PHONENUMBER_RX_CREDITS_CHARACTERISTIC_BLUETOOTH_UUID_CONSTANT,
   (20*(sizeof(Byte_t))),
   phoneNumberServiceValue
};

BTPSCONST GATT_Service_Attribute_Entry_t PHONENUMBER_Service[] =
{
   {GATT_ATTRIBUTE_FLAGS_READABLE,          aetPrimaryService128,            (Byte_t *)&PHONENUMBER_Service_UUID},                  //
   {GATT_ATTRIBUTE_FLAGS_READABLE,          aetCharacteristicDeclaration128, (Byte_t *)&PHONENUMBER_Rx_Declaration},                //
   {GATT_ATTRIBUTE_FLAGS_READABLE_WRITABLE, aetCharacteristicValue128,       (Byte_t *)&PHONENUMBER_Rx_Value},                      //
   {GATT_ATTRIBUTE_FLAGS_READABLE,          aetCharacteristicDeclaration128, (Byte_t *)&PHONENUMBER_Rx_Credits_Declaration},        //
   {GATT_ATTRIBUTE_FLAGS_READABLE_WRITABLE, aetCharacteristicValue128,       (Byte_t *)&PHONENUMBER_Rx_Credits_Value},              //
};

I use a function like register spple in order to add my services at startup, and I have also define my callback well.

I use TI BLE device monitor to test.

I can see my new profile, but I can only read and write 2 bytes.

If I try to write more than 2 bytes I have the error : Writing attributes of length gt 2 not implemented

Another question is the way to display the value when the read is done. I am making an association with a dummy write tab and it display the first two byte of my tab, but I don't really understand the point here..

Am I making something wrong? Is it possible to assiciate my tab ( static Byte_t phoneNumberServiceValue[20];) to the service value? 

Thanks in advance for the help on this forum, good as usual.

Best regards,

Anthony

  • Hi,

    What is the exact error you are seeing?

    You have registered the your service, have you started advertising? and does the remote device from where you are connecting to read and write data, supports this custom UUID?
  • Hi ,

    Yes the service is resgistered, and then I can make the advertising and connect it. Yes I can read and write in the service too.

    I can see it in Ble Device monitor according this picture. My only issue is That I am able to read/write only 2 bytes (you can see the read with 0x00 0x00 in the picture).

    But my data needs to be 20 bytes. I don't know what I am doing wrong and what is bloking me to two bytes only.

    I usually Worked with CC254x and we don't have any issue making services and using ble Device Monitor for several byte in a service.

    What I am looking for is how to send correctly the data in the event etGATT_Server_Read_Request (the 20 Bytes), and what is missing to my service in order to allow remote device to write more than 2 bytes too? (Ble device monitor send me the error "Writing attributes of length gt 2 not implemented" which means that my service don't show the possibility of more than 2 byte to the Gatt client).

    Thank you,

    Anthony

  • Hi,

    What is the value of DataLength parameter in the "GATT_Read_Response()" function call?
  • Hi,
    Thank you, and sorry for this dumb error... I don't manage the size properly in the GATT_Read_Response call. Now, when I read it's okay, and I can see all the 20 Bytes of my value in BLE Device monitor.

    But I still can't write more than 2 byte at a time with BLE device monitor (still have "Writing attributes of length gt 2 not implemented").
    Any clue for the write issue?
    Thank you for the quick and good feedback
    Best regards,
    Anthony
  • Hi,

    Can you check if there is a conduction check for "WORD_SIZE", under etGATT_Server_Write_Request?
  • Hi,

    Thank you for all the tips.
    It's working now, first of all I had to update BLE device monitor, the 1.1 version don't allow me to write more than two bytes..
    After that I had a condition using WORD_SIZE and another offset bad set.

    It's working now!
    Thanks for the great support on the Forum about the CC2564. Hope this will help other people.

    Best regards,
    Anthony