public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* atmel_serial: receive data lost in RS485 mode
@ 2011-06-23 10:09 Ronald Wahl
  0 siblings, 0 replies; only message in thread
From: Ronald Wahl @ 2011-06-23 10:09 UTC (permalink / raw)
  To: linux-kernel; +Cc: claudio.scordino

Hi,

on our AT91 board we use the RS485 mode on the serial port and noticed 
some data loss in some circumstances. (kernel 2.6.38.7)

What happens is the following: When starting TX the RX part is disabled:

atmel_start_tx():
		...
		if (atmel_port->rs485.flags & SER_RS485_ENABLED)
			atmel_stop_rx(port);
		...

When TX is done it is enabled again:

atmel_tx_dma():
		...
		if (atmel_port->rs485.flags & SER_RS485_ENABLED) {
			/* DMA done, stop TX, start RX for RS485 */
			atmel_start_rx(port);
		}
		...

Since the RS485 mode is only half duplex this looks ok (or at least not 
wrong) at the first glance but it only works if RX is enabled 
synchronously when TX is done. Actually it happens under some 
circumstances that there is a latency between TX done and enabling RX 
again. All data received during that time is lost.

So the question is: Why disabling RX at all during TX? I can't see any 
benefit. I removed this two code parts above and all works perfectly 
well and no data is lost anymore.

greets,
ron

PS: I'm not on the list - please keep me in Cc. Thx!

-- 
Ronald Wahl - ronald.wahl@raritan.com - Phone +49 375271349-0 Fax -99
Raritan Deutschland GmbH, Kornmarkt 7, 08056 Zwickau, Germany
USt-IdNr. DE813094160, Steuer-Nr. 227/117/01749
Amtsgericht Chemnitz HRB 23605
Geschäftsführung: Stuart Hopper, Burkhard Wessler

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-06-23 10:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-23 10:09 atmel_serial: receive data lost in RS485 mode Ronald Wahl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox