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

Question about the USB CDC ACM Example

Hi, before buying the PCA10056 kit, I have some questions about the USB CDC ACM example.

  1. I'm new to the USB CDC ACM.

At the Infocenter, it says that

This example shows how to use the CDC ACM USB class, commonly known as Virtual COM port.
The port can be opened and closed just like a traditional serial port.
Using a terminal emulator, for example putty,
send test data from the host computer to the development kit. LED 3 will blink.

COM

Does this mean that the nRF52840 can transfer or receive UART data without adding extra UART-USB ICs like FT232R?

If I use the USB CDC ACM example, can I read or write after I open the port from PuTTY just like using the UART example?

  1. When reading the sdk_config.h file, I couldn't find what pins are used for this example.

In the case of nRF52832-QFAA, the NFC1 and 2 pins were fixed to pin 11 and 12.

What about the nRF52840 and what pins are used for this example?

Is it the UART0 module used for the example, since it is enabled in the header file, and use pin 13 and 14?

Also, can I use any pins, except the power pins, to configure it as an USB related pins using PPI?

USB

  1. Currently, I believe this example uses the USB connector that is connected the J-Link MCU, the Atmel MCU.

However, when creating a custom PCB which is related to Li-PO USB charging such as the BQ25010, I won't populate the J-Link MCU.

D+-

In this case, how should I configure my schematic wirings to connect the nRF52840's pins directly to the USB connector (D+/D-) when supplying 3.3 volts to the nRF52840?

  1. If I want to send a file, a 16KB mp3 file for instance, from the desktop to the nRF52840 MCU and write that data to the flash memory, should I use the CDC ACM example, or something else?

-Best Regards, MANGO

  • Torbjørn, 

    I am trying to get this example to work using SDK 15.2, however the COM port does not enumerate after following your instructions of adding CDC onto the existing MSC example. The MSC part works, but the COM port does not initialize even though no errors show up while the application is running. I have tried in two different projects, with the same result.

    Any help would be appreciated. 

    Thanks,
    Jeff

  • Hi Jeff

    Have you got the CDC_ASM example to work on its own?

    Can you let me know what version of the nRF52840 DK you have?

    Best regards
    Torbjørn

  • Yes, CDC works on it's own. 
    SDK15.2 SD 6.1 with PCA10056 V1.0.0

    The only difference in porting as per your word document was:

     APP_USBD_CDC_ACM_GLOBAL_DEF(m_app_cdc_acm,
                                cdc_acm_user_ev_handler,
                                CDC_ACM_COMM_INTERFACE,
                                CDC_ACM_DATA_INTERFACE,
                                CDC_ACM_COMM_EPIN,
                                CDC_ACM_DATA_EPIN,
                                CDC_ACM_DATA_EPOUT,
                                APP_USBD_CDC_COMM_PROTOCOL_AT_V250);

    instead of:

    #define CDC_ACM_INTERFACES_CONFIG()                 \
        APP_USBD_CDC_ACM_CONFIG(CDC_ACM_COMM_INTERFACE, \
                                CDC_ACM_COMM_EPIN,      \
                                CDC_ACM_DATA_INTERFACE, \
                                CDC_ACM_DATA_EPIN,      \
                                CDC_ACM_DATA_EPOUT)
    
    
    static const uint8_t m_cdc_acm_class_descriptors[] = {
            APP_USBD_CDC_ACM_DEFAULT_DESC(CDC_ACM_COMM_INTERFACE,
                                          CDC_ACM_COMM_EPIN,
                                          CDC_ACM_DATA_INTERFACE,
                                          CDC_ACM_DATA_EPIN,
                                          CDC_ACM_DATA_EPOUT)
    };
    
    /**
     * @brief CDC_ACM class instance
     * */
    APP_USBD_CDC_ACM_GLOBAL_DEF(m_app_cdc_acm,
                                CDC_ACM_INTERFACES_CONFIG(),
                                cdc_acm_user_ev_handler,
                                m_cdc_acm_class_descriptors
    );

    Is it possible to take a look at this with the new SDK to see if i'm missing something? 
    I will try to upload a project in a few minutes.
     
    Regards,
    Jeff

  • Made a fresh project from usbd_msc included. 
    The other change I noticed is needing the inclusion of:

    // <q> APP_USBD_CDC_ACM_ENABLED  - Enabling USBD CDC ACM Class library
     
    
    #ifndef APP_USBD_CDC_ACM_ENABLED
    #define APP_USBD_CDC_ACM_ENABLED 1
    #endif
    
    // <q> APP_USBD_CDC_ACM_ZLP_ON_EPSIZE_WRITE  - Send ZLP on write with same size as endpoint
     
    
    // <i> If enabled, CDC ACM class will automatically send a zero length packet after transfer which has the same size as endpoint.
    // <i> This may limit throughput if a lot of binary data is sent, but in terminal mode operation it makes sure that the data is always displayed right after it is sent.
    
    #ifndef APP_USBD_CDC_ACM_ZLP_ON_EPSIZE_WRITE
    #define APP_USBD_CDC_ACM_ZLP_ON_EPSIZE_WRITE 1
    #endif

    Attached is the project. Note: I used Segger Embedded Studio.

    Thanks,
    Jeff
    usbd_msc_cdc.zip

  • Hi Jeff

    Are you not seeing the virtual comport at all?

    For me it shows up, but I get an error when I try to connect to it. 

    I looked through your code and tried to figure out what the problem is, but I can't see any critical difference between the original example and yours. 

    I will try to get some feedback from the developer if he has some pointers. 

    Best regards
    Torbjørn

Related