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

USB CDC ACM

Hi all,

I'm using SDK 15, nrf 52840, win 7,

The USB cdc example works fine for me.

Yet, when I moved the code to my project the driver is not set by win 7.

On device manager I see the device as a "USB composite device".

I used a USB analyzer and found that after few calls the code reaches the function nrf_drv_usbd_setup_stall(); - and I have no idea why.

On the sniffer I see that my code fails when reaching record "Set Configuration (configuration=1) - at this point for some reason the setup in my code reach the stall function.

As I'm not familiar with USB protocol - any help or idea regarding this is most welcome!!!

Regards,

Lior.

Parents
  • Hi,

    In general stalling an endpoint is fine in USB protocol - it just informs host that something is not supported. But the it should not stall the SET_CONFIGURATION 1 request, so I assume something has failed when you moved the code to your project.

    Hard to say now why it happens - I would suggest to turn on logger on DEBUG level and post logs from APP_USBD and APP_USBD_CDC.

    Best regards,
    Kenneth

     

     

     

  • USB_CON_FAIL.csv

    Thank you for your quick response,

    I'm using "Beagle" usb recorder - "data center",

    I am attaching a usb data records in a .csv format. Can that help you point out the issue? 

    I'm able to receive the power events (DETECT/UNDETECT) on my application.

    It looks like for some reason the com port is not opening on the PC

    Another input, the example does not use the "soft device" on it - my application does.

    Please your help,

    Regards,

    Lior.

  • Hi,

    So I'm now able to use USB CDC using the EV board with my application.

    Yet, when I move to my board, USB does not seem to activate (nothing but USB power events).

    My board has an Engineering Ctype   - I saw some erratas dealing with USBD.

    I looked on the nRF52840 Engineering C and worked according to it.

    In a strange way, nrf_drv_usbd_errata_187 which is relevant for type c , is not recognized by the SW, only when I force to execute the errata code the USB enable started to work - yet only power events active.

    Any help is most welcome,

    Regards - Lior.

  • You are right there is an error in nrf_drv_usbd_errata.h, the correct implementation of nrf_drv_usbd_errata_type_52840_fp1() should be:

    static inline bool nrf_drv_usbd_errata_type_52840_fp1(void)
    {
    return ( nrf_drv_usbd_errata_type_52840() &&
    ( ((*(uint32_t *)0xF0000FE8) & 0xF0) == 0x20 ) &&
    ( ((*(uint32_t *)0xF0000FEC) & 0xF0) == 0x00 ) );
    }

    This will be fixed in SDKv15.1.

    With this change in place, is it your custom board that is now failing, while the EV board works?

Reply
  • You are right there is an error in nrf_drv_usbd_errata.h, the correct implementation of nrf_drv_usbd_errata_type_52840_fp1() should be:

    static inline bool nrf_drv_usbd_errata_type_52840_fp1(void)
    {
    return ( nrf_drv_usbd_errata_type_52840() &&
    ( ((*(uint32_t *)0xF0000FE8) & 0xF0) == 0x20 ) &&
    ( ((*(uint32_t *)0xF0000FEC) & 0xF0) == 0x00 ) );
    }

    This will be fixed in SDKv15.1.

    With this change in place, is it your custom board that is now failing, while the EV board works?

Children
Related