Re: Linux-serial: Atmel USART hardware RTS/CTS handshake on sama5d3.

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

 



[ corrected Nicolas and Cyrille addresses ]

2018-02-22 5:50 GMT+01:00 Sergey Organov <sorganov@xxxxxxxxx>:
> Hi Richard,
>
> Richard Genoud <richard.genoud@xxxxxxxxx> writes:
>> Hi Sergey,
>>
>> In the commit 9bcffe7575b7 ("tty/serial: at91: fix hardware handshake
>> on Atmel platforms"),
>> it's said that the RTS/CTS handshake  *driven by the controller* is
>> broken on sama5d3 platforms.
>>
>> But, it works perfectly fine if it is driven by Linux.
>
> Yes, I thought I made it clear I only consider hardware handshake case.
>
> As a side-note, in my experience software handshake rarely works
> perfectly in practice, due to its inherent limitations. It works
> expected, yes, but "perfectly fine" sounds too optimistic to me.
:) I have to agree with you.
Having RTS/CTS controlled by hardware with FIFOs is the only way to
have a reliable communication at high speed (say 3Mbit/s for example)

>
>> That said, I've effectively seen the RTS breakage on sama5d3. (it's
>> not random, it's 100% reproductible).
>
> That contradicts my experience though. I believe I just effectively
> commented-out the
>
>                 if (atmel_use_dma_rx(port) &&
>                     !mctrl_gpio_to_gpiod(atmel_port->gpios, UART_GPIO_CTS)) {
I guess you mean:
               if (atmel_use_fifo(port) &&
                   !mctrl_gpio_to_gpiod(atmel_port->gpios, UART_GPIO_CTS)) {

>
> part of the code to always use exactly hardware handshake, and it does
> work.
>
> Looks like I need to further research the issue then and make sure I do see
> what I think I see.

Yes, please. I would be quite surprised.

I've just tried it again on a sam9g35 (it's the same usart as the sama5d3).
In the driver:
-               if (atmel_use_fifo(port) &&
-                   !mctrl_gpio_to_gpiod(atmel_port->gpios, UART_GPIO_CTS)) {
+               if (!mctrl_gpio_to_gpiod(atmel_port->gpios, UART_GPIO_CTS)) {

Used a null modem cable between ttyS1/ttyS2.
for i in 1 2 ; do stty -F /dev/ttyS$i -crtscts ; done
one one terminal:
cat /dev/ttyS2

on the other :
echo "hello" > /dev/ttyS1

=> it works

for i in 1 2 ; do stty -F /dev/ttyS$i crtscts ; done
one one terminal:
cat /dev/ttyS2

on the other :
echo "hello" > /dev/ttyS1

=> nothing is received/send

>
>> I did not try to run atmel's bare metal code, but IMHO, the
>> usart_hw_handshaking example should fail.
>
> I didn't either, but I did run Linux driver with hardware handshake
> re-enabled as I've said above, and it seems to be working on my
> sama5d3-based board.
>
> -- Sergey

Richard.
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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