Serial doesn't initialise on Arduino Mega 2560 when not powered via the USB port I am working on a project with a Mega 2560 and a Sim800L module.

Everything works fine, however if i don't connect the USB port (at least once) and power only externally (either by Vin unregulated 7-12V or 5V regulated pin)
the program will seem not to initialize serial in setup().

I found this which is related to the issue but not a proper workaround:
https://forum.arduino.cc/index.php?topic=24642.0

edit: I can confirm using a resistor to short pins 0+1 together (serial) works but it is not a proper solution. This means you have to disassemble your project to access the resistor or add a switch if you want to use USB to debug later or upload new code. Another workaround which i need to test is to remove all Serial code (because i can in my specific project), but again this is not a proper solution.
Any ideas please?

edit2: 
for comments

if(SIM900.available()&gt;0){
// AT command to set SIM900 to SMS mode
SIM900.print("AT+CMGF=1\r"); 
delay(100);
// Set module to send SMS data to serial out upon receipt 
SIM900.print("AT+CNMI=2,2,0,0,0\r");
delay(100);
textMessage = SIM900.readString();
textMessage.toUpperCase();
Serial.print(textMessage);    
delay(10);
} 

if(textMessage.indexOf("SET PHONE")&gt;=0){
// Set phone number to receive notifications
phoneNumber = textMessage.substring(9,21);
Serial.println("Phone number set to: " + phoneNumber);  
String message = "Notification number set to: " + phoneNumber + "\nSend 'Help' for additional commands.\nNote in case of reset number returns to hardcoded default";
sendSMS(message);
Serial.println("Confirmication of phone number change sent");
textMessage = "";   
}
Ok i found the issue and the solution.

For some reason it seems that while the MCU is running Setup(); hardware or software serial don't work properly.

In my case i have code that set the SIM module to SMS mode and to send those messages to the serial port.

For some reason it doesn't send them (or probably the module is not ready to accept them).

Connecting the USB cable reset the arduino and run setup() when opening the serial monitor setting the module in the correct mode. 

Adding this code in the main loop solves this issue even though i have them powered both by the same step down converter. 

edit: That turns out 1 hour later after debugging more is not exactly a proper solution to the issue.
 That command to set into SMS mode only works when you are connected to the network.

I have a check for that and a reset function.

So now at Setup() i wait 10s for the module to boot up so it is ready to open a serial port, then i check if it is connected to the network before i send the commands to set into SMS mode.

Example:

// Initializing serial commmunication
Serial.begin(57600); 
delay(10000);

while (ini){
    Serial3.begin(57600);
    delay(1000);
    Serial3.print("AT+CGREG?\r"); 
    delay(100);
    netStatus = Serial3.readString();
    if (netStatus.charAt(22) == '5' || netStatus.charAt(22) == '1') {
         digitalWrite(LED_NET, HIGH);
         ini=false;
         }
    else {  
        digitalWrite(LED_NET, LOW);
        digitalWrite(resetPin, LOW);
        delay(2000);
        digitalWrite(resetPin, HIGH);
        delay(30000);
        }
}
  Serial.print("SIM800 ready...");

  // AT command to set SIM800 to SMS mode
  Serial3.print("AT+CMGF=1\r"); 
  delay(100);
  // Set module to send SMS data to serial out upon receipt 
  Serial3.print("AT+CNMI=2,2,0,0,0\r");
  delay(100);