Go Down

Topic: Serial.available() buffer reduced ?? (Read 674 times) previous topic - next topic

herctrap

i was using in arduino 022

while( Serial.available() < 127 );

but now the programm stalls at this point

but if i use

while( Serial.available() < 63 );

it continiues normanly

can we make it work again with 127???


thanks a lot

robtillaart


you can do that yourself:

goto - C:\Program Files (x86)\arduino-0022\hardware\arduino\cores\arduino -

edit HardwareSerial.cpp and search this code

#if (RAMEND < 1000)
  #define RX_BUFFER_SIZE 32
#else
  #define RX_BUFFER_SIZE 128
#endif

and change the 32 in 128 too ...
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

herctrap


PaulS

Quote
while( Serial.available() < 127 );

Why are you not reading and storing the data as soon as it is available? What benefit is obtained by waiting until there is a truckload of data to process?

Or if you wanted to be portable, you could do

Code: [Select]

while( Serial.available() < RX_BUFFER_SIZE )

herctrap


Quote
while( Serial.available() < 127 );

Why are you not reading and storing the data as soon as it is available? What benefit is obtained by waiting until there is a truckload of data to process?


because then i want to send them over I2C

and because I2C is faster than Uart its not working

PaulS

Quote
because then i want to send them over I2C

Which uses a 32 byte buffer. Makes sense.

Quote
and because I2C is faster than Uart its not working

The UART IS working, even when you aren't reading the data that it is buffering.

Go Up