Tool/software:
Hello,
CCS version : 12.7.1
SDK version : 8.10.01.02
Project : basic_ble
sysconf:
Enabled Peripheral + Central roles.
Сonnect the device to the Central.
The connected device uses a CC2642 microcontroller.
Getting discovery parameters.
Read the value of the received characteristic pointer (device status).
After a certain number of readings (210-230) I get an error that the pointer to the received data is NULL.
I reset the CC2340 and configure the stack anew. After that, everything repeats.
What could be the problem?
At the same time, the BLE stack works, since there is a connection with the CC2340 via BLE.
The code of the GATT event handler
static void GATT_EventHandler(uint32 event, BLEAppUtil_msgHdr_t *pMsgData)
{
gattMsgEvent_t *gattMsg = ( gattMsgEvent_t * )pMsgData;
uint8_t channel = Connection_getConnIndex(gattMsg->connHandle);
attReadByTypeReq_t req;
if ((channel == LL_INACTIVE_CONNECTIONS) || (channel == BLE_CHANNEL_PERIPHERAL))
return;
if (gattMsg->hdr.status == bleNotConnected)
return;
switch (event) {
case BLEAPPUTIL_ATT_MTU_UPDATED_EVENT:
/* */
break;
case BLEAPPUTIL_ATT_EXCHANGE_MTU_RSP:
/* */
break;
case BLEAPPUTIL_ATT_FIND_BY_TYPE_VALUE_RSP:
/* */
break;
case BLEAPPUTIL_ATT_READ_BY_TYPE_RSP:
/* */
break;
case BLEAPPUTIL_ATT_READ_RSP:
{
uint8_t *data = (uint8_t*)gattMsg->msg.readRsp.pValue;
uint16_t len = gattMsg->msg.readRsp.len;
if ((data == NULL) || (len == 0))
break;
// Valve state
/* */
break;
}
case BLEAPPUTIL_ATT_WRITE_RSP:
/* */
break;
case BLEAPPUTIL_ATT_ERROR_RSP:
/* */
break;
default:
break;
} // switch
}