Hello again...
I have discovered I have a problem receiving data from the hardware serial port when I use NewSoftwareSerial to read data from another device. The problem seems to be that when the interrupt that NSS uses is running the data coming in from the hardware serial is not stored in the serial buffer.
My set up is quite simple, I have an em406a GPS connected to the NSS pins and am receiving a set of commands from the computer via Xbee's the hardware serial and acting upon this data using the TLC5940's.
The GPS BAUD rate is set to 4800 (as the em406a datasheet states it's set to this) and the hardware serial at 57600 (as the Xbees operate at this and am using the lovely FIO).
I noticed when I constantly send a string from the Serial Monitor such as
"01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"
(111 bytes)
and use simple echo code on the Arduino such as:
while( Serial.available() && c != '\n' && c !='\0' ) {
c = Serial.read();
if(c>=0 && c<=255) {
delay(1);
Serial.print(c);
}
most of the time there is missing data, ie:
012345678901234567890123456789012345678901234567890123456789012345678901234567890189
or
456789012345678901234567890145679
or
010123456789012345678901239013459
and maybe 1/3 of the time the full string...
If I set the NSS BAUD to higher rates the errors are less and less, until I match at 57600 and it works perfectly, however the GPS is programmed is 4800 and so I get no data (of course).
I am trying to decide if it's worth trying to set the em406a to 57600 (if this is possible?) or to maybe change the Xbee configuration to lower the data rate and somehow meet in the middle somewhere on the BAUD or if there is another suggestion to cut out the loss of the data not getting into the serial buffer.
Any suggestions?
And Mikal, if you see this many thanks for all the hard work on NSS and TinyGPS!