Welcome in the forum!
You can get stuck depending on the state of the USBUART.
I would suggest you to modify one of the example projects for your need. Right click on the USBUART component (on your topdesign or in component catalog) and select "Find Code Example".
That is the example code for USBFS_UART. Is there another example project?
Can a timer be used as a way to get unstuck? What is a reasonable duration?
Does the unmodified example project get stuck in USBFS-UART?
What changes did you exactly make?
Can you please post your complete project, so that we all can have a look at all of your settings. To do so, use
Creator->File->Create Workspace Bundle (minimal)
and attach the resulting file.
I did not modify the code and it has not gotten stuck, but that while statement looks vulnerable. Your initial response makes me more worried.
Sorry, this is a misunderstanding.
The while-loop you questioned in your first post will indeed wait until the connection is OK. In a real project you may of course try it only once and ask to connect when failed. But how to "ask" when using a prototyping kit? (Light an LED, try in a while until OK, then switch off the LED.) You cannot proceed with the project when the USB connection is not established.