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-CC26X2R1: Receive Continuous Notification from Server

Part Number: LAUNCHXL-CC26X2R1

Hi,

I'm running the "host_test" application(simplelink_cc13x2_26x2_sdk_2_40_00_81) . While setting 0x0001 in Client Characteristic Configuration attribute for receiving the notification from server of particular characteristics when that attribute value changes with help of btool. But when CCCD value set to 0x0001, client side is continuously receiving the notification irrespective of its value(i.e whether it change or not). Which is contradicting what was mention in this TI post(in TASK 3 - Get Notified)http://dev.ti.com/tirex/content/simplelink_academy_cc2640r2sdk_2_40_03_00/modules/blestack/ble_01_basic/ble_01_basic.html and in the reply given by  in similar question https://e2e.ti.com/support/wireless-connectivity/bluetooth/f/538/t/777657?tisearch=e2e-sitesearch&keymatch=notify 

Following is the BLE log of continuous receiving notification:

[04-08-2019 02:47:57.283] <Info   > [206] : <Tx> - 02:47:57.273
-Type           : 0x01 (Command)
-OpCode         : 0xFD16 (ATT_PrepareWriteReq)
-Data Length    : 0x08 (8) byte(s)
 ConnHandle     : 0x0000 (0)
 Handle         : 0x002A (42)
 Offset         : 0x0000 (0)
 Value          : 01:00
[04-08-2019 02:47:57.290] <Info   > Dump(Tx):
0000:01 16 FD 08 00 00 2A 00 00 00 01 00             ......*.....
--------------------------------------------------------------------
[04-08-2019 02:47:57.315] <Info   > [207] : <Rx> - 02:47:57.310
-Type           : 0x04 (Event)
-EventCode      : 0x00FF (HCI_LE_ExtEvent)
-Data Length    : 0x06 (6) bytes(s)
 Event          : 0x067F (1663) (GAP_HCI_ExtentionCommandStatus)
 Status         : 0x00 (0) (SUCCESS)
 OpCode         : 0xFD16 (ATT_PrepareWriteReq)
 DataLength     : 0x00 (0)
[04-08-2019 02:47:57.323] <Info   > Dump(Rx):
0000:04 FF 06 7F 06 00 16 FD 00                      .........
--------------------------------------------------------------------
[04-08-2019 02:49:22.872] <Info   > [208] : <Tx> - 02:49:22.863
-Type           : 0x01 (Command)
-OpCode         : 0xFD18 (ATT_ExecuteWriteReq)
-Data Length    : 0x03 (3) byte(s)
 ConnHandle     : 0x0000 (0)
 Flags          : 0x01 (1) (Immediately_Write_All_Pending_Prepared_Values)
[04-08-2019 02:49:22.880] <Info   > Dump(Tx):
0000:01 18 FD 03 00 00 01                            .......
--------------------------------------------------------------------
[04-08-2019 02:49:22.945] <Info   > [209] : <Rx> - 02:49:22.893
-Type           : 0x04 (Event)
-EventCode      : 0x00FF (HCI_LE_ExtEvent)
-Data Length    : 0x06 (6) bytes(s)
 Event          : 0x067F (1663) (GAP_HCI_ExtentionCommandStatus)
 Status         : 0x00 (0) (SUCCESS)
 OpCode         : 0xFD18 (ATT_ExecuteWriteReq)
 DataLength     : 0x00 (0)
[04-08-2019 02:49:22.956] <Info   > Dump(Rx):
0000:04 FF 06 7F 06 00 18 FD 00                      .........
--------------------------------------------------------------------
[04-08-2019 02:49:23.383] <Info   > [210] : <Rx> - 02:49:23.377
-Type           : 0x04 (Event)
-EventCode      : 0x00FF (HCI_LE_ExtEvent)
-Data Length    : 0x06 (6) bytes(s)
 Event          : 0x0519 (1305) (ATT_ExecuteWriteRsp)
 Status         : 0x00 (0) (SUCCESS)
 ConnHandle     : 0x0000 (0)
 PduLen         : 0x00 (0)
