- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've developed code that uses the recommended while((USBUART_CDCIsReady()) == 0){} before sending new data to the host.
All is working great if the host is connected and the port is open. As soon as a close the host port, eventually the PSoC app code hangs on the while() statement shown above.
Is there a proper way to detect if the port is open to accept new data?
Len
"Engineering is an Art. The Art of Compromise."
Solved! Go to Solution.
- Labels:
-
PSoC 5 Architecture
-
PSoC 5LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ekta,
Thank you. You method works if you have implemented a non-blocking task structure.
As it turns out, I've created a routine that works in a blocking mode or non-blocking mode depending on which you select.
See this link for the solution: PSoC5LP : USBUART component detects port close
The solution uses the SysTick timer @ 1ms to detect if the host is non-responsive within less than 2ms. If non-responsive, the routine kicks out and drops the transmitted bytes just as it would if it were a true UART.
Len
"Engineering is an Art. The Art of Compromise."