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

nRF52840 DK USB HID with SoftDevice Fails with nRF5_SDK_15.0.0_a53641a

Hello Nordic Experts,

I'd like to add the usb hid composite to one of BLE examples. I followed link below and combined the example usbd_hid_composite with ble_app_blinki_c. 

https://devzone.nordicsemi.com/f/nordic-q-a/28119/nrf52840-template-project-for-usb-and-ble/110929#110929

The BLE part works fine, but I use Bus Hound to monitor the USB and there is no sign of any USB device. Can you please help me understand what is wrong here.

I just copied/pasted all definitions&declarations from usbd_hid_composite (excluding CLI interface) to the ble example, and added all required path/files to the project. I then set

#define USBD_POWER_DETECTION false

and in sdk_config.h,

#define APP_USBD_CONFIG_POWER_EVENTS_PROCESS 0

#define POWER_ENABLED 0

#define USBD_ENABLED 1

#define APP_USBD_ENABLED 1

#define APP_USBD_VID 0x1915

#define APP_USBD_PID 0x520B

#define APP_USBD_HID_ENABLED 1

#define APP_USBD_HID_KBD_ENABLED 1

#define APP_USBD_HID_MOUSE_ENABLED 1

This is my main

int main(void)
{

ret_code_t ret;
static const app_usbd_config_t usbd_config = {
.ev_state_proc = usbd_user_ev_handler,
};
log_init();

ret = NRF_LOG_INIT(NULL);
APP_ERROR_CHECK(ret);

ret = nrf_drv_clock_init();
APP_ERROR_CHECK(ret);

nrf_drv_clock_lfclk_request(NULL);
while(!nrf_drv_clock_lfclk_is_running())
{
/* Just waiting */
}

ret = app_timer_init();
APP_ERROR_CHECK(ret);

ret = app_timer_create(&m_mouse_move_timer, APP_TIMER_MODE_REPEATED, mouse_move_timer_handler);
APP_ERROR_CHECK(ret);

init_bsp();
//init_cli();

ret = app_usbd_init(&usbd_config);
APP_ERROR_CHECK(ret);

app_usbd_class_inst_t const * class_inst_mouse;
#if CONFIG_HAS_MOUSE
class_inst_mouse = app_usbd_hid_mouse_class_inst_get(&m_app_hid_mouse);
#else
class_inst_mouse = app_usbd_dummy_class_inst_get(&m_app_mouse_dummy);
#endif
ret = app_usbd_class_append(class_inst_mouse);
APP_ERROR_CHECK(ret);

app_usbd_class_inst_t const * class_inst_kbd;
#if CONFIG_HAS_KBD
class_inst_kbd = app_usbd_hid_kbd_class_inst_get(&m_app_hid_kbd);
#else
class_inst_kbd = app_usbd_dummy_class_inst_get(&m_app_kbd_dummy);
#endif
ret = app_usbd_class_append(class_inst_kbd);
APP_ERROR_CHECK(ret);

// Initialize.

//timer_init();
leds_init();
//buttons_init();
power_management_init();
ble_stack_init();
gatt_init();
db_discovery_init();
lbs_c_init();

// Start execution.
NRF_LOG_INFO("Blinky CENTRAL example started.");
scan_start();

if (USBD_POWER_DETECTION)
{
//ret = app_usbd_power_events_enable();
APP_ERROR_CHECK(ret);
}
else
{
NRF_LOG_INFO("No USB power detection enabled\r\nStarting USB now");

app_usbd_enable();
app_usbd_start();
}

// Turn on the LED to signal scanning.
bsp_board_led_on(CENTRAL_SCANNING_LED);

// Enter main loop.
for (;;)
{
idle_state_handle();
}
}

Thanks

Parents Reply Children
No Data
Related