[ECOS] Double buffers using US_RPR and US_RCR
Magnus Nilsson
man@lundinova.se
Fri Oct 24 11:19:00 GMT 2003
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?
Kind regards/Magnus
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss
More information about the Ecos-discuss
mailing list