receiving more than 64 bytes on arduino nano serial port

Hello,

I am receiving about 90 bytes on the serial port. but arduino has the serial buffer of 64 bytes only. because of this limitation i am unable to receive further bytes.

char c;

void read_response()
{
while(Serial.available > 0)
{
c=Serial.read();
Serial.print(c,HEX);
Serial.print(",");
}

}

i tried using above function to read the serial data, but it is able to read only 64 bytes.

another approach i tried as follows:

char rxdata[]={};

void read_response()
{
while(Serial.available > 0)
{
int len= Serial.readBytes(rxdata,90)
}

}

with this approach also i was receiving only 64 bytes

Serial.flush() also don't work as it waits for current transmission to finish.
& i do not have control on transmission end. transmitter is sending 90 bytes continuously.

please give me some suggestion.

while(Serial.available > 0)
     {
    c=Serial.read();
    Serial.print(c,HEX);
    Serial.print(",");
    }

Receive one character, and send three characters at the same bit-rate.

See the problem?

Also posted at:

If you're going to do that then please be considerate enough to add links to the other places you cross posted. This will let us avoid wasting time due to duplicate effort and also help others who have the same questions and find your post to discover all the relevant information. When you post links please always use the chain links icon on the toolbar to make them clickable.

TolpuddleSartre:

while(Serial.available > 0)

{
    c=Serial.read();
    Serial.print(c,HEX);
    Serial.print(",");
    }


Receive one character, and send three characters at the same bit-rate.

See the problem?

No

Create a buffer that can handle all the communication in your code, then read the characters as they come in.

Make sure you can read them faster than they come in (so indeed don't try to send three characters upon receiving one as your receive buffer sooner or later will fill up).

Hope I understand it all correctly: the Serial.print() command should be fast - pushing all the bytes to be sent in the buffer, as long as there is space. Only when that buffer is full, the command gets stuck until there's space and all the bytes are written, and you experience delays.

Have a look at the examples in Serial Input Basics - simple reliable ways to receive data.

If you change the value of the constant numChars you can receive as many characters as you want.

...R