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

USB HID and BLE working together ,

When bluetooth only is enabled, the program has no problems.After adding USB, the program crashes。How am I supposed to initialize it, is it a matter of order

<info> app: log_init

int main(void)
{
	log_init();
    ret_code_t err_code;
    timers_init();
    usb_keyboard_init();
    ble_init();

    err_code = app_timer_create(&m_keyboard_scan_timer, APP_TIMER_MODE_REPEATED, keyboard_scan_handler);
    APP_ERROR_CHECK(err_code);   
    err_code = app_timer_start(m_keyboard_scan_timer, APP_TIMER_TICKS(KEYBOARD_SCAN_INTERVAL), NULL);
    APP_ERROR_CHECK(err_code);
    for (;;)
    {
        while (app_usbd_event_queue_process())
        {
            /* Nothing to do */
        }
        idle_state_handle();
    }
}
void ble_init(void)
{
	power_management_init();
	ble_stack_init();
	gap_params_init();
	gatt_init();
	advertising_init();
	services_init();
    conn_params_init();
	advertising_start();
}

<info> app: timers init

<info> CLOCK: Function: nrfx_clock_init, error code: NRF_SUCCESS.

<info> CLOCK: Module enabled.

<info> clock: Function: nrf_drv_clock_init, error code: NRF_SUCCESS.

<info> app: USBD HID composite example started.

<info> app: USB power detected

<error> app: Fatal error

Related