unexpected serial port behaviour

Weird ''fault''
Spent hours on this last night....



while (Serial2.available()) {
int inByte = Serial2.read();

I was only getting the FIRST 30 or so chars from the modem message....
So I increased the delay to 1000,2000,4000.....

Still the same, and often the last char received would be corrupt....

Different speeds and delays between each car read where tried.

Removing the delay fixed it....


The help reference says serial buffers continue to be active during a delay, but putting a delay in causes the error everytime.


Post your code, please.

Removing the delay fixed it....

Why do you have a delay anyway?

What's sending the characters and how often does it send?

There's a 64-byte buffer that will handle bytes until it fills, then you will lose stuff, the longer the delay the more likely that is to happen (assuming the interrupts are disabled in delay() I better check that).

Also post all the code, maybe there's something else at play.

EDIT: Interrupts aren't disabled but that makes no difference, you still aren't handling characters in a delay().


So I increased the delay to 1000,2000,4000.....
Removing the delay fixed it....


Well, if you delay for four seconds between each byte, there is a limit to how big the buffer is that can hold incoming bytes.

What do you imagine would happen if you delayed for a day? Or a week?