This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: Double buffers using US_RPR and US_RCR
- From: Laurent GONZALEZ <laurent dot gonzalez at silicomp dot fr>
- To: ecos-discuss at sources dot redhat dot com
- Date: Mon, 27 Oct 2003 09:20:43 +0100
- Subject: Re: [ECOS] Double buffers using US_RPR and US_RCR
- Organization: SILICOMP RESEARCH INSTITUTE
- References: <3F990AC5.5040306@lundinova.se>
On Fri, 24 Oct 2003 13:19:33 +0200
Magnus Nilsson <man@lundinova.se> wrote:
> Hi,
>
> I'm doing speed tests using double receive buffers and US_RPR/US_RCR.
> I don't have access to any flow control, and I'm losing a byte of
> every now and then, regardless of baudrate.
> Presumably this happens when I receive a byte just as I'm switching
> buffers.
>
> My buffer switching routine looks like this (it runs often enough not
> to get any overruns):
> US_RCR = 0; // disable transfer
> current_chars = US_RPR - (uint32)rx_buffer_1; // see how many chars
> there are in the buffer
> US_RPR = (uint32)rx_buffer_2; // receive in the other buffer, as we're
>
> going to read the first one
> US_RCR = BUFFER_SIZE; // re-enable transfer
>
> I have experimented with using:
> if ((US_CSR & US_TIMEOUT) == US_TIMEOUT) {
> // switch buffers
> }
> which greatly increased the accuracy, but I'm still losing ~1 byte
> every ~100kB.
>
> Do you have any ideas on how to switch buffers without using flow
> control?
>
Hello Magnus,
This is a known issue in atmel's core. I discussed about that with
ATMEL's engineer and we together found the way to make it work without
any char loss.
Have a look on my driver. I recently contributed in the ecos-patches
mailing list.
regards,
--
GONZALEZ Laurent
Silicomp Research Institute
Tel: 04 76 41 66 98
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss