[En-Nut-Discussion] UART looses Bytes

Matthias Ringwald mringwal at inf.ethz.ch
Thu Nov 25 11:26:09 CET 2004


hi

short hint: as noted recently on this list:
if the rx irq is triggered up to 3 bytes are ready to read out, so 
after reading the first
byte in the handler, just check the rxcomplete bit to see if there are 
more bytes buffered.
this does give you a little relaxation, as if your irq is late, you're 
saving let's say 4 IRQ
context switches while catching up.

despite that, I'm having trouble using 115200 on a 7.328 Mhz using the 
nut driver.
Calculating the time of one byte there, I have roughly 300 uS
and still miss a byte in a while. (or 2000 instructions..)

(adding: I'm using two uarts and might also send and receive on both. 
but I'm already


I still don't know what exactly is causing me pain.

As I'm not happy counting instructions, I will sooner or later have to 
hook up an Oszi
and measure several routines. Candidates: NutThreadSwitch, 
NutEventPostAsync, NutEventPost, NutTimerIRQ

I'm currently very suspicious about the NutEventPostAsync call and I'm 
wondering
if replacing this function with another one, that justs enters the 
specific queue
in a linked list (in O(1)).. this is similar to the re-use of timers in 
the nut timer irq.

I did something like that in the unix_devs.c driver for other reasons.

read my other posting: usartavr.c rx complete irq improvementsuggestion

good luck
matthias




On 24.11.2004, at 17:51, Toennies Kai wrote:

> Hi!
>
> I try to receive data at 1MBaud on the UART using the receive 
> interrupt.
> I changed the oszillator, it is now 16MHz.
> I do not use the Nut-OS routines for UART communication.
> It all works fine, but sometimes(too often) I loose one or more bytes.
> Something from the Nut-OS delays the uart receive interrupt.
> This I could see on the oscilloscope.




More information about the En-Nut-Discussion mailing list