In the testing that I've done it seems that using Serial and SerialUSB at the same time does not work. If I use only Serial or only SerialUSB everything works great. I've tried this in the setup() function:
while (!SerialUSB) ;
SerialUSB.begin(0); //baud value is ignored in underlying implementation
while (!Serial) ;
It doesn't seem to matter which 3 Serial or SerialUSB statements to initialize serial communications come first. In both cases both ports stop working. I was curious why this might be the case.
Is anyone successfully doing read/write I/O through both the native and programming USB ports?? I have not tried doing end/begin calls every time I want to write something to one port or the other and just switching back and forth but that seems like a computationally expensive use case I'd want to avoid.
Any insights here would be greatly appreciated.
I'm having issues with serial ports and Due / USB - I wonder if this is something to do with baud rate? Have you tried lower rates?
I have tried different baud rates for the actual Serial port and it doesn't seem to matter. Of course if you go read the code for the implementation of SerialUSB The .begin function is a dummy function there for backward compatibility which has an empty code block. This makes sense since it is a native USB end point so that call (SerialUSB.begin(bps)) in my latest code is actually commented out since it is just unnecessary overhead.