Re: imx: RS-485 problems during TX, maybe DMA related

From: Fabio Estevam
Date: Sun Jan 08 2017 - 16:47:15 EST


On Sun, Jan 8, 2017 at 4:06 PM, Clemens Gruber
<clemens.gruber@xxxxxxxxxxxx> wrote:

> I just did the experiment with your configuration and the rs485conf tool
> you mentioned.
> But still, no luck :(
>
> What's the revision of the i.MX6Q on your board? Mine is 1.5 (TO 1.3)

Mine is a mx6solo rev1.1.

> Another example: If I run the following on the board..
>
> while true; do
> echo ABCDEFGHIJKLM > /dev/ttymxc4
> sleep 0.5
> echo abc > /dev/ttymxc4 > /dev/ttymxc4

There is a typo here, this should be:
echo abc > /dev/ttymxc4

Fixed it locally.

> sleep 0.5
> done
>
> Many transmits contain garbled (doubled and sometimes also extended to
> a length of 4096 bytes, containing zeros) data.
> I can see a few transmissions that are sent correctly, though.

This script runs correctly here and no issue is seen on the console.

Not sure why you get TXEN high for so long in your case.

> Interesting side note: With the following patch, the problems disappear:
>
> diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
> index 451e50f6d77a..eb9f0ce6c34a 100644
> --- a/drivers/tty/serial/imx.c
> +++ b/drivers/tty/serial/imx.c
> @@ -1270,8 +1270,10 @@ static int imx_startup(struct uart_port *port)
> writel(temp & ~UCR4_DREN, sport->port.membase + UCR4);
>
> /* Can we enable the DMA support? */
> +#if 0
> if (!uart_console(port) && !sport->dma_is_inited)
> imx_uart_dma_init(sport);
> +#endif

Looks like you disabled DMA.

Regards,

Fabio Estevam