sd_ble_gap_adv_set_configure() and ble_advertising_start() failed with errCode 0x8

Triggering advertising by button pressed. But when advertising state is not idle. Both sd_ble_gap_adv_set_configure() and ble_advertising_start() failed with errCode 0x8.

00> <info> app: POWER_ON.
00> <info> app: BLE_ADV_EVT_FAST
00> <info> app: NRF_GPIOTE_POLARITY_TOGGLE
00> <info> app: button released
00>
00> <info> app: NRF_GPIOTE_POLARITY_TOGGLE
00> <info> app: button pressed
00> <warning> app: sd_ble_gap_adv_set_configure() failed, ret=0x8
00> <warning> app: ble_advertising_start() failed errCode=0x8
00> <info> app: NRF_GPIOTE_POLARITY_TOGGLE
00> <info> app: button released
00>
00> <info> app: BLE_ADV_EVT_IDLE
00> <info> app: NRF_GPIOTE_POLARITY_TOGGLE
00> <info> app: button pressed
00> <info> app: BLE_ADV_EVT_FAST
00> <info> app: NRF_GPIOTE_POLARITY_TOGGLE
00> <info> app: button released

Parents
  • Looking at the documentation for sd_ble_gap_adv_set_configure() and nrf_error.h I can find that 8 means NRF_ERROR_INVALID_STATE.

    /**@brief Configure an advertising set. Set, clear or update advertising and scan response data.
     *
     * @note  The format of the advertising data will be checked by this call to ensure interoperability.
     *        Limitations imposed by this API call to the data provided include having a flags data type in the scan response data and
     *        duplicating the local name in the advertising data and scan response data.
     *
     * @note In order to update advertising data while advertising, new advertising buffers must be provided.
     *
     * @mscs
     * @mmsc{@ref BLE_GAP_ADV_MSC}
     * @endmscs
     *
     * @param[in,out] p_adv_handle                         Provide a pointer to a handle containing @ref BLE_GAP_ADV_SET_HANDLE_NOT_SET to configure
     *                                                     a new advertising set. On success, a new handle is then returned through the pointer.
     *                                                     Provide a pointer to an existing advertising handle to configure an existing advertising set.
     * @param[in]     p_adv_data                           Advertising data. If set to NULL, no advertising data will be used. See @ref ble_gap_adv_data_t.
     * @param[in]     p_adv_params                         Advertising parameters. When this function is used to update advertising data while advertising,
     *                                                     this parameter must be NULL. See @ref ble_gap_adv_params_t.
     *
     * @retval ::NRF_SUCCESS                               Advertising set successfully configured.
     * @retval ::NRF_ERROR_INVALID_PARAM                   Invalid parameter(s) supplied:
     *                                                      - Invalid advertising data configuration specified. See @ref ble_gap_adv_data_t.
     *                                                      - Invalid configuration of p_adv_params. See @ref ble_gap_adv_params_t.
     *                                                      - Use of whitelist requested but whitelist has not been set,
     *                                                        see @ref sd_ble_gap_whitelist_set.
     * @retval ::BLE_ERROR_GAP_INVALID_BLE_ADDR            ble_gap_adv_params_t::p_peer_addr is invalid.
     * @retval ::NRF_ERROR_INVALID_STATE                   Invalid state to perform operation. Either:
     *                                                     - It is invalid to provide non-NULL advertising set parameters while advertising.
     *                                                     - It is invalid to provide the same data buffers while advertising. To update
     *                                                       advertising data, provide new advertising buffers.
     * @retval ::BLE_ERROR_GAP_DISCOVERABLE_WITH_WHITELIST Discoverable mode and whitelist incompatible.
     * @retval ::BLE_ERROR_INVALID_ADV_HANDLE              The provided advertising handle was not found. Use @ref BLE_GAP_ADV_SET_HANDLE_NOT_SET to
     *                                                     configure a new advertising handle.
     * @retval ::NRF_ERROR_INVALID_ADDR                    Invalid pointer supplied.
     * @retval ::NRF_ERROR_INVALID_FLAGS                   Invalid combination of advertising flags supplied.
     * @retval ::NRF_ERROR_INVALID_DATA                    Invalid data type(s) supplied. Check the advertising data format specification
     *                                                     given in Bluetooth Specification Version 5.0, Volume 3, Part C, Chapter 11.
     * @retval ::NRF_ERROR_INVALID_LENGTH                  Invalid data length(s) supplied.
     * @retval ::NRF_ERROR_NOT_SUPPORTED                   Unsupported data length or advertising parameter configuration.
     * @retval ::NRF_ERROR_NO_MEM                          Not enough memory to configure a new advertising handle. Update an
     *                                                     existing advertising handle instead.
     * @retval ::BLE_ERROR_GAP_UUID_LIST_MISMATCH Invalid UUID list supplied.
     */
    SVCALL(SD_BLE_GAP_ADV_SET_CONFIGURE, uint32_t, sd_ble_gap_adv_set_configure(uint8_t *p_adv_handle, ble_gap_adv_data_t const *p_adv_data, ble_gap_adv_params_t const *p_adv_params));

    I suggest to read the description for NRF_ERROR_INVALID_STATE and see if any of those explain your issue.

    Best regards,
    Kenneth

Reply Children
No Data
Related