This is one of those, "should be fixed one day"

In going through the BASIC setup torture tests, we are very reliant on the serial link. But as the CPU we are writing code on is the USB controller, if that code goes wild, we need to be able to recover somewhat gracefully from it.

We have kind of a sledgehammer solution to it, but it would be nice if the driver noticed this.

Here is a sample test program (while in BASIC, C would be about the same)--

Code:
'   our code enables the serial port as part of the startup -- and the system sees it
print "this is a test"
for i= 15 downto 1
io(13)=i and 1                 ' flash the LED 7 times then die
print i
wait(1000)
next
*0xe000e188 = -1           ' turn off USB interrupts
print "are we dead yet"    ' this never gets printed
If we try to send data to the USBserial port we do get an error.

But if we try to open the port after this has been run, the USBserial driver hangs (for a long time, maybe forever)

To make sure it wasn't just our Terminal emulator, we also used TeraTerm and got the same hang trying to open the serial port