[04-08-2019 02:49:23.391] <Info   > Dump(Rx):
0000:04 FF 06 19 05 00 00 00 00                      .........
--------------------------------------------------------------------
[04-08-2019 02:49:24.034] <Info   > [211] : <Rx> - 02:49:24.029
-Type           : 0x04 (Event)
-EventCode      : 0x00FF (HCI_LE_ExtEvent)
-Data Length    : 0x09 (9) bytes(s)
 Event          : 0x051B (1307) (ATT_HandleValueNotification)
 Status         : 0x00 (0) (SUCCESS)
 ConnHandle     : 0x0000 (0)
 PduLen         : 0x03 (3)
 Handle         : 0x0029 (41)
 Value          : 03
[04-08-2019 02:49:24.044] <Info   > Dump(Rx):
0000:04 FF 09 1B 05 00 00 00 03 29 00 03             .........)..
--------------------------------------------------------------------
[04-08-2019 02:49:28.973] <Info   > [212] : <Rx> - 02:49:28.966
-Type           : 0x04 (Event)
-EventCode      : 0x00FF (HCI_LE_ExtEvent)
-Data Length    : 0x09 (9) bytes(s)
 Event          : 0x051B (1307) (ATT_HandleValueNotification)
 Status         : 0x00 (0) (SUCCESS)
 ConnHandle     : 0x0000 (0)
 PduLen         : 0x03 (3)
 Handle         : 0x0029 (41)
 Value          : 03
[04-08-2019 02:49:28.984] <Info   > Dump(Rx):
0000:04 FF 09 1B 05 00 00 00 03 29 00 03             .........)..
--------------------------------------------------------------------
[04-08-2019 02:49:34.041] <Info   > [213] : <Rx> - 02:49:34.035
-Type           : 0x04 (Event)
-EventCode      : 0x00FF (HCI_LE_ExtEvent)
-Data Length    : 0x09 (9) bytes(s)
 Event          : 0x051B (1307) (ATT_HandleValueNotification)
 Status         : 0x00 (0) (SUCCESS)
 ConnHandle     : 0x0000 (0)
 PduLen         : 0x03 (3)
 Handle         : 0x0029 (41)
 Value          : 03
[04-08-2019 02:49:34.054] <Info   > Dump(Rx):
0000:04 FF 09 1B 05 00 00 00 03 29 00 03             .........)..
--------------------------------------------------------------------
[04-08-2019 02:49:38.987] <Info   > [214] : <Rx> - 02:49:38.974
-Type           : 0x04 (Event)
-EventCode      : 0x00FF (HCI_LE_ExtEvent)
-Data Length    : 0x09 (9) bytes(s)
 Event          : 0x051B (1307) (ATT_HandleValueNotification)
 Status         : 0x00 (0) (SUCCESS)
 ConnHandle     : 0x0000 (0)
 PduLen         : 0x03 (3)
 Handle         : 0x0029 (41)
 Value          : 03
[04-08-2019 02:49:38.999] <Info   > Dump(Rx):
0000:04 FF 09 1B 05 00 00 00 03 29 00 03             .........)..
--------------------------------------------------------------------
[04-08-2019 02:49:44.058] <Info   > [215] : <Rx> - 02:49:44.050
-Type           : 0x04 (Event)
-EventCode      : 0x00FF (HCI_LE_ExtEvent)
-Data Length    : 0x09 (9) bytes(s)
 Event          : 0x051B (1307) (ATT_HandleValueNotification)
 Status         : 0x00 (0) (SUCCESS)
 ConnHandle     : 0x0000 (0)
 PduLen         : 0x03 (3)
 Handle         : 0x0029 (41)
 Value          : 03
