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.

CC26XX GATT_WriteCharValue failing - need help to understand why

Hi,

I am using CCS 6.1, CC2650dk, updating SimpleBlePeripheral for my use.

I am calling GATT_WriteCharValue as follows:

SimpleProfile_GetParameter(SIMPLEPROFILE_CHAR1, newValue_ar);
newValue32b = BUILD_UINT32(newValue_ar[1],newValue_ar[2],newValue_ar[3],newValue_ar[4]);
LCD_WRITE_STRING_VALUE("Data Wr1 : ", newValue32b,16,LCD_PAGE3);
pReq.pValue = GATT_bm_alloc(connHandle_local, ATT_WRITE_REQ, 1, NULL);
if ( pReq.pValue != NULL ) {
pReq.handle = (uint16_t) (newValue_ar[4] + 6);
pReq.len = 1;
pReq.cmd = 0;
pReq.sig = 0;
pReq.pValue[0] = 0;
status = GATT_WriteCharValue(connHandle_local, &pReq, selfEntity);
LCD_WRITE_STRING_VALUE("Data Wr Done ", connHandle_local,16,LCD_PAGE4);
if ( status != SUCCESS ) {
LCD_WRITE_STRING_VALUE("Data Wr Fail ", status,16,LCD_PAGE5);
GATT_bm_free((gattMsg_t *)&pReq, ATT_WRITE_REQ);
}
}
else {
LCD_WRITE_STRING_VALUE("Data Alloc Fail ", connHandle,16,LCD_PAGE4);
}
break;

I am getting status of 2(alloc is passing but write is not) written on the LCD. The connHandle_local is obtained when connection is made and stored in a static as follows:

static uint16_t connHandle_local = GAP_CONNHANDLE_INIT;

....

case GAPROLE_CONNECTED:
{
uint8_t peerAddress[B_ADDR_LEN];

GAPRole_GetParameter(GAPROLE_CONN_BD_ADDR, peerAddress);
GAPRole_GetParameter(GAPROLE_CONNHANDLE, &connHandle_local);

  • Hi Deepak,

    GATT_WriteCharValue() is a function that is supposed to be called on client side to write a value to a characteristic on server side. Basically SimpleBLEPeripheral is a server, so that function is not supported in your case.

    - Cetri
  • Certi,
    Why is that the case. From the SW dev guide:
    "While this is the typical case, it is important to note that the GATT roles of Client and Server are
    completely independent from the GAP roles of peripheral and central. A peripheral can be either a
    GATT Client or a GATT Server, and a central can be either a GATT client or a GATT Server. It is also
    possible to act as both a GATT Client and a GATT Server."

    The problem is that in our case we want a really low battery consumption so we have high slave latency so the slave is not listening for master requests for a long time. So if the slave wants to send data to master, that takes a long time. Is there some way for slave to send data to the master without the master reading the data from the slave?
  • I guess I have to use the notification of the characteristic value in the peripheral.
  • Hi Deepak,

    Yes, you can use indication or notification for that purpose.

    - Cetri