Hi Dave,

Thanks for your help, I believe I found the problem.
Previously, cat /dev/ttyS2 result was like below,
(empty lines were included byitself,  eventhough I didn't send it,
 the format was "$IMADC,00,000,000,000,000,000,000\n\r\0" )

$IMADC,20,9D2,688,AE9,9F0,649,10D

$IMADC,20,9D0,685,AE9,9EF,651,105

$IMADC,20,9CC,689,AE9,9E8,650,112

Now I deleted \r, and the new format is
"$IMADC,00,000,000,000,000,000,000\n\0", and cat /dev/ttyS2 result is
(empty line disappeared...)

$IMADC,20,9D2,688,AE9,9F0,649,10D
$IMADC,20,9D0,685,AE9,9EF,651,105
$IMADC,20,9CC,689,AE9,9E8,650,112

and, the program looks working fine. (need more tests....)

Does this make sence?
Do you know why empty lines were added?

Thanks
eaton


--- On Mon, 3/30/09, Dave Hylands <dhylands@gmail.com> wrote:

From: Dave Hylands <dhylands@gmail.com>
Subject: Re: [Gumstix-users] Gumstix verdex pro ttyS2 issue
To: "General mailing list for gumstix users." <gumstix-users@lists.sourceforge.net>
Date: Monday, March 30, 2009, 1:07 AM

Hi eaton,

> 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?

I don't see anything obvious.

fgets will leave the \n in the buffer that's read (and perhaps a \r as
well - I don't recall if NMEA sends those or not). I'm not sure how
this impacts your parsing code, since you didn't show us that.

Were you expecting readIMU to process one sentence per call?

--
Dave Hylands
Shuswap, BC, Canada
http://www.DaveHylands.com/

------------------------------------------------------------------------------
_______________________________________________
gumstix-users mailing list
gumstix-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gumstix-users