Software Serial Problem with SIM800L modules

I am trying to communicate with SIM800L modules using AT commands and the software serial example sketch as shown below.
The hardware must be ok as I get the correct "SIM800 R14.18" response to the ATI command.
Alas, when I try to send other commands like AT+CPIN?, I only get an AT+N? ERROR response.
It seems that the software serial communication drops some characters.
I have tried with an Arduino Nano and with a Pro Mini and 2 different SIM800L modules, but the problem is the same.
I have also tried to replace the "while" with "if" in the loop but the problem stays the same.
If I use putty to communicate with the modules at 9600 baud everything works correctly.
Does anyone have seen similar issues with Software Serial?
Is there possibly a simple solution to the problem?

void setup()
{
  Serial.begin( 57600 ) ;
  while( !Serial )
  { ;                 // wait for serial port to connect. Needed for native USB port only
  }
  Serial.println("Goodnight moon!") ;

  mySerial.begin( 9600 ) ;
  mySerial.println( "Hello, world?" ) ;
}
void loop()
{ while( mySerial.available() )
  {   Serial.write( mySerial.read() ) ;
  }
  while( Serial.available() )
  {   mySerial.write( Serial.read() ) ;
  }
}

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.