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

Disable and reenable the softdevice will return errcode 0x1001

Hi All

I am using nRF52832 with softdevice s132_nrf52.6.1.0

and I have to use both protocol (ble & gzll)

the default protocol is ble

after i keep pressing the button, the ble will disable and gzll enabled(into gzll pairing mode)

and after i release the button, gzll will disable and ble enabled

but here comes the problem 

if i release the button first time after i flash the software then sd_softdevice_enable will return error code 0x1001

but if press the pca10040 reset button to make the develop board reset, then the second or third ,,,,press of the button the error will never shows again 

here is my code

int main(void)
{
    uint32_t err_code;
    static bool b_ble_initial_flag = false;
    static bool b_gzll_initial_flag = true;
    static bool b_key_press = false;
    BleTx_Complete = 1;

    power_management_init();
    uart_init();

    // Initialize timer module, making it use the scheduler.
    app_timer_init();

    bsp_init_app();

    ble_stack_start();
    ble_app_start();
    timeslot_sd_init();
    software_control_code();
    // Enter main loop.
    for (;;)
    {
        if (bsp_button_is_pressed(0))
        {
            if (b_gzll_initial_flag) //stop ble services and start gzll
            {
                b_gzll_initial_flag = false;
                b_ble_initial_flag = true;
                ble_app_stop();
                ble_stack_stop();
                nrf_drv_clock_lfclk_request(NULL);
                bsp_indication_set(BSP_INDICATE_USER_STATE_0);
                gzll_app_start();
            }
            if (base_50ms_time_out)
            {
                base_50ms_time_out = false;
                if (b_key_press == false)
                {
                    b_key_press = true;
                    if (pairing_mode == false)
                    {
                        gzp_pairing_enable(true);
                        pairing_mode = true;
                    }
                }
                LedBlinkPorce();
            }
            rf_pairing_proc();
        }
        else
        {
            if (b_key_press == true)
            {
                if (pairing_mode == true)
                {
                    pairing_mode = false;
                    gzp_pairing_enable(false);
                }
                b_key_press = false;
                ledStatus = _LED_MODE_NONE;
            }
            if (b_ble_initial_flag)
            {
                b_ble_initial_flag = false;
                b_gzll_initial_flag = true;
                pairing_mode = false;
                nrf_drv_clock_lfclk_release();
                gzll_app_stop();
                bsp_indication_set(BSP_INDICATE_ADVERTISING);

                ble_stack_start();
                ble_app_start_02();
                timeslot_sd_init();
            }
            Ble_Uart_Trans();
        }
    }
}

i was modified by the example ble_app_gzll

can any one can help me with this problem?

Related