Can't receive data more than 64byte

Dear Sir

Sir,

I've just found some problem when i use Arduino uno r3 for getting data from another micro

it cant receive all data (just 64byte i got) ,actually another micro is going to send data 512byte

when it receive some ascii from Arduino

a....please help me to sovle this problem
b....how can i receive data morethan 64bytes by arduino

thank you

Post your code.

But it sounds like you are filling the receive buffer (which quite by chance is 64 bytes in size) and not clearing the data in time so the remaining bytes are discarded.


Rob

can you help me how to do to receive data morethan 64bytes

Sittipong:
can you help me how to do to receive data morethan 64bytes

yes.

post what code you have.

Sittipong:
Dear Sir

You there in the front row. You have a question?

I'm guessing:

Look at the HardwareSerial.h header file found in your IDE directory:

hardware\arduino\avr\cores\arduino

and you will see that the transmit and receive buffers are set to 64 bytes.

Does this give you any ideas? While running the Serial monitor, type in 80 characters (or so) and click Send.

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

void loop() {
  int bytesRead;
  char buff[101];
  
  if (Serial.available() > 0) {
    bytesRead = Serial.readBytesUntil('\n', buff, 100);
    buff[bytesRead] = '\0';
    Serial.print("bytesRead = ");
    Serial.println(bytesRead);
    Serial.print("buff = ");
    Serial.println(buff);
  }
}

i just send ascii N to another micro to active command

if another micro got ascii N it will send data 512bytes back to arduino

but..i've just receive only 64bytes

This is my code

char asciiN(char N)
{
  unsigned char RevBuffer[512];
  unsigned int Lenght;
 
  delay(500);
  lcd.clear();
  lcd.setCursor(0,1);
  lcd.print (" send Ascii N.");
  delay(200);
  lcd.setCursor(0,1);
  lcd.print (" send Ascii N...");
  Serial.write(N); 
  delay(200);
  
  if(Serial.available()) 
  {
    //wait for serial buffer to fill itself    
     delay(1000);
     Lenght=Serial.available();
     Serial.readBytes(RevBuffer,Lenght);
     Serial.setTimeout(1000);
     delay(500);
     
     lcd.clear();
     lcd.setCursor(0,0);
     lcd.print ("Lenght.... ");
     lcd.print (Lenght);
     delay(1000);
     
     for(int i=0;i<Lenght;i++)
       {
         lcd.clear();
         lcd.setCursor(0,0);
         lcd.print ("Data :");
         lcd.setCursor(6,0);
         lcd.print (i);
         lcd.setCursor(0,1);
         lcd.print ("HEX :0x");
         lcd.print (RevBuffer[i],HEX);
         delay(1000);
       } 
  }
  else
  {
     lcd.clear();
     lcd.setCursor(0,0);
     lcd.print ("nothing Return..");
     delay(500);
  }
}
if(Serial.available()) 
  {
    //wait for serial buffer to fill itself    
     delay(1000);
     Lenght=Serial.available();

The serial buffer is 64 bytes. Don't do it this way.

can you give me any idea to get data more

try reading the link that Nick posted...

Hi,

i have question for Arduino Uno programming

can we change serial buffer from 64bytes to 512bytes? or more

a.....if can, how to do

b......if cannot ,there is another way to get data more

PS. i heard that we have to change in HardwareSerial.h ......But how to change

Thank you for your answer :slight_smile:

If you change the size of the serial buffer change it down not up 64 is far far to big. The simple way to deal with incoming data is to read it. Get rid of all those delay's your using.

Mark

Please do not cross-post. This wastes time and resources as people attempt to answer your question on multiple threads.

Threads merged.

I think this is the third thread you have started on this question. Don't ignore the answers and start a new thread. If you keep doing it your account will be deleted.

Did you not understand my previous reply?

How to use this forum

  • Moderator