There is an unsaved comment in progress. You will lose your changes if you continue. Are you sure you want to reopen the work item?
Disruptive Interaction Between Multiple USB Controllers
If one USB controller is waiting for incoming data by continuously calling USB_Read(), data flow in another controller is blocked. In particular the debugger connection is be blocked by a user program waiting for data on a second USB port.
The reason is as follows:
When USB_Read() is called when no data is available, it calls USB_ClearEvent() which in turn clears the global SYSTEM_EVENT_FLAG_USB_IN if no data is pending in any stream of the actual controller. This happens so frequently that incoming data belonging to another controller is never handled because the flag, after being set by the second controller, is immediately reset by the next Read() in the first controller.
The problem can be avoided by a change in USB_ClearEvent():
The SYSTEM_EVENT_FLAG_USB_IN must be reset only if no data is pending in all channels of all controllers.
A corrected usb.cpp source is appended.