AW: [En-Nut-Discussion] UART looses Bytes

Toennies Kai kai.toennies at siemens.com
Thu Nov 25 18:17:22 CET 2004



> -----Ursprüngliche Nachricht-----
> Von: en-nut-discussion-bounces at egnite.de
> [mailto:en-nut-discussion-bounces at egnite.de]Im Auftrag von Harald Kipp
> Gesendet: Mittwoch, 24. November 2004 19:17
> An: Ethernut User Chat (English)
> Betreff: Re: [En-Nut-Discussion] UART looses Bytes
> 
> 
> Hello Kai,
> 
> Gosh, good question. That very much depends on what's going
> on else in the system. For example, timer processing disables
> interrupts and the duration depends on the number of times
> to process.
> 
> 20us is a lot of time and the UART hardware can buffer 2 bytes.
> But still...roughly calculated, context switching takes about
> 7us on a 16 MHz ATmega with interrupts disabled almost all
> the time.
> 
> You are receiving limited length telegrams, right? Wouldn't
> it be better then to receive the full telegram in a single
> interrupt call? This will block all other interrupts,
> which is usually acceptable for Ethernet and Timer processing.
> 
> But I agree that this may not solve the problem for the
> first two bytes of the telegram.
> 

First, I have used the interrupt on every byte method and also tried to
catch the second byte in the receive buffer. Made it only little better. I
could also see that there were more errors with an established telnet
connection than without.

Second I captured the first byte with the receive interrupt and then polled
for the rest. All done in the receive interrupt routine.
As you wrote, it does not solve the problem with the first two bytes.
Still, too often the interrupt is delayed by the ethernet device(when a
telnet is established) and I loose the first two bytes.
Can you tell me very brief what is going on or how long it takes? 
Maybe I can stretch the incomming bytes, but therefore I need to know more
about the ethernet "interrupt".

Thanks a lot,
Kai



More information about the En-Nut-Discussion mailing list