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

multiple nRF52840's USB CDC ACM instances

Hi, a question may need your kind help. Just wonder if nRF52840's USB CDC ACM could support multiple instances? For example, would it support CLI as well as an another serial instance like for AT command? If could , how could I get these? Many thanks.

Parents
  • Hi 

    Yes, the USBD driver uses a modular structure that allows you to instantiate multiple different classes, the only limitation being the number of IN/OUT endpoints supported by the USBD interface. 

    I made a quick version of the usbd_cdc_acm example in nRF5 SDK v15.3.0 to demonstrate this, setting up two unique CDC instances, and you will find the main file below:

    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Best regards
    Torbjørn

  • Torbjörn:

    I grabbed your example main file but alas it did not compile out of the box with the default parameters in the "CLI" demo. I added in app_usbd_serial_num.c and bsp_cli.c and removed "while (app_usbd_event_queue_process())" because first the function wasn't being built and then when I turned on APP_USBD_CONFIG_EVENT_QUEUE_ENABLE I got a compile error indicating 

    #error "Current CLI CDC implementation supports only USB with event queue disabled (see APP_USBD_CONFIG_EVENT_QUEUE_ENABLE)"

    so I modded it not to do that call and do nrf_cli_process instead, for each instance. But alas things did not work properly.

    Is there any chance you could zip up and attache  complete working project? I would like (although don't *need*) to have two virtual comports between my PC and dongle for some debugging I need to do.

  • Hi Rob

    You will find the full example attached:
    238013_usbd_cdc_acm_dual_cdc.zip

    Hopefully you will have more success with it. 

    Best regards
    Torbjørn

  • Thank you, good sir. 

    I will try it today.

  • That worked quite well. But it confused Windows 7 a lot - W7 could only assign a driver to one of the CDC ports. W10 and Mac OS did fine, though. I wonder if W7 is confused because both are "CDC Test". Any idea how one would label one of them "CDC Data" and the other "CDC Commands"? 

Reply
  • That worked quite well. But it confused Windows 7 a lot - W7 could only assign a driver to one of the CDC ports. W10 and Mac OS did fine, though. I wonder if W7 is confused because both are "CDC Test". Any idea how one would label one of them "CDC Data" and the other "CDC Commands"? 

Children
  • Hi Rob

    I had a similar question earlier in Devzone, but unfortunately I was unable to find a good way to label the comports. 

    I have a suspicion it is related to the .inf file in Windows 7, but I haven't been able to confirm it. 

    "CDC test" is the product string, which you should be able to reference separately from each CDC instance, but we don't have any examples showing how to do this unfortunately (nor have we tested if this would work on Windows 7). 

    Best regards
    Torbjørn

  • No problem. W7 is something I use less and less. I'm finding Linux to be more useful as a test platform these days. 

    Thanks for the example - I'll be able to do good things with it! 

  • Hi Rob

    Now that MS effectively deprecated W7 it's definitely not a recommended platform ;)

    The best of luck with your project Slight smile

    Best regards
    Torbjørn