CDC connection problem

1 post / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,

I use the asf UDI_cdc stack and have from time to time problem when connecting and disconnecting the USB.

In my application the device shall write to the PC after been connected.
Doing this the stack hang.
Before writing I have this check:

if ( (USB.CTRLA & USB_ENABLE_bm) && (USB.ADDR != 0) && !(USB.STATUS & USB_SUSPEND_bm) ) {
  if ( udi_cdc_is_tx_ready() ) {

etc.

In the function udi_cdc_write_buf I have also put a code for timeout if udi_cdc_is_tx_ready() is not ready.
I'm running FreeRTOS.

Are there any other way to check that the USB is ready before transmitting?