This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
tty swallows every odd character
- From: "Bob Brusa" <bob dot brusa at gmail dot com>
- To: ecos-discuss <ecos-discuss at ecos dot sourceware dot org>
- Date: Mon, 07 Sep 2009 10:15:28 +0200
- Subject: [ECOS] tty swallows every odd character
- Reply-to: bob dot brusa at gmail dot com
Hi
using a at91sam7x-based board, I have configured UART1 as tty and with
hw-driver. When transmitting characters to the serial_1 input, I get an
echo on every 2nd character only. And indeed, in the final result I get
upon <enter>, every second character ist missing. But only the first time,
later the picture gets wilder:
My code (excerpt) is:
j = 0;
while (true) {
scanf("%c",&ch);
if ((ch == '\n') || (ch == '\r')) {
cmd[j] = '\0';
len = strlen(cmd);
printf("j:%d len:%d cmd:%s\n ", j, len, cmd);
j = 0;
} else
cmd[j++] = ch;
cmd[j] = '\0';
}
EXAMPLE:
type 01234567<enter><enter> cmd is 1357
type 01234567<end> cmd is 1346
The above code can be simplified to
while (true) scanf("%s",cmd);
producing the same results. I just expanded it to get an idea where the
problem is.
Strange behaviour. Isn't it? Thanks for help.
Robert
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss