4 Replies Latest reply on Dec 10, 2018 7:59 AM by erlu_2343051

    Scan Parameters Service preventing enabling notifications

    erlu_2343051

      I've been battling some issues getting a few operating systems (Windows and ChromeOS specifically) to connect and interact with my CYBLE-022001. I'm using the Bootloader/Bootloadable (fixed stack) modules in PSoc creator, and the UART-to-BLE bridge example from the 100 days of code. The example comes configured with a Scan Parameters Service. After many days I finally found that if I disable this service, I can now enable notifications on ChromeOS and Windows without issues.

       

      I'm disabling the service with the following line:

      CyBle_GattsDisableAttribute(cyBle_scpss.serviceHandle);

      sps.PNG

       

      Can anyone shed some light on what this service might be doing that would cause an error enabling notifications on only a subset of devices? Android, iOS, and MacOS work fine with this service, Windows and ChromeOS do not. Unfortunately, I already have some devices in the field that have this service enables, and I would love to find a way to work around it.

        • 1. Re: Scan Parameters Service preventing enabling notifications
          GyanC_36

          Hi Eric,

           

                 The default 100 days UART_BLE Peripheral project does not have this service and I think it was added and implemented to your project at later stages.

           

          Anyways, we need to understand the implementation done in your project for this specific service and reproduce this issue. Could you please attach your project workspace? If not complete project , just a simplified project where we can reproduce this issue.

           

          Are you using CySmart  PC tool with  BLE USB  Dongle for testing ? Please let us know a bit more about your  hardware setup and steps to reproduce the issue.

           

          -Gyan 

          • 2. Re: Scan Parameters Service preventing enabling notifications
            erlu_2343051

            Hi Gyan,

             

            Thank you for the response. The Scan Parameters Service actually comes from the Fixed Stack Bootloader example.

             

            I'm actually trying to get native Windows BLE communication working without a dongle (using the built in Bluetooth capability of Windows, and the latest Windows 10 updates that allow for proper BLE usage). However, this problem also exists using WebBluetooth on the latest version of Chrome, which is the easiest way to demo.

             

            Attached is an archive of a bare-bones example that illustrates the problem. The archive consists of the Bootloader example, and a Bootloadable application. The Bootloadable has a Service with a WriteWithoutResponse characteristic and a Notification characteristic. In the example, anything received by a WriteWithoutResponse is echo via a notification. I have also included a cypress.html file that, using web-bluetooth, allows for connecting to a device running the bootloadable and allows you to send a message and print what is received.

             

            In bootlable\main.c if lines 32 and 33 (disabling the services injected by the bootloader) are commented out, the example fails, if they are un-commented, the example works.

             

            Few requirements for the web-bluetooth demo to work:

            - Windows 10 build 10.0.15063 or later

            - Chrome v70 or later

             

            My actual project (that is already out in the world) is much more complex, but is exhibiting the same behavior as this example. Currently the project works totally fine on Android(native), iOS(native), and macOS(native). This particular issue is impacting ChromeOS(web-bluetooth and native) and Windows (web-bluetooth and native).

             

            - Eric

            • 3. Re: Scan Parameters Service preventing enabling notifications
              GyanC_36

              Hello Eric,

               

                  I tested your project and while debugging I found that you (PSoC 4 BLE ) are not sending the Write Response for all Characteristics CCCD.

               

              As soon as you Enable the Notification ,a Write Request is send for all the Characteristics CCCD sequentially and as you see in your Project you are sending the Write Response only for CYBLE_SERVER_UART_SERVER_UART_TX_DATA_CLIENT_CHARACTERISTIC_CONFIGURATION_DESC_HANDLE Handle and Not for all the handles including Scan Characteristics CCCD.

               

              I rearranged the required code snippet like below -

               

              """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

              case CYBLE_EVT_GATTS_WRITE_REQ:

                       

                          writeReqParam = (CYBLE_GATTS_WRITE_REQ_PARAM_T *) eventParam;

                       

                          if(CYBLE_SERVER_UART_SERVER_UART_TX_DATA_CLIENT_CHARACTERISTIC_CONFIGURATION_DESC_HANDLE == \

                                                                                  writeReqParam->handleValPair.attrHandle)

                          {

                              errorCode = CyBle_GattsWriteAttributeValue(&(writeReqParam->handleValPair), \

                                                              0, &cyBle_connHandle, CYBLE_GATT_DB_PEER_INITIATED);

                           

                              if (CYBLE_GATT_ERR_NONE  == errorCode)

                              {

                                  ////CyBle_GattsWriteRsp(cyBle_connHandle);

                                  #ifdef PRINT_MESSAGE_LOG

                                      UART_UartPutString("\n\rNotifications enabled\n\r");

                                      UART_UartPutString("\n\rStart entering data:\n\r");

                                  #endif

                              }

                              Notify=true;

                          }       

                          CyBle_GattsWriteRsp(cyBle_connHandle);    //GYAN

                          break;

               

              """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

              Please test after the above modification.

               

              So, here I could see only few options -

               

              1)  Modify the Project for sending the Write Response or

              2)  From your Client ( Central) Project only send the CCCD Enable request to only selected Characteristics CCCD Handles and not for Scan Characteristics CCCD Handle or

              3) You can remove the scan service from the BLE component it self.

               

              Note:

              1) Attached the modified project.

               

              2) I had to remove User Commands Script for building the project ( You can link it again)

               

               

              -Gyan

              1 of 1 people found this helpful
              • 4. Re: Scan Parameters Service preventing enabling notifications
                erlu_2343051

                Thank you Gyan. I really appreciate it.