Hello,
2 years ago i had finished a sketch (IDE 1.6.7) in mega2560, using 1serial in and 2 serial out. For the purpose of the project I increased the serial buffer size in hardwareserial.h to 128.
AFAIK, buffer size cannot be "adjusted" in newer IDE. Of course, the solutions of making the sketch "smarter" (ie not using delays) are respected.
The way (for example) the Serial was handled, is (in pseudo)
void loop{
check if buffer has received >75 bytes //data arrive in packets of 75 every 100ms @ 19200
if yes (complete packet) read one packet and go to process data
else process previous data
output one packet prosessed data (37bytes) every 40mec
}
In this sketch I have to make a minor change and then recompile, upload... but for this old project it is no worth to make also the changes for better handling (lower buffer size).
Is there any way to increase the serial buffer size? (PMs are welcome)
demkat1:
AFAIK, buffer size cannot be "adjusted" in newer IDE. Of course, the solutions of making the sketch "smarter" (ie not using delays) are respected.
I wonder why.
I can still do it (Windows IDE 1.8.8 ).
sterretje:
Not behind a PC but hardwareserial.h should have the setting for the buffer size.
You can edit it using a normal text editor.
I knew about hardwareserial.h and had used it for many projects, although did not check extensively. But for some days now there is a problem.
for example
The size of buffers is fixed and same for all ports. The difference is only for RX and TX. The only way how to change it is to modify the code. However, it will require some change in approach, since service functions are common for all ports.
Something that may be confusing is that you may have multiple copies of Arduino AVR Boards (which contains the serial buffer code you're trying to modify), but only one of those copies is in use by the Arduino IDE. The Arduino IDE comes with a bundled copy of Arduino AVR Boards. However, if you install an update of Arduino AVR Boards via the Arduino IDE's Boards Manager, that is installed to a different location on your computer. So if you are editing the files of the inactive copy of Arduino AVR Boards it would give just the results you're seeing.
The easiest way to find the active hardware package location is as follows:
Select a board from the hardware package you want to find from the Tools > Board menu
File > Examples > SPI > BarometricPressureSensor (or any other SPI example sketch)
Sketch > Show Sketch Folder
Move up folder levels until you reach the one that contains boards.txt
You will now find the hardware serial buffer definitions at cores/arduino /HardwareSerial.h.
but think about the situation : because I know that there are many "versions" of some files, i had searched the entire hdd, found a total of 8 hardwareserial.h files but the system didnot show the one in AppData!!!