Thanks for your reply.
I changed the code in the void loop to:
void loop()
{
while(gsm.available())
{
incoming_char = gsm.read();
Serial.print(incoming_char);
}
gsm.println("AT");
delay(700);
}
Only with the 700 ms (and longer) delay I get no errors. So it seems to be a buffer overrun.
I will have a look at my original code next week and see if I can solve the problems there too.
Thanks again.