Use UART0 interface of Arduino Mega (Ardupilot Mega 2.6) while USB not connected

Hi guys,

I'm currently trying to use the UART0 interface of my APM2.6 to receive some data from a second board and have a problem. In code I have a loop like

while(Serial.available()>0)
{
Serial.read();
}
Serial.flush();
}

and it works just fine, but as soon as I disconnect the USB cable it stops working. Can I somehoy use UART2 (and what is its interface in code?)

Thanks,
rian

Does it work if you take Serial.flush out?
That's normally not needed.