Re: [PATCH v3 00/12] Add RS485 support to DW UART

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

 



Hello Ilpo,

i have tested your v3 patch on v3 hardware, that is, using the
emulated em485 because of lack of HW support. It is not working
due to three issues.

1.- rs485_stop_tx is never called because there are no interrupts.
I worked around this by disabling DMA:

--- a/drivers/tty/serial/8250/8250_dw.c
+++ b/drivers/tty/serial/8250/8250_dw.c
@@ -577,3 +577,3 @@ static int dw8250_probe(struct platform_device *pdev)
 		data->data.dma.rxconf.src_maxburst = p->fifosize / 4;
 		data->data.dma.txconf.dst_maxburst = p->fifosize / 4;
- 		up->dma = &data->data.dma;
+		up->dma = 0; // Proof of concept, not to be merged!

2.- Although "linux,rs485-enabled-at-boot-time" is set in the DTS,
the RTS/DriverEnable line is asserted all the time the /dev/ttyS1
device file is closed.
As soon as the device file is openned, the RTS line is deasserted.
Then it works as expected: it is asserted only during transmissions.
When the device file is closed again, the RTS line goes back to the
asserted level and stays there.
When the rs485 mode is enabled, it is expected that the RTS line be
deasserted by default.

3.- The RTS line is asserted a few microseconds earlier than the
start bit, that is acceptable, but then it deasserts one whole bit
time before the last stop bit.
So, the last stop bit of the last byte of a message is not sent
because the driver is disabled.
This has been tested with the port configured at 19200e1, that is,
the bit time is 52 us.
I worked around this by adding "rs485-rts-delay = <0 52>;" in the
DTS. This leads to the following feature (not an issue):

On Mon, 11 Apr 2022 11:33:12 +0300, Ilpo Järvinen wrote:
> Set delay_rts_before_send and delay_rts_after_send to zero for now.
> The granularity of that ABI is too coarse to be useful.

Indeed the time unit of this parameter is milliseconds, as stated in
Documentation/devicetree/bindings/serial/rs485.yaml
Which in the general case is more than ten bit times.

But it is being interpreted as microseconds here:

On Mon, 11 Apr 2022 11:33:11 +0300, Ilpo Järvinen wrote:
> [PATCH v3 02/12] serial: 8250: Handle UART without interrupt on TEMT
>+	stop_delay += (u64)p->port.rs485.delay_rts_after_send * NSEC_PER_USEC;

So, this way it has a useful granularity to be used in
"rs485-rts-delay = <0 52>;" but is not compliant with the spec.

Regards,
  Vicente.



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux