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

ERROR 8 [NRF_ERROR_INVALID_STATE] at ..\..\..\main.c:1056 PC at: 0x0003062D {SDK_17.1.0 S132}

Hello, 

I am trying to advertise twice in my project with different gap_params.

First, I have started advertising with the following conn_params (shown below)

#define MIN_CONN_INTERVAL_ADV MSEC_TO_UNITS(1000, UNIT_1_25_MS) /**< Minimum acceptable connection interval (0.5 seconds). */
#define MAX_CONN_INTERVAL_ADV MSEC_TO_UNITS(1000, UNIT_1_25_MS) /**< Maximum acceptable connection interval (1 second). */

in the function gap_params_init_ADV() as:

static void gap_params_init_ADV(void){
ret_code_t err_code;
ble_gap_conn_params_t gap_conn_params;
ble_gap_conn_sec_mode_t sec_mode;

BLE_GAP_CONN_SEC_MODE_SET_OPEN(&sec_mode);

err_code = sd_ble_gap_device_name_set(&sec_mode,
(const uint8_t *)DEVICE_NAME,
strlen(DEVICE_NAME));
APP_ERROR_CHECK(err_code);

memset(&gap_conn_params, 0, sizeof(gap_conn_params));

gap_conn_params.min_conn_interval = MIN_CONN_INTERVAL_ADV;
gap_conn_params.max_conn_interval = MAX_CONN_INTERVAL_ADV;
gap_conn_params.slave_latency = SLAVE_LATENCY;
gap_conn_params.conn_sup_timeout = CONN_SUP_TIMEOUT;

err_code = sd_ble_gap_ppcp_set(&gap_conn_params);
APP_ERROR_CHECK(err_code);

after then I have stopped advertising and trying to advertise again with different conn_params (shown below)

#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). */

in the function gap_params_init() as:

static void gap_params_init(void){
ret_code_t err_code;
ble_gap_conn_params_t gap_conn_params;
ble_gap_conn_sec_mode_t sec_mode;

BLE_GAP_CONN_SEC_MODE_SET_OPEN(&sec_mode);

err_code = sd_ble_gap_device_name_set(&sec_mode,
(const uint8_t *)DEVICE_NAME,
strlen(DEVICE_NAME));
APP_ERROR_CHECK(err_code);

memset(&gap_conn_params, 0, sizeof(gap_conn_params));

gap_conn_params.min_conn_interval = MIN_CONN_INTERVAL;
gap_conn_params.max_conn_interval = MAX_CONN_INTERVAL;
gap_conn_params.slave_latency = SLAVE_LATENCY;
gap_conn_params.conn_sup_timeout = CONN_SUP_TIMEOUT;

err_code = sd_ble_gap_ppcp_set(&gap_conn_params);
APP_ERROR_CHECK(err_code);

But I am getting an error "ERROR 8 [NRF_ERROR_INVALID_STATE] at ..\..\..\main.c:1056 PC at: 0x0003062D" in the function services_init() in the following lines:-

err_code = nrf_ble_qwr_init(&m_qwr, &qwr_init);
APP_ERROR_CHECK(err_code);

Kindly, help me getting through it.


Thanks

  • Looking at the implementation of nrf_ble_qwr_init() it looks like this error simply is caused by the module is already initialized:

    if (MODULE_INITIALIZED)
    {
        return NRF_ERROR_INVALID_STATE;
    }

    Have you tried to simply ignore the error?

Related