Hello,
I am trying to receive data from ttyS2.
If I use,
# cat /dev/ttyS2 , then I can see data coming well as follow;
$IMADC,20,9BE,68A,ACC,9CF,650,3CE
$IMADC,20,9C0,68B,ACD,9CD,64D,3CE
$IMADC,20,9BE,68A,ACB,9CA,650,3CE
$IMADC,20,9BE,689,ACC,9CC,651,3CB
$IMADC,20,9C1,68D,ACD,9CD,653,3CC
$IMADC,20,9BD,688,ACE,9D0,652,3CC
However, if I use readIMU(), then it gets only the first sentence correctly,
then rest of sentences are read as empty.
(First sentence is read correctly always, but next sentences not...)
Could someone tell me what might be the problem?
Thanks
eaton
void readIMU()
{ char sentence[NMEA_MAX];
short done = 0;
// read next IMU sentence
while (!done && fgets(sentence, NMEA_MAX, imuDev) != NULL) {
printf("sentence:\n>>>%s<<<\n", sentence);
if (sentence[0] == '$') {
done = 1;
imuCycleCount++;
if ((imuCycleCount % imuLog) == 0)
{ logNMEA(sentence);}
parseIMU(sentence);
}
}
}
|