How to implement full duplex communication on USBX CDC ACM?


It looks like USBX CDC ACM API is blocking only, not asynchronous.


The provided examples (CDC ACM module guide and Communications FW on USBX) implement use pattern when USB thread calls read function and blocks until something is received. Then the thread calls write function to send a feedback.

What if upstream and downstream data flows are not synchronised? How to implement continuous sending and waiting of reception at the same time?

Is any example about this?

Is it possible to get callback when data is received? I see that USBX HID has such a callback while USBX ACM does not.

Should I have two threads? While one will be blocked in read function other will pump data in upstream? 

Could you comment?


  • Hi,
    I have just uploaded an E2Studio project "" to the Synergy Media Gallery on this forum.
    It is written for SSP1.5.2

    Please have a look. I think it should meet your requirements.

    The example continuously transmits a data string - "Hello World - xxxxxxx".
    It is also continuously receiving data. After receiving 8 bytes the the data string will change to "Goodbye World - xxxxxx".
    After a further 8 bytes, the data string will change to "<previously received data> - xxxxxx", where xxxxxx is an incrementing counter value added to each string.
    After a further 8 bytes, the string resets to "Hello World - xxxxxx"
    The process repeats continuously.

  • In reply to Richard:

    And here is a version for the SK-S7G2:

  • In reply to WarrenM:

    Thanks Warren,

    Yes I actually play with SK-S7G2.

    However I use IAR.
    How do I convert E2Studio project into IAR project?

  • In reply to Richard:

    Thanks Richard,

    Your project answers my questions.
    So the solution is to use two threads.

    Also I've learned useful tricks from your code: how to handle USB disconnect and how to get DTR status. I haven't seen this from other examples. Good.