Disconnecting USB cable stalls 32U4

I’ve been working on this project for many months and have always left a USB plugged into the board (A-Star 32U4) and all has been well.

Now that the project is nearing completion, I wanted to see it run “standalone” with just the external supply and serial data coming on on Serial1 from a Processing app.

Everything is FINE as long as that USB is plugged in. The second I unplug it the 32U4 locks up and does no further processing. When the USB is restored - the board returns to operating.

Since I don’t think this is a coding issue I’m not including any code other than the startup stuff. As I say - it DOES work fine - just unplugging the USB seems to upset things. Is there something about this chip that needs to be done differently? Being the same as the Leonard, there is an extra reset done - but don’t know what I could do in code if that makes a diff.

Again - take note - no extensive code is included with this question as I don’t think it is REALLY a coding issue - and none of the project uses Serial other than for debug.


Serial.begin(57600);
	while (!Serial); 

	ComLink.begin(57600);
	byte flush = ComLink.read();  // see if a read clears things up

	tstBut.begin();
	//homeAll();

	Serial.println("System is up!");

while (!Serial);

means "Do nothing until the USB serial is connected"

Ah Ha! So I only need that code when using Serial for debug...Duh! I just have to comment that out for the “release” version. Fingered it had to be something like that. Thanks.