This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Connection problems depending on the Smartphone with nrf52840

Good afternoon,

We have developed a new equipment based on the nrf52840. We use sofldevice 's140_nrf52_6.1.0_softdevice' and we use bonding with static pin.

We have setup following parameters:

#define SEC_PARAM_BOND                      1                                       /**< Perform bonding. */
#define SEC_PARAM_MITM                      1                                      /**< Man In The Middle protection not required. */
#define SEC_PARAM_LESC                      1                                       /**< LE Secure Connections enabled. */
#define SEC_PARAM_KEYPRESS                  0                                       /**< Keypress notifications not enabled. */
#define SEC_PARAM_IO_CAPABILITIES           BLE_GAP_IO_CAPS_DISPLAY_ONLY            /**< Display Only. */
#define SEC_PARAM_OOB                       0                                       /**< Out Of Band data not available. */
#define SEC_PARAM_MIN_KEY_SIZE              7                                       /**< Minimum encryption key size. */
#define SEC_PARAM_MAX_KEY_SIZE              16                                      /**< Maximum encryption key size. */

We also agreed with you (someone in this devzone) advertisement parameters. Equipment does advertisign every 10" (for power consumption constraints) with the following parameters:

#define APP_ADV_INTERVAL                    80                                     /**< The advertising interval (in units of 0.625 ms. This value corresponds to 50 ms). */

#define APP_ADV_DURATION                    200                                  /**< The advertising duration (2 seconds) in units of 10 milliseconds. */

Device sends data once every 62.5ms, and we have defined connection parameters:

#define MIN_CONN_INTERVAL                   MSEC_TO_UNITS(7.5, UNIT_1_25_MS)        /**< Minimum acceptable connection interval (0.5 seconds). */
#define MAX_CONN_INTERVAL                   MSEC_TO_UNITS(100, UNIT_1_25_MS)        /**< Maximum acceptable connection interval (1 second). */
#define SLAVE_LATENCY                       0                                       /**< Slave latency. */
#define CONN_SUP_TIMEOUT                    MSEC_TO_UNITS(4000, UNIT_10_MS)         /**< Connection supervisory timeout (4 seconds). */

Equipment is working quite fine but, depending on the smartphone (iOS and Android) we use, we are facing the following problems, that not only happen with our application but they also happen with nRF-Connect app:

- Depending on the Smartphone, we are not asked for the PIN when pairing/bonding the first time.

- In some smartphones, it takes a lot of time (even when already bonded) to stablish connection: maximum time should be 10" (advertising period) but sometimes, it takes more and more time.

- When it takes a lot of time to connect, sometimes smartphone is able to connect when bluetooth is switched off and switched on again. But this is not happening with other devices, only with this one we have designed. Is it something related with parameters we have set up?

We would like to receive an assessment regarding all the parameters we use for setting up the connection and ways to have a more robust connection, as we have the feeling that connection robustness is weak and it is quite depending on the smartphone is being used.

Best regards,

Dani.

  • Hi Dani,

    - Depending on the Smartphone, we are not asked for the PIN when pairing/bonding the first time.

    With iOS bonding is only initiated when needed, which is after being denied to read/write to a characteristic. Once that happens, the iOS BLE stack will initiate pairing/bonding. I suspect that is what you are seeing here.

    - In some smartphones, it takes a lot of time (even when already bonded) to stablish connection: maximum time should be 10" (advertising period) but sometimes, it takes more and more time.

    Can you clarify what you mean by 10''? (It does not match your APP_ADV_INTERVAL value of 80 = 50 ms). Please elaborate.

    - When it takes a lot of time to connect, sometimes smartphone is able to connect when bluetooth is switched off and switched on again. But this is not happening with other devices, only with this one we have designed. Is it something related with parameters we have set up?

    It is not clear to me exactly which advertising parameters you use (see above). But generally you can come into a situation where the phones scan window does not overlap with the peripherals advertisement packets for a long time if the scan interval and advertising interval re very similar (or advertising interval is a multiple of the scan interval). If they are not identical, they will drift to overlap at some point though. For this reason Apple has recommended some advertising intervals that work well in the Accessory Design Guidelines for Apple Devices. Following those is generally a good idea. Also, some phones in some situations may have much less time for scanning, for instance if they allready have a lot of other BLE or other 2.4 GHz activity going on.

    Einar

Related