Hello everyone,
I have been trying to increase the buffer size of my Arduino Mega 2560 (Clone with CH340G chip).
I have tried the following:
in, \Arduino\hardware\arduino\avr\cores\arduino\HardwareSerial.h
#define SERIAL_TX_BUFFER_SIZE 16
#else
#define SERIAL_TX_BUFFER_SIZE 64
#endif
#endif
#if !defined(SERIAL_RX_BUFFER_SIZE)
#if ((RAMEND - RAMSTART) < 1023)
#define SERIAL_RX_BUFFER_SIZE 16
#else
#define SERIAL_RX_BUFFER_SIZE 64
to
#define SERIAL_TX_BUFFER_SIZE 16
#else
#define SERIAL_TX_BUFFER_SIZE 256
#endif
#endif
#if !defined(SERIAL_RX_BUFFER_SIZE)
#if ((RAMEND - RAMSTART) < 1023)
#define SERIAL_RX_BUFFER_SIZE 16
#else
#define SERIAL_RX_BUFFER_SIZE 256
In my sketch I am receiving strings from Serial1 using
raw_bluetooth_data = Serial1.readStringUntil('!');
From Android I am sending a String larger than 64 bytes. Sometimes if the sketch takes too long I can see the string being truncated at 64 bytes. I don`t see why this could happen since I have increase the buffer size to 256.
I have re-uploaded the code after making changes in the headerfile. Also restarting Arduino doesn`t help.
EDIT: Also changing the receiving method to this
http://forum.arduino.cc/index.php?topic=396450 causes the String to truncate if the sketch takes too long.
The Sketch sometimes takes too long because I am polling one wire temperature sensors which cause blocking.
Any advice?
Thanks!