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

Run into "NRF_BREAKPOINT_COND" in debug mode from services_init()

Hi all,

I'm working on the example "multiprotocal" and trying to replace the system initialization from the example "ble_app_uart" by using SDK15.2

and after modified few days, I flashed it to the developing board pca10040 with nRF52832.

here comes the problem, the board doesn't work.

so I try to run the program in debug mode, and it run into "NRF_BREAKPOINT_COND" after the function "ble_nus_init(&m_nus, &nus_init);" in services_init(); which is call in main

int main(void)
{
    uint32_t err_code;
    radio_mode_t previous_mode = running_mode;
    static uint8_t button_press_flag = 0;
    bool erase_bonds;

    BleTx_Complete = 1;

    uart_init();   // Initialize uart module.
    log_init();    // Setup logger.
    timers_init(); // Initialize timer module, making it use the scheduler.
                   //buttons_leds_init(&erase_bonds);
    // Initialize bsp
    bsp_init_app();

    power_management_init();
    ble_stack_init();
    gap_params_init();
    gatt_init();
    services_init();
    advertising_init();
    conn_params_init();

    NRF_LOG_FLUSH();

    software_control_code();
    advertising_start();
    // Enter main loop.
    for (;;)
    {
    }
}

void services_init(void)
{
    // Flag that prevents from Queued Write module reinitialization.
    uint32_t err_code;
    ble_nus_init_t nus_init;
    nrf_ble_qwr_init_t qwr_init = {0};

    // Initialize the Queued Write module.
    qwr_init.error_handler = nrf_qwr_error_handler;

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

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

    nus_init.data_handler = nus_data_handler;

    err_code = ble_nus_init(&m_nus, &nus_init);
    APP_ERROR_CHECK(err_code);
}

and if i mark the APP_ERROR_CHECK(err_code), the services_init() will be ok, but the next function advertising_init(); will run into the same situation when the program runs APP_ERROR_CHECK(err_code)

void advertising_init(void)
{
    uint32_t err_code;
    ble_advertising_init_t init;

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

    init.advdata.name_type = BLE_ADVDATA_FULL_NAME;
    init.advdata.include_appearance = false;
    init.advdata.flags = BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE;

    init.srdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
    init.srdata.uuids_complete.p_uuids = m_adv_uuids;

    init.config.ble_adv_fast_enabled = true;
    init.config.ble_adv_fast_interval = APP_ADV_INTERVAL;
    init.config.ble_adv_fast_timeout = APP_ADV_DURATION;
    init.evt_handler = on_adv_evt;

    err_code = ble_advertising_init(&m_advertising, &init);
    APP_ERROR_CHECK(err_code);

    ble_advertising_conn_cfg_tag_set(&m_advertising, APP_BLE_CONN_CFG_TAG);
}

I don't know why, can anyone can tell me how to improve it?

Parents Reply Children
Related