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

USB CDC ACM Example is not working in interrupt mode

Hi,

On Nordic SDk 15.0, I have observed that USB CDC ACM Example is not working in interrupt mode on nrf52840 Evaluation kit.

But I have tested USB CDC ACM Example in interrupt mode on Nordic SDK 14.2 and its works fine.

To enable interrupt mode, I have modified the USB CDC ACM example of Nordic SDK 14.2 as stated in this link - 

https://devzone.nordicsemi.com/f/nordic-q-a/29641/pca10056-usb-cdc-demo-no-polling

Can you please help us to resolve the issue on Nordic SDK 15.0?

Thanks in Advance

Regards,

Deepa

 

Parents
  • Hi Deepa

    All you should have to do to make event handling interrupt driven in SDK v15 is to set APP_USBD_CONFIG_EVENT_QUEUE_ENABLE to 0 in sdk_config.h, and comment out the call to app_usbd_event_queue_process() in main.c

    Please try it out, and let me know if you have any issues with it. 

    Best regards
    Torbjørn

  • Hi Torbjorn,

    With these suggested changes, USB CDC ACM Example is not working in interrupt mode.
    Thank you for timely help.

    I have one more issue with USB CDC read functionality.
    I was unable to get APP_USBD_CDC_ACM_USER_EVT_RX_DONE / PP_USBD_CDC_ACM_USER_EVT_PORT_OPEN events when I send commands to USB port using QT Application.


    But after running the application, If I do a dummy open and close of Teraterm connecting to USB port(Say "com14") then I was able to get APP_USBD_CDC_ACM_USER_EVT_RX_DONE / APP_USBD_CDC_ACM_USER_EVT_PORT_OPEN events when I send commands to USB port using QT Application.

    Why there is a dependency on dummy open and close of Teraterm connecting to USB port(Say "com14")?
    Can I avoid this dependency?

    Thanks in Advance

    Regards,
    Deepa

  • Hi Torbjørn,

    I have two issues with USB CDC of nRF52840-
    1. USB read event failure issue in interrupt mode when dummy open and close of Teraterm connecting to USB port is done
    2. USB read event fails when dummy open and close of Teraterm connecting to USB port is not done

    With your suggested changes, issue-1 is resolved. Now I need your help for issue 2.

    Case 1: when dummy open and close of Teraterm connecting to USB port is not done
    => When I run the QT application, unable to receive USB port event interrupt and USB read event interrupt

    Case 2: when dummy open and close of Teraterm connecting to USB port is done
    => When I run the QT application, able to receive USB port event interrupt and USB read event interrupt

    The QT application works fine when I test with STM USB CDC device.
    In case of STM USB CDC device, USB read event works fine when dummy open and close of Teraterm connecting to USB port is not done
    As the QT application is working fine with STM USB CDC device, I think the issue is not in QT application.

    PFA : nrf52840 USB CDC example which I have used to reproduce the issue 2 with QT Application
    Only minor changes has done in nrf52840 USB CDC example

    I feel some intialization is missed for USB CDC example which was able to do when dummy open and close of Teraterm connecting to USB port is done

    Thanks & Regards,1401.main.zip
    Deepa

  • Hi Deepa

    I set up a small C# application to see if I could spot the issue, and indeed I do see something similar. If I try to send something from the C# application it is not received on the nRF52840 until I close the port in my application and open it in Tera Term. 

    I will have to do some more digging to figure out what is happening. 

    Best regards
    Torbjørn

  • Hi Torbjorn,

    Currently we are blocked on this issue. Can you please help us to resolve this issue ASAP?

    Thanks in Advance!!

    Regards,

    Deepa

  • Hi Deepa

    I found the problem on my end. If "DTR" is not enabled, the CDC example will not consider the port opened. I must assume Tera Term is doing this automatically, but if you write your own serial code it might not be set.

    Fixing this in my C# example was very easy:

    mSerial.DtrEnable = true;
    mSerial.Open();

    I don't know how it works with QT, but I am sure there is a similar feature to set the DTR state.

    Please give this a go, and let me know if it works for you too :)

    Best regards
    Torbjørn

  • Hi Torbjorn,

    Thanks for the update. I will check this whether we can able to add this changes in QT application.

    As stated earlier, without above stated changes, the QT application works fine with STM USB CDC Device. So it will be good if we have a fix in Nordic Application end instead of C# application.

    Can you please help us to provide a fix at Nordic USB CDC application end?

    Thanks in Advance!!

    Regards,

    Deepa

Reply
  • Hi Torbjorn,

    Thanks for the update. I will check this whether we can able to add this changes in QT application.

    As stated earlier, without above stated changes, the QT application works fine with STM USB CDC Device. So it will be good if we have a fix in Nordic Application end instead of C# application.

    Can you please help us to provide a fix at Nordic USB CDC application end?

    Thanks in Advance!!

    Regards,

    Deepa

Children
Related