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" )




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...)


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

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


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

gumstix-users mailing list