7 Replies Latest reply on Apr 25, 2017 6:06 PM by jrow

    BLE pairing using CySmart mobile-app freezes the EZ-Serial firmware on EZ-BLE CYBLE-212019-00 module

    info_2104136

      We are testing the EZ-Serial firmware on the EZ-BLE CYBLE-212019-00 module and, in particular, pairing/bonding (security features) and whitelist management.

         

      Using default parameters and a very simple setup, request for pairing the BLE module from the CySmart application on Android seems to freeze the BLE module.

         

      This problem also happens in a small custom test application we implemented for testing the performances and features of the EZ-Serial firmware.

         

       

         

      The setup:

         
            
      • CY8CKIT-042-BLE Pioneer kit with a CYBLE-212019-EVAL Evaluation Board plugged-in,
      •     
      • The EZ-BLE module has been updated/programmed with the last version of EZ-Serial firmware (EZ-Serial_V1_0_2_CYBLE-2120XX-X0),
      •     
      • CySmart has been installed and tested on two Android smartphones (Sony and Lenovo on Android 6.0),
      •     
      • Putty is used to check the output of EZ-Serial firmware.
      •    
         

       

         

      Here the steps for reproducing the problem:

         

      1) Start or reset the BLE module. Output:

         

      @E,003B,BOOT,E=01000215,S=030200FA,P=0102,H=05,C=01,A=00A0504219E3

         

      @E,000E,ASC,S=01,R=03

         

      2) Start the CySmart app on the phone (every trace of previous pairing/bonding information has been removed).

         

      3) In the list of BLE devices, click on the “Not Paired” button of the EZ-Serial device. The output from EZ-Serial is: 

         

      @E,0035,C,C=04,A=5061E6D49099,T=01,I=0028,L=0000,O=07D0,B=00

         

      @E,001B,P,C=04,M=03,B=01,K=10,P=01

         

      @E,001D,CU,C=04,I=0006,L=0000,O=07D0

         

      @E,000E,ENC,C=04,S=01

         

      @E,001B,B,B=04,A=5061E6D49099,T=01

         

      @E,000F,PR,C=04,R=0000

         

      4) The last line of the output indicates that the pairing request is successful, but the module is now unresponsive, i.e. the connection LED remains blue, the BLE module is not visible anymore, no command can be passed through the console (even no echo), no supervision timeout.

         

      It seems to be related to the EZ-Serial firmware and I would like to know what is the recommended procedure to pair the EZ-BLE module from an Android or iOS device with the EZ-Serial firmware on the BLE module.

         

      I already check the documentation of the EZ-Serial firmware (and I also already tested a custom firmware implementation with PSoC Creator) but the EZ-Serial API seems to be a quick solution for our development (similar to the BlueGiga Smart API from SiliconLabs for BLE112 and BLE113 modules).

         

      Note: I also read the Section on EZ-Serial firmware documentation about Security and Encryption Examples. The step-by-step automatic pairing request acceptance example (p.57, Section 3.8.2.2, with auto-accept bit at 0 using “SSBP,F=0” command and “/PR,R=0” to accept pairing) also freezes the module. Finally, it seems that when there is time between connection and pairing requests (in a custom app implementation) the pairing is ok.

         

       

         

      Thanks in advance for your help.

         

      David

        • 1. Re: BLE pairing using CySmart mobile-app freezes the EZ-Serial firmware on EZ-BLE CYBLE-212019-00 module
          jrow

          Hello David,

             

          Thanks for the detailed report. We will look into this as soon as possible. To confirm, the pairing process works fine on your end when there is a delay between connection and pairing--that is, the module remains responsive? It fails only when the connection and pairing steps happen immediately one right after the other?

          • 2. Re: BLE pairing using CySmart mobile-app freezes the EZ-Serial firmware on EZ-BLE CYBLE-212019-00 module
            jrow

            Hi David,

               

            A colleague and I have investigated your report with mixed results. He was able to replicate at least some of the behavior you describe, while so far I have been unable to. I have used most of the same hardware:

               
                  
            • CY8CKIT-042-BLE Pioneer kit base board
            •     
            • CYBLE-212019-EVAL module
            •     
            • EZ-Serial official release firmware v1.0.2 build 21 (0x15)
            •     
            • LG G4 smartphone running Android 6.0 (first test)
            •     
            • Nexus 4 smartphone running Android 5.0 (second test)
            •    
               

            Those are the only phones I have available for testing myself. However, neither phone appears able to trigger the described behavior. Instead, the module remains responsive and generates the expected output like this:

               

            @E,003B,BOOT,E=01000215,S=030200FA,P=0102,H=05,C=01,A=00A050421650
            @E,000E,ASC,S=01,R=03
            @E,0035,C,C=04,A=485C454C6607,T=01,I=0027,L=0000,O=07D0,B=00
            @E,001B,P,C=04,M=03,B=01,K=10,P=01
            @E,001D,CU,C=04,I=0006,L=0000,O=07D0
            @E,000E,ENC,C=04,S=01
            @E,001B,B,B=04,A=485C454C6607,T=01
            @E,000F,PR,C=04,R=0000
            @E,001D,CU,C=04,I=0027,L=0000,O=07D0
            @E,001D,CU,C=04,I=0006,L=0000,O=07D0
            @E,001A,W,C=04,H=000B,T=00,D=0200
            @E,001D,CU,C=04,I=0027,L=0000,O=07D0
            @E,000C,.CYSPP,S=00
            @E,000E,ASC,S=01,R=03

               

            My colleague tested with a Xiaomi 4 phone and did encounter the problem you describe, though it appears to occur only the first time the bond is attempted after a fresh re-flash. Upon resetting the eval board with the SW1 reset button on the BLE Pioneer kit and then re-bonding, the problem does not occur. Can you run a similar test and see if the same thing happens on your end?

               

            Also, can you provide the exact smartphone models that you have tested with? There may be slight variations in timing which contribute to the success or failure.

               

            Thanks,

               

            Jeff

            • 3. Re: BLE pairing using CySmart mobile-app freezes the EZ-Serial firmware on EZ-BLE CYBLE-212019-00 module
              info_2104136

              Unfortunately, I am not able to reproduce the successful pairing from the custom app, so my remark on the timing between connection and pairing is not relevant.

                 

              I tested the pairing with different settings, and on about 20 trials I was able to pair with no “freeze” only 2 times. However, for the two successful attempts I was not able to reproduce the pairing with the same commands. 

                 

              For the details, one of the successful attempt was after the following command:
              /RAFC --> Factory reset
              SSBP,M=10,B=1,I=3,F=0 --> No security, Bond, No input and no output, accept pairing manually with /PR,R=0
              One attempt with these parameters was successful, and then the other attempts failed and led to a “freeze” state.

                 

              When the BLE module “freezes”, it is always after the two events:
              @E,001B,B,B=04,A=5061E6D49099,T=01 --> Bond entry created
              @E,000F,PR,C=04,R=0000 --> Pairing success

                 

              I also tested to pair with no bond (command: SSBP,B=0) and the pairing works. But when I try to manually adds a bond entry for the connected device (command: /P) the BLE module freezes again.
              Thus, the pairing problem may be related to the procedure for adding a bond entry.

                 


              Overall, what I tried to achieve with pairing is a “common” design. First, after a specific user event, the BLE module will start public advertisement until connection. When a device is connected, the pairing should allow to create a bond entry and also to add an entry in the whitelist (after disconnection). The whitelist will be used for the next periods of advertisement in order to limit the visibility of the BLE module to only the previously paired devices.
              Please let me know if there is an alternative to pairing for this design.

              • 4. Re: BLE pairing using CySmart mobile-app freezes the EZ-Serial firmware on EZ-BLE CYBLE-212019-00 module
                info_2104136

                I do the test and inform you asap.

                   

                The model of smartphones I tested:

                   
                      
                • Sony Xperia XA, F3111, Android 6.0
                •     
                • (Motorola) Lenovo C2, PA450184ES, Android 6.0
                •    
                   

                David

                • 5. Re: BLE pairing using CySmart mobile-app freezes the EZ-Serial firmware on EZ-BLE CYBLE-212019-00 module
                  info_2104136

                  I tested with a reset after the freeze.

                     

                  After the reset, the EZ-BLE module is visible again and labeled as “paired” (also in the list of paired devices in Android’s settings), but pairing information seems to be only stored on the Android device and not in the BLE module. When a connection is established after the reset, no Bond entry is found by EZ-Serial (see the output below, part in bold type).

                     

                  @E,003B,BOOT,E=01000215,S=030200FA,P=0102,H=05,C=01,A=00A0504219E3
                  @E,000E,ASC,S=01,R=03
                  // Connection and pairing attempt
                  @E,0035,C,C=04,A=79672B121F6A,T=01,I=0028,L=0000,O=07D0,B=00
                  @E,001B,P,C=04,M=03,B=01,K=10,P=01
                  @E,001D,CU,C=04,I=0006,L=0000,O=07D0
                  @E,000E,ENC,C=04,S=01
                  @E,001B,B,B=04,A=79672B121F6A,T=01
                  @E,000F,PR,C=04,R=0000
                  // The module is unresponsive at this point
                  // Reset

                  @E,003B,BOOT,E=01000215,S=030200FA,P=0102,H=05,C=01,A=00A0504219E3
                  @E,000E,ASC,S=01,R=03
                  // Connection, but no Bond entry
                  @E,0035,C,C=04,A=79672B121F6A,T=01,I=0028,L=0000,O=07D0,B=00
                  @E,001D,CU,C=04,I=0006,L=0000,O=07D0
                  @E,001D,CU,C=04,I=0028,L=0000,O=07D0
                  @E,000C,.CYSPP,S=00
                  @E,000E,ASC,S=01,R=03

                     

                  As I mentioned, I would like to use pairing for security but also for the whitelist feature on advertisement.

                  • 6. Re: BLE pairing using CySmart mobile-app freezes the EZ-Serial firmware on EZ-BLE CYBLE-212019-00 module
                    jrow

                    Hi David,

                       

                    Thanks for the additional detail. The behavior appears to be related to the flash storage operation that occurs when a bond is created. I would like to provide an updated test firmware build for you to continue working with the EZ-Serial platform, but this requires a support case. Can you create a case at this page:

                       

                    http://www.cypress.com/mycases

                       

                    ...and then come back here and note the new case number? You do not need to provide many details in the case description as long as you refer back to this community forum post.

                       

                    Thanks,

                       

                    Jeff

                    • 7. Re: BLE pairing using CySmart mobile-app freezes the EZ-Serial firmware on EZ-BLE CYBLE-212019-00 module
                      info_2104136

                      Thank you very much for your support and responsiveness.

                         

                      The case no. is: 00335542 (Tech Support)

                         

                      I will carefully test the EZ-Serial firmware you provide and inform you on the results.

                         

                      David

                      • 8. Re: BLE pairing using CySmart mobile-app freezes the EZ-Serial firmware on EZ-BLE CYBLE-212019-00 module
                        jrow

                        Following up after internal investigation: the EZ-Serial v1.0.2 build 21 release currently available exhibits a problem with some peers while storing bond details into flash after the pairing process completes. The symptoms are what are described here, namely that the "PR" event (smp_pairing_result) occurs and then the module becomes unresponsive. The bond detail is not stored in flash.

                           

                        Devices now known to trigger this condition (that is, not working) at least some of the time are:

                           
                              
                        • Sony Xperia XA (model F3111), Android 6.0
                        •     
                        • Lenovo C2 (model K10a40), Android 6.0
                        •     
                        • Motorola Moto G4 Play, Android 6.0.1
                        •     
                        • Nexus 7 tablet, Android 6.0
                        •    
                           

                        The issue does not appear to be app-specific (e.g. nRF Connect vs. CySmart app vs. other BLE apps), but rather device-specific. All tested iOS devices work correctly, as does the CySmart Windows application with CySmart dongle.

                           

                        A fix for this issue has been identified and will be included in the next EZ-Serial release (v1.1.x).