The minimal circuit to it is the GPS modul with the UNO. Connected to pin 3&4.)); // delete up to ’
Hope it gives more clue.
The minimal circuit to it is the GPS modul with the UNO. Connected to pin 3&4.
command = "";
}
}
}
if(prew_time + HARTBEAT_PERIOD < millis())
{
prew_time = millis();
digitalWrite(HARTBEAT_LED,!digitalRead(HARTBEAT_LED));
#ifdef DEBUG_MODE
Serial.println("HARTBEAT");
#endif
#ifdef ENABLE_SENSOR
readSensors();
#endif
}
sw_serial_timer = millis();
do
{
while (ss.available())
{
gps.encode(ss.read());
}
} while (sw_serial_timer + SW_SERIAL_POLL_TIME > millis());
}
Hope it gives more clue.
The minimal circuit to it is the GPS modul with the UNO. Connected to pin 3&4.
do
{
} while (sw_serial_timer + SW_SERIAL_POLL_TIME > millis());
How long does that take to complete?
In general don't use FOR or WHILE unless their loop completes within a few microsecs. Otherwise you are blocking the Arduino just as surely as using delay()
You should always test mills() using subtraction to avoid problems when millis() rolls over. For example
if (millis() - sw_serial_timer >= SW_SERIAL_POLL_TIME) {
(how I hate typing underscores )
It is not a good idea to use the String (capital S) class on an Arduino as it can cause memory corruption in the small memory on an Arduino. This can happen after the program has been running perfectly for some time. Just use cstrings - char arrays terminated with '\0' (NULL).
In the first post I describe 2 cases that rule out that wild guess.
kolompos:
Other factors:
the problem does not occur when the software serial pin is disconnected (code not changed)
the problem persists when the sw serial is not polled, but the wire is connected
The latter means that the do while is /* */ -d out.
Is it possible that the hw serial is not entirely hw based and also need some interrupt?
Because sw serial surely needs and during sw serial's interrupt others can not happen.
kolompos:
The hw serial messages are less than 10 char, the sw serials are GPS NEMA sentences, about 50 chars or so.
Am I correct in my understanding that with the code in Reply #6 you miss some HardwareSerial data when something is connected to Pin4 and you do not miss any data when nothing is connected to Pin4?
What are you connecting to Pin4 for this test?
I have rarely used SoftwareSerial and I have no idea what might be causing the problem. What is the interval between the 10-character messages?
Robin2:
Am I correct in my understanding that with the code in Reply #6 you miss some HardwareSerial data when something is connected to Pin4 and you do not miss any data when nothing is connected to Pin4?
Yes, you are. Also, on the first post, in the attached image, I do not miss data when hit the uC in the pause of the GPS modul.
They are the NEMA sentences from the GPS modul. They are sent every second or so.
!Changed the sw serial library to the suggested NeoSWSerial one, and now it is fine!
I have no dropped char on the hw serial. I think it had sometging to do with the interrupts. I haven’t checked with scope, but before 80% of the messages were cut, now I can’t find one.
So… let’s call it SOLVED ? Although the mystery isn’t solved.