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.

LAUNCHXL-CC2640R2: When I use BLE sap sdk to communication with snp profile, the api is faill.

Part Number: LAUNCHXL-CC2640R2
Other Parts Discussed in Thread: CC2640

Hi All,

I am using CC2640 and cc3220, and try to use SAP(Cc3220) lib to talk to SNP(CC2640).

For SNP part, run on CC2640, i am using this example code:

C:\ti\simplelink_cc2640r2_sdk_4_20_00_04\examples\rtos\CC2640R2_LAUNCHXL\blestack\simple_np

For SAP part, run on cc3220 mcu and reference to "https://github.com/ti-simplelink/ble_energia",  I would like to read RSSI, by below code:

uint8_t *BLE::hciCommand(uint16_t opcode, uint16_t len, uint8_t *pData)
{
    logRPC("HCI cmd");
    logParam("Opcode", opcode);
    logRelease();

    if (isError(SAP_getParam(SAP_PARAM_HCI, opcode, len, pData)) ||!apEventPend(AP_EVT_HCI_RSP))
    {    return NULL;
    }
    snpHciCmdRsp_t hciCmdRsp;
    memcpy(&hciCmdRsp, asyncRspData, sizeof(hciCmdRsp));
    Event_post(apEvent, AP_EVT_COPIED_ASYNC_DATA);
    return hciCmdRsp.pData; // TODO: does this get deallocated in NPI task?
}

But fail to read it. got the RSSI  value is zero. I get RSSI when BLE is connected.

So anyone can show me how to read it? or anything I should take care??

  • Aichi,

    A member of our team will assist you.

    -Luis

  • Hi,

    Sorry for the delay, I was out of office. Help me understand your problem, you mention that you get the RSSI when you are connected, so are you only unable to read the RSSI of advertisements?

    Best Regards,
    Alec

  • No.

    My issue is using external MCU like cc3220 then using saplib to read RSSI from SNP (via UART).

    You can refer to this:

        if (isError(SAP_getParam(SAP_PARAM_HCI, opcode, len, pData)) ||!apEventPend(AP_EVT_HCI_RSP))
        {    return NULL;
        }

  • Hello TIer,

    Any update :)?

  • Hi,

    Just found that how to get rsp by below so RSSI is working by API "SAP_getParam(SAP_PARAM_HCI, opcode, len, pData))"

     *  NP -> AP \n

     *  @ref snpHciCmdRsp_t \n

     *  Size    | Description

     * -------- | ----------------------------------------------------

     *  1  Byte | Command Status @ref SNP_ERRORS

     *  2  Byte | HCI Command Opcode Executed @ref SNP_ALLOWED_HCI

     *  X  Byte | Return Values if HCI Command has any

     

  • Ask one more question,

    What the define structure of pData? I mean if I use SAP_PARAM_HCI with opcode, the return is pData....

    Whats the define structure?

    I just saw this:

    Field Documentation

    § pData

    uint8_t* pData

    Pointer Result parameters for this opcode

    The expected result is the same as described in the HCI vendor guide or Bluetooth Specification. The Event Code may not be the same, the opcode referenced the request is sent back instead. (in the snpHciCmdRsp_t::opcode field)

  • Hi,

    Sorry for the delay, I was out on US holiday. In regards to pData, as mentioned in the description, it is a generic pointer to data, so the structure of it will depend on what HCI command you are using. In order to see what data you need to either provide or be prepared to receive, you can consult the BLE core spec.

    Best Regards,
    Alec