I am using Atmel Studio 7 to write code for the atxMega64B1. The USB port is configured as a CDC with stdio and is generally behaving, but I have one problem I can't sort out.
The USB port will be used primarily for manufacturing calibration and test, so it won't always be connected to a host. It will be plugged into a charger most of the time.
I want to stream measurement data out the USB port as the device operates using . This works fine as long as it is connected to a host and a terminal program (I use teraterm) is running.
If there is no data sink like teraterm, eventually the transmit buffer on the xmega fills up. At this point my software hangs, waiting for more room in the buffer. This is bad.
I see two options:
1) Detect that there is or is not a data sink of some kind and then choose whether to send data.
2) set the USB port so that it does not hang if the buffer is full.
I've not been able to find any clues about how to do either of those. I've searched both this forum and the Atmel ASF docs, such as they are.
Any ideas or pointers?