[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 485 serial port read delay and send/receive turnaround




-----Original Message-----
From: afelson@xxxxxxx.com>
To: dev-etrax@xxxxxxx.com>
Date: Friday, January 12, 2001 15:50
Subject: 485 serial port read delay and send/receive turnaround


>1) I'm working on an application that requires the etrax100 to quickly poll
>up to 16 devices on a 485 bus.  It sends 3 byte pings and each board
>responds with a 3 byte reply if there's nothing new to report and up to 160
>bytes or so if there's new data.
>
>The problem is that the 3 byte ping/pongs need to occur at about 2ms per
>board.  With the default kernel, the delay (reading?) was on the order of
>150ms.   Enabling "fast serial port dma flush" on the kernel got this down
>to around 20ms.  Turning the fast dma flush back off and reducing the
>"receive flush timeout" to zero got the delay down to 10ms.
>
>During one test, we "primed" the fifo by sending 60 bytes of pings without
>a read and then doing a ping/ out of sync read;  the
>delay was 2ms.  It seems the problem is that the fifo doesn't immediately
>report new data.  The fast dma flush didn't really work because the fifo
>hadn't even triggered the dma in the first place.
>
>Can those fifo's be disabled?


It would be better to use the normal serial input interrupts instead of the
DMA for this I think. There is some code left in the etrax100ser.c from the
early versions of the driver that didn't use DMA, but it might need some
work to get it running.

For this kind of operation you might consider writing a kernel device driver
that uses the serial driver to do the polling of the devices.
The driver could then wake up the select() call in the application when
a device has returned something (i.e. the 160 bytes).


>2) Also, when turn a send/receive turnaround, there's always a junk
>character as the first character received, apparently due to a glitch on
>the 485 bus output when then transmitter is turned off.  It used to be
>random till I enabled "disable serial receive";  now the junk character is
>always 0x00.


I'll see if I can come up with something on this.



>---
>Adam Felson
>HID Corporation - Engineering
>11674 N. Huron Street
>Denver, CO 80234-2924
>(303) 453-3362


/Johan