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.

CC2640: Get rssi value in cc2640 SimpleBLEPeripheral

Part Number: CC2640

When i use  GAPRole_SetParameter(GAPROLE_RSSI_READ_RATE, sizeof(uint16_t), &rssi);

<peripheral.c>的gapRole_processStackMsg()的HCI_GAP_EVENT_EVENT don't received notify

<simpleBLEPerpheral.c>
static void SimpleBLEPeripheral_taskFxn(UArg a0, UArg a1)
{
    ....
    Uint16_t rssiReadRate = 3000;
    GAPRole_SetParameter(GAPROLE_RSSI_READ_RATE, 
           sizeof(uint16_t), &rssiReadRate);
    ....
<peripheral.c>
bStatus_t GAPRole_SetParameter(uint16_t param, uint8_t len, void *pValue)
{
    …………
    case GAPROLE_RSSI_READ_RATE:
        if (len == sizeof(uint16_t))
        {
            gapRole_RSSIReadRate = *((uint16_t*)pValue);
            if((gapRole_RSSIReadRate) && (gapRole_state == GAPROLE_CONNECTED))
            {
                Util_restartClock(&rssiReadClock, gapRole_RSSIReadRate);
            }
        }
        else
        {
            ret = bleInvalidRange;
        }
        break;
     …………
}
Static void gapRole_init(void)
{
    GAP_RegisterForMsgs(selfEntity);
    Util_constructClock(&rssiReadClock, gapRole_clockHandler, 0, 0, false, RSSI_READ_EVT);
}
Static void gapRole_taskFxn(Uarg a0, Uarg a1)
{
    ………
    if (events & RSSI_READ_EVT)
    {
        events &= ~RSSI_READ_EVT;
        // Only get RSSI when in a connection
        if ((gapRole_state == GAPROLE_CONNECTED) || (gapRole_state == GAPROLE_CONNECTED_ADV))
        {
            // Ask for RSSI
            hciStatus_t status = NULL;
            status = HCI_ReadRssiCmd(gapRole_ConnectionHandle); <======== return success
            // Setup the next event
            if (gapRole_RSSIReadRate && !status)
            {
                Util_restartClock(&rssiReadClock, gapRole_RSSIReadRate);
            }
        }
    }
}
static void gapRole_processStackMsg(ICall_Hdr *pMsg)
{
    Switch (pMsg->event)
    {
        Case HCI_GAP_EVENT_EVENT:  <============ Never coming
            if (pMsg->status == HCI_COMMAND_COMPLETE_EVENT_CODE)
            {
                hciEvt_CmdComplete_t* pPkt = (hciEvt_CmdComplete_t*)pMsg;
                if(pPkt->cmdOpcode == HCI_READ_RSSI)
                {
                    int8_t rssi = (int8_t)pPkt->pReturnParam[3];
                    if(((gapRole_state == GAPROLE_CONNECTED) || (gapRole_state == GAPROLE_CONNECTED_ADV)) && (rssi != RSSI_NOT_AVAILABLE))
                    {
                        // Report RSSI to app
                        if(pGapRoles_AppCGs && pGapRoles_AppCGs->pfnRssiRead)
                        {
                            pGapRoles_AppCGs->pfnRssiRead(rssi);
                        }
                    }
                }
            }
            Break;
           }
}

<peripheral.h>

typedef void (*gapRolesRssiRead_t)(int8_t newRSSI);

typedef struct
{
     gapRolesStateNotify_t    pfnStateChange;
     gapRolesRssiRead_t     pfnRssiRead;
} gapRolesCBs_t;