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.

CC2640R2F: PERIPERAL OBSERVER RSSI UART

Part Number: CC2640R2F
Hello, I have a question. Currently,
I modified the CC2640r2f periperal obsever code,
but the symptom is that BLE does not work once a uart message is sent. Is there a solution?


uint8 rsp_data[50];
static void SimpleBLEPeripheralObserver_StateChangeCB(gapPeriObsRoleEvent_t *pEvent)
{
switch(pEvent->gap.opcode)
{
case GAP_DEVICE_INFO_EVENT:
{
// gapDeviceInfoEvent_t *pDevInfoMsg;
//
// if (pDevInfoMsg = ICall_malloc(sizeof(gapDeviceInfoEvent_t)))
// {
// memcpy(pDevInfoMsg, pEvent, sizeof(gapDeviceInfoEvent_t));
//
// if (pDevInfoMsg->pEvtData = ICall_malloc(pEvent->deviceInfo.dataLen))
// {
// memcpy(pDevInfoMsg->pEvtData, pEvent->deviceInfo.pEvtData,
// pEvent->deviceInfo.dataLen);
// SimpleBLEPeripheral_enqueueMsg(SBP_OBSERVER_STATE_EVT, SUCCESS,
// (uint8 *)pDevInfoMsg);

if(observer_mode==1){
if(pEvent->deviceInfo.dataLen == 28){
memcpy(rsp_data, pEvent->deviceInfo.pEvtData, pEvent->deviceInfo.dataLen);
if((rsp_data[10]==0x53)&&(rsp_data[11]==0x61)&&(rsp_data[12]==0x6d)&&(rsp_data[13]==0x73)&&(rsp_data[14]==0x75)&&(rsp_data[15]==0x6e)&&(rsp_data[16]==0x67)&&(rsp_data[17]==0x45)&&
(rsp_data[18]==0x64)&&(rsp_data[19]==0x64)){ // NameSpace

//uart_printf("BUZON");
int8 rssi = pEvent->deviceInfo.rssi;
uart_printf("%d\n", rssi);

}
}
}
// }
// else
// {
// ICall_freeMsg(pDevInfoMsg);
// }
// }
break;
}

case GAP_DEVICE_DISCOVERY_EVENT:
{

if(observer_mode==1){
GAPRole_CancelDiscovery();

GAPRole_StartDiscovery(DEFAULT_DISCOVERY_MODE, DEFAULT_DISCOVERY_ACTIVE_SCAN, DEFAULT_DISCOVERY_WHITE_LIST);

uart_printf("Running");
}

// gapDevDiscEvent_t *pDevDiscMsg;
//
// if (pDevDiscMsg = ICall_malloc(sizeof(gapDevDiscEvent_t)))
// {
// memcpy(pDevDiscMsg, pEvent, sizeof(gapDevDiscEvent_t));
//
// if (pDevDiscMsg->pDevList = ICall_malloc((pEvent->discCmpl.numDevs)*
// sizeof(gapDevRec_t)))
// {
// memcpy(pDevDiscMsg->pDevList, pEvent->discCmpl.pDevList,
// (pEvent->discCmpl.numDevs)*sizeof(gapDevRec_t));
// SimpleBLEPeripheral_enqueueMsg(SBP_OBSERVER_STATE_EVT, SUCCESS,
// (uint8 *)pDevDiscMsg);
// }
// else
// {
// ICall_freeMsg(pDevDiscMsg);
// }
// }


break;
}

default:
break;
}

// Free the stack message
ICall_freeMsg(pEvent);
}
#endif

This is the content of the code: When a specific namespace is searched, the RSSI value of the device is measured.
sdk : 1.50 V
CCS : 12.5V