5 Replies Latest reply on Nov 18, 2018 9:52 PM by PY_21

    BLE pairing and reconnecting

    simcc_1526081

      We currently have a cypress BLE sensor (custom profile) which resides in deep sleep mode. When we press the reset button, it comes out of this mode and starts advertising. We want some form of security so we are using pairing with security Mode 1 , unauthenticated with encryption.

      The system connects to an smart phone and the connection will last for about 30 minutes. I am looking for the easiest way to perform a fast reconnect should the connection be dropped during the session. We dont need a permanent whitelist but we probably need some form of bonding to make the reconnection process quicker. If the connection is dropped for over 30 seconds, we will assume that the session is over and we will enter deep sleep mode again with no record being kept of the previous session.

      All advice greatly appreciated

        • 1. Re: BLE pairing and reconnecting

          Hello,

           

          If the device is bonded there is will be no need to  re-do the pairing process as the keys will be stored.

          So enabling bonding in your project and storing the bonded data will help.

           

          Below project can be a place to get started on bonding

          http://www.cypress.com/blog/problem-solver/project-015-bonding

          • 2. Re: BLE pairing and reconnecting
            simcc_1526081

            Thank you for the response. I have been looking at that example. I think what is unclear to me is the bonding process.

             

            My module is set up for security mode 1 with unauthenticated encryption and the bonding option is selected.

             

            I can connect to the cypress dongle and pair and when I look at the dongle information it contains the bonding information and keys so it seems to have bonded OK and everything works fine.

             

             

             

            Case 1

             

            If, from the dongle, I break the connection and reconnect, if I try to read the characteristics, I get the message:

             

            “Read characteristic value failed. Insufficient encryption”

             

            I then have to pair again, at which point I can read the information. Should the connection not automatically recognize the dongle?

             

            Case 2

             

            If I remove power from the my device and connect again, when I connect the dongle to my device, I cannot access the characteristic, but also I cannot pair. I have to remove the whitelist in the dongle before I can pair.

             

             

             

            So, in my implementation, I have not yet stored any of the configuration data into EEPROM so I would nearly expect an error here.

             

            However in case 1, as the system has not been reset, I would have expected it still to be there – why do I have to pair again.

             

             

             

            Thanks for the help

             

             

             

            Simon

            • 3. Re: BLE pairing and reconnecting

              Hi Simon,

               

              In case -1 If the link has to be encrypted, then either of the two BLE devices should send an authentication/encryption request.

              This is done when you click the Pair button. So, independent of whether bonded or not, either of the devices should send an encryption request or pairing request to encrypt the link. 

              This is the reason you are required to pair again.

               

              Thanks,

              Ranjith

              • 4. Re: BLE pairing and reconnecting
                simcc_1526081

                Thank you for the email Ranjith,

                 

                I am getting very different answers from the various web searches that I am doing so just to clarify:

                 

                 

                 

                If I have made a connection and am bonded, if I drop the connection, if I want to reconnect,  I have to go through the pairing process again even though the LTKs are known?

                 

                In other documents that I have read, it states that for a bonded system, the pairing process does not need to be repeated – this is where is confusion is.

                 

                 

                 

                Many thanks

                 

                 

                 

                Simon

                • 5. Re: BLE pairing and reconnecting
                  PY_21

                  Hello Simon,

                   

                  Extremely sorry for the delayed response.

                  Bonding is the process in which the keys and identity information exchanged are saved. After devices are bonded, they do not have to go through the pairing process again when reconnected.

                  In case 1 - Are you able to Read in CySmart Android App ? Could you please let us know what is the version of Cypress Dongle which you are using. Pease check the security parameters in master configuration as well.

                  When we change the security level to "unauthenticated with encryption", then the characteristic values will be encrypted as shown in attached image. Can you change the encryption in Read permissions to "No encryption required" and check the results.

                  In case 2 - Please make sure that the bonding data is stored (using the API CyBle_StoreBondingData()). We should store the bonding information in Flash by multiple call of CyBle_StoreBondingData().

                   

                   

                   

                  Thanks,

                  P Yugandhar.