strange irritating LCD issue

Hi all,
I’ve been noticing my LCD doing some very strange (and harder to track down) things on occasion

#include <LCD4Bit.h> 
LCD4Bit lcd = LCD4Bit(2); 
int serbyte = 0;

void setup() { 
  lcd.init();
  Serial.begin(115200);
}

void loop() {  
  serbyte = Serial.read();
  if (serbyte != -1 && serbyte != 94 && serbyte != 37)
  {
    lcd.print(serbyte);
    Serial.print(serbyte); //echo back to the comp so i can find the stupid bug
    Serial.print("."); //make it easier to read
    delay(20);
  }
  if (serbyte == 94)
  {
    //lets make ^ the clear char, easy to type, not used often in mp3 titles
    lcd.init(); //we need to re-init after a suspend, and it doesn't seem to have any performance hit, so lets use init instead of clear
    delay(100);
  }
  if (serbyte == 37)
  {
    //and lets make the % the newline char, again easy to type, and not used often in mp3 titles
    lcd.cursorTo(2, 0);
    delay(100);
  }
}

It usually works as intended, stuff gets piped over serial, it takes it and prints it to the LCD, and back to serial

very rarely it prints the wrong thing, here’s an example, if I echo “^Avenged Sevenfold%City of Evil” to the serial port, here’s what I get back (ascii is my doing, it’s what should be printed)

A  v   e   n   g   e   d   (wrong though, prints as Ave*   Sevenfold)
65.118.101.235.149.145.129.
S  e   v   e   n   f   o   l   d
83.101.118.101.110.102.111.108.100.
C  i   t   y
67.105.116.121.
sp O   f
32.111.102.
sp E  v   i   l
32.69.118.105.108.

does this make sense to anyone? almost as important, has anyone else seen a problem like this?

I havn’t tested enough to be sure, but after only a few test runs, I havn’t been able to make it happen with a slower baud rate (using 57600 instead of 115200) could that have something to do with it?

Well if past performance is any indication, it seems this issue was caused by the 115200 baud rate, since I'm sure I would have seen it by now, and I haven't seen it in the last half hour or so of playing around.

So it seems the ftdi chip really can't handle a baud rate that fast?

So it seems the ftdi chip really can't handle a baud rate that fast?

It can do 115K no problem... I do this all the time. The issue is probably more like what the things connected to the FTDI can do in between serial transmissions.

meaning the rest of the arduino?

yes.

Without working out the actual timing numbers...my guess is the problem would be that you have data coming in over the serial port very quickly, but you write to a comparatively slow LCD.

While you're writing to the LCD, and also during those huge 20 ms & 100ms delays, the serial buffer could be getting overrun, or you could be missing serial characters.

While you’re writing to the LCD, and also during those huge 20 ms & 100ms delays, the serial buffer could be getting overrun, or you could be missing serial characters.

To show that this is the case, you could remove the delays and, if necessary, the LCD calls (leaving the echo back to the computer).

Note also that there are also still some delays within the LCD4Bit library code that are larger than the datasheets stipulate (5though these are currently dwarfed by your delays).

To keep things readable on the LCD without your 100ms delay, I guess you can send only a burst of characters from the PC, then wait a while.