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

USB HID (physical) + BLE

Dear Nordic community,

we as a company, have developed products with the nRF52832... currently, we're developing a product with the nRF52840 (because we needed USB).

My development setup is as follows: 

OS: Windows 10 Pro

FW: nRF5_SDK_15.3.0_59ac345

SW: SES v4.18 (64 bits)

The product that we're currently developing use different features: SPI, UART, BLE, USB Hid, FreeRTOS, among others. 

That's why we took as an example for our main Firmware project the one called: usbd_ble_uart_freertos, from the SDK. But this project uses USB class: cdc_acm. We need to implement the HID class.

First... to test that the USB HID worked fine on our PCB, we modified the example from the SDK called: usb_hid_generic. To make it work (and it works fine). But this project only has USB functionality, anything else.

We have made progress on the main project... (based on usbd_ble_uart_freertos) and now we need to add USB HID functionality. I have added all the .c files, added the .h routes, and check project configuration (compared to the project where USB works). 

Also... I've detailed checked for sdk_config file. And i don't see differences that could make project to fail Build. Because that's what happens... Build fails with no error message: 

As in the main project, we're using BLE (S140), i've seen that code on CRITICAL_REGIONS runs when softdevice is enabled. This could be why the size of the code is different?... I tried to compare them (it was something that came to my attention...)

Project where USB HID works fine: 

Main project ... trying to add USB HID functionality: 

Finally... i've also noticed that on the project where usb works, this folder is being included on .h files: (SDK)/components/drivers_nrf/nrf_soc_nosd, and also from his folder... the files: nrf_nvic.c and nrf_soc.c. 

But on the main project, where BLE is enabled, i'm using this folder for .h files: (SDK)/components/softdevice/s140/headers (because of nrf_error.h)... and on this folder there is no nrf_nvic.c and nrf_soc.c files. So i suppose they're not needed if BLE is enabled. But i'm not sure. 

Please, any recommendation that could help us solve this issue will be really appreciated. Maybe... another way to check... or something that we could be missing to review. 

Thank you so much! 

Parents
  • Hello,

    What are the warnings and errors you get when you try to build the project? If you double click the warnings, you should see what they are, and you probably have at least one error as well, since the build failed. 

    Best regards,

    Edvin

  • Hello Edvin, 

    thank you so much for you fast reply. Please find attached the warnings that it shows... Those warnings are from main.c... and on the previous version of the project (where it didn't has USB functionality, the same warnings appeared, and it compiled successfully): 

    Current version - build failed:

    But... i modified one file: app_usbd_hid_generic.c, as follows: 

    I made the change because of this error... but not sure if that was ok. 

    On the previous version of the project (where no USB functionality was added... The same warnings appeared, and it compiled successfully: 

    Probably my mistake was to change the app_usbd_hid_generic.c file. But... how can I avoid that error? 

    Thank you so much!

  • mauro_nx said:
    I made the change because of this error... but not sure if that was ok. 

     I see. I would try to move only the "rety_code_t ret" outside the critical region if this caused any issues during compilation:

    NRF_DRV_USBD_TRANSFER_IN(transfer, p_buff, size);
    ret_code_t ret;
    
    CRITICAL_REGION_ENTER();
    ret = app_usbd_ep_transfer(ep_addr, &transfer);
    if (ret == NRF_SUCCESS)
    {
        app_usbd_hid_state_flag_set(&p_generic_ctx->hid_ctx,

    But are you sure this "ret" is the "ret" instance that it was actually pointing to?

    what happens if you double click the "build failed"? Does anything else pop up?

    It looks like you are using SES, is that correct? What version? Can you try to update it to a later version from here?

Reply
  • mauro_nx said:
    I made the change because of this error... but not sure if that was ok. 

     I see. I would try to move only the "rety_code_t ret" outside the critical region if this caused any issues during compilation:

    NRF_DRV_USBD_TRANSFER_IN(transfer, p_buff, size);
    ret_code_t ret;
    
    CRITICAL_REGION_ENTER();
    ret = app_usbd_ep_transfer(ep_addr, &transfer);
    if (ret == NRF_SUCCESS)
    {
        app_usbd_hid_state_flag_set(&p_generic_ctx->hid_ctx,

    But are you sure this "ret" is the "ret" instance that it was actually pointing to?

    what happens if you double click the "build failed"? Does anything else pop up?

    It looks like you are using SES, is that correct? What version? Can you try to update it to a later version from here?

Children
Related