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

How to unblock the CPU during connection intervals with S110 v7.1.0?

How do I unblock the CPU with the S110 v7.1.0?

Parents
  • Hi,

    To disable the CPU blocking with S110 v7.1.0 or newer, you will have to use this API call:

    /**@brief Set a BLE option.
     *
     * @details This call allows the application to set the value of an option.
     *
     * @param[in] opt_id Option ID.
     * @param[in] p_opt Pointer to a ble_opt_t structure containing the option value.
     *
     * @retval ::NRF_SUCCESS  Option set successfully.
     * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
     * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
     * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, check parameter limits and constraints.
     * @retval ::NRF_ERROR_INVALID_STATE Unable to set the parameter at this time.
     * @retval ::NRF_ERROR_BUSY The stack is busy or the previous procedure has not completed.
     */
    SVCALL(SD_BLE_OPT_SET, uint32_t, sd_ble_opt_set(uint32_t opt_id, ble_opt_t const *p_opt));
    

    The options available as of now is only one, which is the mutual exclusion of radio activity and CPU usage (read block/unblock CPU in connection interval):

    /**@brief Common Option IDs.
     * IDs that uniquely identify a common option.
     */
    enum BLE_COMMON_OPTS
    {
      BLE_COMMON_OPT_RADIO_CPU_MUTEX = BLE_OPT_BASE    /**< Radio CPU mutex option. @ref ble_common_opt_radio_cpu_mutex_t */
    };
    

    And here's a small snippet on how to disable the CPU blocking:

    uint32_t opt_id = BLE_COMMON_OPT_RADIO_CPU_MUTEX;
    ble_opt_t cpu_blocking_enabled;
    cpu_blocking_enabled.common_opt.radio_cpu_mutex.enable = 0;
    ble_stack_init();
    err_code = sd_ble_opt_set(opt_id, &cpu_blocking_enabled);
    /* continue init */
    

    Cheers, Håkon

    ===============================

    Additional images showing how the CPU availability is improved when advertising (same applies when in connection):

    Before (CPU blocked during radio active): image description

    After (Concurrent CPU when radio is active): image description

    Black part showing the latency when CPU is blocked. [ADDED]: On the second trace, the CPU is still blocked at some periods because it's the softdevice active and preparing the radio packet, no the radio itself.

    Cheers,

    Hung Bui

Reply
  • Hi,

    To disable the CPU blocking with S110 v7.1.0 or newer, you will have to use this API call:

    /**@brief Set a BLE option.
     *
     * @details This call allows the application to set the value of an option.
     *
     * @param[in] opt_id Option ID.
     * @param[in] p_opt Pointer to a ble_opt_t structure containing the option value.
     *
     * @retval ::NRF_SUCCESS  Option set successfully.
     * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
     * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
     * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied, check parameter limits and constraints.
     * @retval ::NRF_ERROR_INVALID_STATE Unable to set the parameter at this time.
     * @retval ::NRF_ERROR_BUSY The stack is busy or the previous procedure has not completed.
     */
    SVCALL(SD_BLE_OPT_SET, uint32_t, sd_ble_opt_set(uint32_t opt_id, ble_opt_t const *p_opt));
    

    The options available as of now is only one, which is the mutual exclusion of radio activity and CPU usage (read block/unblock CPU in connection interval):

    /**@brief Common Option IDs.
     * IDs that uniquely identify a common option.
     */
    enum BLE_COMMON_OPTS
    {
      BLE_COMMON_OPT_RADIO_CPU_MUTEX = BLE_OPT_BASE    /**< Radio CPU mutex option. @ref ble_common_opt_radio_cpu_mutex_t */
    };
    

    And here's a small snippet on how to disable the CPU blocking:

    uint32_t opt_id = BLE_COMMON_OPT_RADIO_CPU_MUTEX;
    ble_opt_t cpu_blocking_enabled;
    cpu_blocking_enabled.common_opt.radio_cpu_mutex.enable = 0;
    ble_stack_init();
    err_code = sd_ble_opt_set(opt_id, &cpu_blocking_enabled);
    /* continue init */
    

    Cheers, Håkon

    ===============================

    Additional images showing how the CPU availability is improved when advertising (same applies when in connection):

    Before (CPU blocked during radio active): image description

    After (Concurrent CPU when radio is active): image description

    Black part showing the latency when CPU is blocked. [ADDED]: On the second trace, the CPU is still blocked at some periods because it's the softdevice active and preparing the radio packet, no the radio itself.

    Cheers,

    Hung Bui

Children
Related