Arduino 1+ and the SERIAL PORT.
Some changes with “Up-grading” ??
PDE upgrading to the latest Arduino IDE ,,,, (Version 1 or version 1.1)
You will notice that most of my Arduino stuff has been updated to work on the new Arduino IDE v1 and 1.1
All the updated PDE’s will work on IDE’s 0022, 0023, 1 and 1.1 with no modification.
(A wee hint here ,,, If you are using the earlier IDE’s that use a “PDE” ,, you can just change the file name from .INO to .PDE)
All went well until I tried to convert my own (rather long) PDE’s that read a huge number of extractions from FSX.
It worked fine on any “changing” item (tuning a radio etc) but when the REFRESH burst came thru it really messed things up.
It only got the first 12 or so items and then it all went to garbage.
This didn’t happen with version 0022.
On fiddling with this for a while to try to find the problem ,,, I decided the serial receive buffer wasn’t big enough.
Searched the net ,, problem confirmed ,, various “messy” fix’s out there.
What the Arduino boys had done was cut the serial buffer down in size with the “upgrade” to version 1 ,, that may suit guys that wanted extra memory in the Arduino for complex programs but it didn’t suit us that are basically using the Arduino as a simple serial interface with a lot of serial data flowing.
THE FIX ,,,,
It’s an easy fix ,, This is what to do to fix it in Version 1 or version 1.1 ,,,,,
There are declarations for the serial buffer size in a file called “HardwareSerial.cpp”.
You will find it here ,,,
Main Arduino dir/Hardware/Arduino/Cores/Arduino and find the file “HardwareSerial.cpp”.
Open “HardwareSerial.cpp” with WORDPAD. (Not notepad)
Just after the “includes”, you will see ,,,,
#if (RAMEND < 1000)
#define SERIAL_BUFFER_SIZE 16
#define SERIAL_BUFFER_SIZE 64
Change the 16 to 32 and the 64 to 128 to look like this ,,,
#if (RAMEND < 1000)
#define SERIAL_BUFFER_SIZE 32
#define SERIAL_BUFFER_SIZE 128
Then hit save. Your done ,,, problem fixed. (Well it did on mine at any rate)
If you have huge extractions going on and an involved PDE, you can up it even further to 64 and 256 if you still have problems.
I tested mine at this and it worked fine.
The original IDE version 0022 used 32 and 128 for those settings.
With stuff like this ,, it makes one wonder as to the benefits?? of “up-grading” !!!!!
As usual ,,,
Use at your own risk.
This is what I done ,,, It worked for me.
If it don’t work for you, then go and try something else.
Cheers ,,,, Jim
Dated 23 Aug 2012