[04-08-2019 02:49:44.069] <Info   > Dump(Rx):
0000:04 FF 09 1B 05 00 00 00 03 29 00 03             .........)..
--------------------------------------------------------------------
[04-08-2019 02:49:48.997] <Info   > [216] : <Rx> - 02:49:48.990
-Type           : 0x04 (Event)
-EventCode      : 0x00FF (HCI_LE_ExtEvent)
-Data Length    : 0x09 (9) bytes(s)
 Event          : 0x051B (1307) (ATT_HandleValueNotification)
 Status         : 0x00 (0) (SUCCESS)
 ConnHandle     : 0x0000 (0)
 PduLen         : 0x03 (3)
 Handle         : 0x0029 (41)
 Value          : 03
[04-08-2019 02:49:49.054] <Info   > Dump(Rx):
0000:04 FF 09 1B 05 00 00 00 03 29 00 03             .........)..
Thank You,
Regards,
Shiv Pratap Singh
  • Hi Shiv,
    Seems like you get the notification each 4 seconds which would imply that you are calling xxx_setParameter every 4 seconds (periodic timer?), although maybe with the same value. Could you double check?

    Also, what connection interval are you using?
  • Hi Joakim,
    Connection establish between client and server on the connection interval of 104ms.

    And as far as you are saying about getting notification after each 4 sec seems like you wrongly interpreted as after
    [04-08-2019 02:49:28.973] <Info > [212] : <Rx> - 02:49:28.966 this
    another command is send at
    [04-08-2019 02:49:34.041] <Info > [213] : <Rx> - 02:49:34.035.

    And One more information i would like to share that I am using CC2640R2 as my peripheral device which has simple_Peripheral image(simplelink_cc2640r2_sdk_2_40_00_32) running on it provided by TI.So about periodic timer, I don't know.

    So,I want to confirm that the after setting the CCCD for notify of a characteristics. Server should only notify when value changes, right?Not like in every interval.If yes, then can you please tell why is this happening?

    Thank You

    Regards,
    Shiv
  • Hi Shiv,

    The simple peripheral sample application uses a periodic timer (default set to 5s) which triggers function SimplePeripheral_performPeriodicTask;

     uint8_t valueToCopy;
    
      // Call to retrieve the value of the third characteristic in the profile
      if (SimpleProfile_GetParameter(SIMPLEPROFILE_CHAR3, &valueToCopy) == SUCCESS)
      {
        // Call to set that value of the fourth characteristic in the profile.
        // Note that if notifications of the fourth characteristic have been
        // enabled by a GATT client device, then a notification will be sent
        // every time this function is called.
        SimpleProfile_SetParameter(SIMPLEPROFILE_CHAR4, sizeof(uint8_t),
                                   &valueToCopy);
      }

    This is part of the sample application, and can be modified.

  • Hi Joakim ,
    As mention, its a PeriodicTask which copies value from third characterstic to fourth characterstics at interval of 5 second as shown below(from what I have seen)

    /*********************************************************************
     * @fn      SimplePeripheral_performPeriodicTask
     *
     * @brief   Perform a periodic application task. This function gets called
     *          every five seconds (SP_PERIODIC_EVT_PERIOD). In this example,
     *          the value of the third characteristic in the SimpleGATTProfile
     *          service is retrieved from the profile, and then copied into the
     *          value of the the fourth characteristic.
     *
     * @param   None.
     *
     * @return  None.
     */
    static void SimplePeripheral_performPeriodicTask(void)
    {
      uint8_t valueToCopy;
    
      // Call to retrieve the value of the third characteristic in the profile
      if (SimpleProfile_GetParameter(SIMPLEPROFILE_CHAR3, &valueToCopy) == SUCCESS)
      {
        // Call to set that value of the fourth characteristic in the profile.
        // Note that if notifications of the fourth characteristic have been
        // enabled by a GATT client device, then a notification will be sent
        // every time this function is called.
        SimpleProfile_SetParameter(SIMPLEPROFILE_CHAR4, sizeof(uint8_t),
                                   &valueToCopy);
      }
    }

    then why is it not following particular time interval rather it seems, sending notification at interval 4s, 4s, 6s, 4s, 4s, 6s ?

    Thank You,


    Regards,
    Shiv

  • Hi,
    The notification is queued every 5s, although not transmitted until the next connection event. So it depends on what connection interval you are using.