public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Andreas Stenius <andreas.stenius@astekk.se>
To: ecos-discuss@ecos.sourceware.org
Subject: [ECOS] Re: Serial communication issues
Date: Wed, 06 Feb 2013 15:06:00 -0000	[thread overview]
Message-ID: <CABCxKrdDO5W0wcQfxuS+U5_=iqGBOpq0uXxRASUNLAVhJ6QZag@mail.gmail.com> (raw)
In-Reply-To: <CABCxKrfOr8-AAKEq3qwU-rJrsxBZ9r5anr=Krs1baUvvdtH=Dg@mail.gmail.com>

OK, not 100% clear, but I've narrowed it down to the interrupt driven
DMA receiver in at91_serial.c.

I used the default values for the HW serial driver, with a receive
buffer of 128 bytes, and a receive chunk size of 1 byte.

After adding a bunch of CYG_TRACE calls, which didn't affect the
timings too much, I captured a trace where it had dropped two bytes.

Analyzing the trace and source, I suspect that the ISR/DSR handling of
the DMA receiver isn't glitch free when done in the midst of incoming
data.

With this knowledge, I changed my receive chunk size to 6 bytes, and
the issue has gone away, for this particular use case. Not yet sure if
it is going to show up again later or not.. :/


Btw, there are a few rough edges in the trace handling when set to
halt after filling the trace buffer.
First, when printing a halted trace buffer (i.e. it is full), it will
go into an endless loop.
This from the fact that the loop variable i is set to 0 before the end
test when it has reached the last entry.
Moving the if (i == BUFFER_SIZE) test to the head of the loop instead
of at the bottom solves this (so the while test is done first, then
the if test).

Secondly, there is no way to restart the tracing once it has been
halted. I find this rather limiting, so I dropped the old_halted
variable in cyg_trace_print() so that the trace is restarted after
printing the contents of the trace buffer.

I'll consider posting this as a patch to the bugzilla database...

Cheers,
Andreas

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

      reply	other threads:[~2013-02-06 15:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-06  9:47 [ECOS] " Andreas Stenius
2013-02-06 15:06 ` Andreas Stenius [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CABCxKrdDO5W0wcQfxuS+U5_=iqGBOpq0uXxRASUNLAVhJ6QZag@mail.gmail.com' \
    --to=andreas.stenius@astekk.se \
    --cc=ecos-discuss@ecos.sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).