[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avrdude-dev] Serial port latency under linux (and windows?)
From: |
Jan-Hinnerk Reichert |
Subject: |
Re: [avrdude-dev] Serial port latency under linux (and windows?) |
Date: |
Wed, 14 May 2003 00:46:26 +0200 |
User-agent: |
KMail/1.5.1 |
Am Samstag, 10. Mai 2003 03:15 schrieb Jan-Hinnerk Reichert:
> Just another interesting observation about speed:
>
> With low_latency, I still needed about 17s for reading a 8515, but the
> theoretical minimum (in my setup) is 7s.
>
> After some time of suspecting scheduling latency, I tried a rather stupid
> thing and set my uart to 16450 (before it was a 16550A ;-)
>
> # setserial /dev/ttySx uart 16450 low_latency
>
> Now avrdude is reading a 8515 in 8s ;-)
> Seems like there is some strange FIFO magic involved in the additional
> delay.
Okay, I have done some more research.
The datasheet for the TL16C550 says that a receive interrupt is triggered if
the trigger level is reached or there is at least one char in FIFO and
nothing is received for 4 char-lengths.
The possible trigger levels for 16C550 are 1, 4, 8 and 14. Linux sets trigger
level depending on the baudrate. 1 for speeds below 2400 Baud, 8 otherwise.
A quick calculation shows that this is the amount of time missing (7 bytes
instead of 3 ;-)
There seems no way to change the triggerlevel from userspace.
IMHO there are two possibilities:
- Disabling the FIFO by changing the UART. The disadvantage is that you may
loose characters if your system is responding too slow.
- Patching your kernel ;-)
In the archives of avrdude-dev I found a thread about programming speed for
AVR910 under Windows. From the time mentioned there (21s for reading 8515), I
think the same problem exists under Windows. Perhaps there is a way to tweak
the FIFO in the registry or even a system call. I won't get to it, but
perhaps somebody else will, now that the problem is found...
Jan-Hinnerk