This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

tuning connection parameters to minimal current consumption

Tunning connection parameters to minimize current consumption for a fitness device transmitting data to ANT+ and BLE at 1sec intervals. The desire is timeout after 60sec advertising. Formula to calculate values for a 30sec advertising timeout?

My question which is what rules should be followed to meet the above objective?

Please see example advertising and pairing connection parameters below.

ADVERTISING CONNECTION PARAMETERS

#define APP_CFG_NON_CONN_ADV_TIMEOUT  30                                  /**< Time for which the device must be advertising in non-connectable mode (in seconds). */
#define APP_CFG_CHAR_NOTIF_TIMEOUT    5000                                  /**< Time for which the device must continue to send notifications once connected to central (in milliseconds). */
#define APP_CFG_ADV_DATA_LEN          31                                    /**< Required length of the complete advertisement packet. This should be atleast 8 in order to accommodate flag field and other mandatory fields and one byte of manufacturer specific data. */
#define APP_CFG_CONNECTION_INTERVAL   20                                  /**< Connection interval used by the central (in milli seconds). This application will be sending one notification per connection interval. A repeating timer will be started with timeout value equal to this value and one notification will be sent everytime this timer expires. */
#define APP_CFG_CHAR_LEN              20                                    /**< Size of the characteristic value being notified (in bytes). */

#define APP_ADV_INTERVAL                MSEC_TO_UNITS(20, UNIT_0_625_MS)   /**< The advertising interval for connectable advertisement (20 ms). This value can vary between 20ms to 10.24s. */
#define APP_ADV_TIMEOUT_IN_SECONDS      60

PAIRING CONNECTION PARAMETERS

#define MIN_CONN_INTERVAL               MSEC_TO_UNITS(10, UNIT_1_25_MS) //16        /**< Minimum acceptable connection interval (20 ms), Connection interval uses 1.25 ms units. */
#define MAX_CONN_INTERVAL               MSEC_TO_UNITS(500, UNIT_1_25_MS) //60  /**< Maximum acceptable connection interval (75 ms), Connection interval uses 1.25 ms units. */
#define SLAVE_LATENCY                   5                                           /**< slave latency. */
#define CONN_SUP_TIMEOUT                400                                         /**< Connection supervisory timeout (4 seconds), Supervision Timeout uses 10 ms units. */
#define FIRST_CONN_PARAMS_UPDATE_DELAY  APP_TIMER_TICKS(20000, APP_TIMER_PRESCALER) /**< Time from initiating event (connect or start of notification) to first time sd_ble_gap_conn_param_update is called (20 seconds). */
#define NEXT_CONN_PARAMS_UPDATE_DELAY   APP_TIMER_TICKS(5000, APP_TIMER_PRESCALER)  /**< Time between each call to sd_ble_gap_conn_param_update after the first call (5 seconds). */
#define MAX_CONN_PARAMS_UPDATE_COUNT    3                                           /**< Number of attempts before giving up the connection parameter negotiation. */
#define ANT_CLOSE_CHANNEL_INTVL         APP_TIMER_TICKS(60000, APP_TIMER_PRESCALER) //ANT close channel timer

#define SEC_PARAM_TIMEOUT               30                                          /**< Timeout for Pairing Request or Security Request (in seconds). */
#define SEC_PARAM_BOND                  1                                           /**< Perform bonding. */
#define SEC_PARAM_MITM                  0                                           /**< Man In The Middle protection not required. */
#define SEC_PARAM_IO_CAPABILITIES       BLE_GAP_IO_CAPS_NONE                        /**< No I/O capabilities. */
#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. */
Parents
  • Hi

    I am not entirely sure I understand your question.

    To select advertising timeout of 60 seconds, i.e. when advertising should stop, you set

    #define APP_ADV_TIMEOUT_IN_SECONDS      60    
    

    like you have done in your code. Set this parameter to 0 in order to disable timeout.

    If the device is however in non-connectable mode, the advertising timeout is 30 seconds as defined with

    #define APP_CFG_NON_CONN_ADV_TIMEOUT  30 
    

    To set the advertising interval to X milliseconds, set

    #define APP_ADV_INTERVAL    MSEC_TO_UNITS(X, UNIT_0_625_MS)
    
Reply
  • Hi

    I am not entirely sure I understand your question.

    To select advertising timeout of 60 seconds, i.e. when advertising should stop, you set

    #define APP_ADV_TIMEOUT_IN_SECONDS      60    
    

    like you have done in your code. Set this parameter to 0 in order to disable timeout.

    If the device is however in non-connectable mode, the advertising timeout is 30 seconds as defined with

    #define APP_CFG_NON_CONN_ADV_TIMEOUT  30 
    

    To set the advertising interval to X milliseconds, set

    #define APP_ADV_INTERVAL    MSEC_TO_UNITS(X, UNIT_0_625_MS)
    
Children
No Data
Related