LAUNCHXL-CC2640R2: CC2640R2F BLE APPLICATION

Part Number: LAUNCHXL-CC2640R2
Other Parts Discussed in Thread: CC2640R2F, CC2640, CC2650, BLE-STACK

Hello Team,

i am working on a project using CC2640R2F on LaunchXL - CC2640R2 , where i require to read RSSI value and share that value over UART to other MCU .

under gone through a document swru395 https://www.ti.com/lit/pdf/swru393 .

Still i am unable to read RSSI value.

i have one more doubt , Can we share RSSI value with advertisement packet also ? if yes how ? 

  • Hey Mohit,

    I've assigned your post to an expert to comment on. In the meantime, I'd like to point out that the User's Guide you linked is for an older part, the CC2640/CC2650. Although the content in the link will overlap greatly, I would still review the documentation for the CC2640R2 separately.

    Here's the link to the CC2640R2 User's Guide: 

  • Hi Mohit,

    Thank you for posting your question in the E2E forums, 

    i require to read RSSI value and share that value over UART to other MCU .

    Here is a thread that answers a similar question to yours. Marie H's answer explains the API calls needed and a suggestion on how to implement it.

    i have one more doubt , Can we share RSSI value with advertisement packet also ? if yes how ? 

    SimpleLink Academy Lab on Scanning and Advertising, in scanning task 2 explains how to get a sample UART output which displays the RSSI. Additionally, this lab shows you how to change the advertisement payload to include RSSI information.

    Please let me know if these resources help!

  • Hello Nima ,

    i have gone through above thread . i am able to read RSSI value  but my requirement is little bit differ . 

    i have to share real time RSSI value to the other MCU over UART once bonding is done, as other MCU require this RSSI value to determine distance and has to take some pre-defined actions .     

  • Hi Mohit,

    Could you give me some more information about what you have tried so far?

  • Hi Nima , 

    i am using project zero as my base reference on LaunchXL - CC2640R2F Launch pad .

    My program is quite simple, BLE is working in peripheral mode and it is advertising, it makes a bonded connection with Mobile Application . So whenever our BLE receive a characteristic data or write event request from Mobile Application . BLE has to share the RSSI value of this received data to other MCU using UART.

    So, i am using  HCI API to Read the RSSI value as mentioned in document swru395 https://www.ti.com/lit/pdf/swru393 . 

    // Read the RSSI
    HCI_ReadRssiCmd(pReport->handle);

  • Hi Mohit,

    As long as you are connected to a device and sending connection events the answer given by Ammar N in this E2E post should have the necessary API call for what you are trying to achieve. I do want to note that this API call will only work if there is an active connection.

    Please let me know if this answers your question.

    Hope that helps,

    Nima Behmanesh

  • Hi Mohit,

    I see that you rejected my answer, could you give me some information about what did not work for you from my reply?

    Best,

    Nima Behmanesh

  • Hi Nima,

    i am getting events from BLE stack on connection start and connection end .

    My query was regarding reading RSSI value of the PZ_SERVICE_WRITE_EVT , so whenever my peripheral BLE module receives this event from central BLE device during an active connection , i need to read RSSI value of that received event . 

  • Hi Mohit,

    I am speaking with my colleagues now, and will update you once I find more information about how to solve your issue. 

    Thank you,

    Nima Behmanesh

  • Hi Mohit,

    After looking more into your issue, I think I have come up with a solution. Please see the following steps.

    Step 1) Add the HCI_ReadRssiCmd() to the PZ_SERVICE_WRITE_EVT case. Whenever this event occurs, HCI_ReadRssiCmd() will get the RSSI value from the last data packet. This will trigger an event HCI_READ_RSSI in the ProjectZero_processCmdCompleteEvt() function.

    case PZ_SERVICE_WRITE_EVT: /* Message about received value write */
              /* Call different handler per service */
              switch(pCharData->svcUUID)
              {
                case LED_SERVICE_SERV_UUID:
                    ProjectZero_LedService_ValueChangeHandler(pCharData);
                    break;
                case DATA_SERVICE_SERV_UUID:
                    ProjectZero_DataService_ValueChangeHandler(pCharData);
                    break;
              }
             
              /*** Added Command ***/
              HCI_ReadRssiCmd(advHandleLegacy);
             
              break;

    Step 2) Transmit the RSSI to the other MCU in the project_zero.c::static void ProjectZero_processCmdCompleteEvt(hciEvt_CmdComplete_t *pMsg) function under the HCI_READ_RSSI case.

        case HCI_READ_RSSI:
        {
        		int8 rssi = (int8)pMsg->pReturnParam[3];
        		
        		/******
        		 * Place UART transmit code here using the above variable rssi
        		 ******/
        
            // Display RSSI value, if RSSI is higher than threshold, change to faster PHY
            if(status == SUCCESS)
            {
                uint16_t handle = BUILD_UINT16(pMsg->pReturnParam[1],
                                               pMsg->pReturnParam[2]);
    
                Log_info2("RSSI:%d, connHandle %d",
                          (uint32_t)(rssi),
                          (uint32_t)handle);
            } // end of if (status == SUCCESS)
            break;
        }

    Please let me know if that helps.

    Best,

    Nima Behmanesh

  • Hello Nima,

    Thank you this resolved my query . Thanks Again ! 

  • Hi Mohit,

    I'm happy that resolved your query!

    Best,

    Nima Behmanesh