Arduino Leonardo Communication issues

Hi,
This is kind off a continuation of this thread Atxmega Series development - Microcontrollers - Arduino Forum(in a way its not thought it would be better to start off a new one). I am trying to develop a new Atxmega128a3u board(Preferably arduino compatible). Now the board is ready and I was able to bootload it with JTAGICE3 and I was able to do blinky program with Atmel studio 6. I was able to upload it via flip and its working fine. :slight_smile:

Now since this is not arduino compatible, I wanted to know how I would do USB communication between PC and uC. (Same as the serial.print in arduino terms). I asked this here because, ATXmega128a3u also uses native USB communication as Arduino leonardo. Doesnt Leonardo virtualizes a serial communication over USB? I wanted to know how it does that and where this exception is handled in the Arduino codes because all other boards work via UART and Leonardo works via native USB. (and it uses same Serial commands to do it in Leonardo and)
Can anyone tell me how(and where) this is done in Leonardo? If I can figure that out I might be able to do that same thing with Atxmega128a3u.

The Leonardo is based off of the LUFA USB stack. http://www.fourwalledcubicle.com/LUFA.php

Thanx for that info :slight_smile:
But where in the arduino folder is this exception written into?? I am not able to find out where.

Check out, \arduino-1.0.4\hardware\arduino\bootloaders\caterina.

Thank you will check it out :slight_smile: