4 Replies Latest reply on Dec 24, 2019 11:19 AM by LePo_1062026

    Is there a working example of reading RSSI values in a BLE connection?

    LePo_1062026

      Hi,

       

      I've looked on this site and tried some project code left with some of the discussions.

      Forum Links I've tried:

      PSoC6 RSSI value measurement issue

      Is it possible to read RSSI value when core is in Deepsleep

       

      I'm trying to read the RSSI values of received BLE messages with no real success.

      Are there any working examples of accomplishing this goal?

       

      I'm probably missing something simple.

       

      Len

        • 1. Re: Is there a working example of reading RSSI values in a BLE connection?
          ShipingW_81

          Assuming you send data through Notification.

           

          To get RSSI value, Cy_BLE_GetRssiPeer() is called at every time event #CY_BLE_EVT_GATTC_HANDLE_VALUE_NTF is generated. The RSSI value is informed through #CY_BLE_EVT_GET_RSSI_COMPLETE.

           

          The parameter generated along with #CY_BLE_EVT_GET_RSSI_COMPLETE must be cast to proper format to show correct RSSI value, as below capture shows -

          • 2. Re: Is there a working example of reading RSSI values in a BLE connection?
            LePo_1062026

            Wang,

             

            Thank you.  I've modified the project in PSoC6 RSSI value measurement issue

            with your code suggestion and got it to work.

             

            Next I'm going to modify the CE222046_GATT_Services projects to include RSSI info.  Cross your fingers!

             

            Len

            • 3. Re: Is there a working example of reading RSSI values in a BLE connection?
              LePo_1062026

              WangS,

               

              Thank you for your help.  With your suggestions I have been partially successful.

               

              Let me explain what I'm trying to do.

               

              I have an application that is relatively simple.

               

              In advertising mode, I'm trying to read both RSSI and Tx Power level for the packets received at the scanning end.

              In connection mode, I'm trying to read both RSSI and Tx Power level for the Peripheral packets received at the Connection end.

               

              Attached is a project.  It successfully gets the RSSI event but occasionally gets the Tx Power Level event.

               

              Do I have to coordinate the Cy_BLE_GetRssiPeer() and Cy_BLE_GetTxPowerLevel() calls?

               

              Second question:  Is there a way for the RSSI and Tx Pwr level to be returned once the Peripheral packet is received?

               

              Len

              • 4. Re: Is there a working example of reading RSSI values in a BLE connection?
                LePo_1062026

                WangS,

                 

                I believe I might have solved the post above.  However, it might not be elegant.

                 

                The way I get new RSSI and TxPowerLevel for each incoming LL_DATA packet is to decode the connection parameters and determine the connection Interval.  I then start up a SysTick at the connection Interval.  In the SysTick ISR, I re-request Cy_BLE_GetRssiPeer() and Cy_BLE_GetTxPowerLevel() calls.  As I said, it works but is not elegant.

                 

                A more elegant way is to get a BLE event every time the LL_DATA packet is received,  I can then issue Cy_BLE_GetRssiPeer() and Cy_BLE_GetTxPowerLevel() calls without the need of the SysTick ISR.

                 

                Is there a BLE event for the received LL_DATA packet?

                 

                Attached is an improved RSSI measurement project for those interested.

                 

                Len

                 

                Update 12.24.2019:  I found a possible solution.  I'm using the BLE  Inter-Processor-Communication (IPC) interrupt callback.  I'm using CY_BLE_INTR_CALLBACK_BLESS_STACK_ISR as the interrupt event.  It may still not be as efficient as I need but it appears to be working.

                 

                Happy Holidays to everyone!