From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S941924AbdAHCae (ORCPT ); Sat, 7 Jan 2017 21:30:34 -0500 Received: from mail-oi0-f68.google.com ([209.85.218.68]:34587 "EHLO mail-oi0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933053AbdAHCaZ (ORCPT ); Sat, 7 Jan 2017 21:30:25 -0500 MIME-Version: 1.0 In-Reply-To: <20170107230624.GA21729@archie.localdomain> References: <20170104160024.GA13442@archie.localdomain> <20170106225026.GA3804@archie.localdomain> <20170107134557.GA12299@archie.localdomain> <20170107153434.GA13307@archie.localdomain> <20170107205930.GA12367@archie.localdomain> <20170107230624.GA21729@archie.localdomain> From: Fabio Estevam Date: Sun, 8 Jan 2017 00:30:24 -0200 Message-ID: Subject: Re: imx: RS-485 problems during TX, maybe DMA related To: Clemens Gruber Cc: "linux-serial@vger.kernel.org" , Greg Kroah-Hartman , Sascha Hauer , =?UTF-8?Q?Uwe_Kleine=2DK=C3=B6nig?= , Nandor Han , Lucas Stach , "linux-arm-kernel@lists.infradead.org" , linux-kernel Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Clemens, On Sat, Jan 7, 2017 at 9:06 PM, Clemens Gruber wrote: > Just remuxed GPIO signals to these pads, applied your two patches and > used rts-gpios in the DT but I still see the same problem :/ > > When transmit something, I get doubled characters, then zeros and at the > end garbled data of previous transmissions, same as described in my > first post (Logic analyzer: https://pqgruber.com/rs485_results.png) > The data is always 4096 bytes long, this explains why the echo command > is blocking for about 4 seconds (<- 4096 bytes at a baudrate of 9600). > The TE line is also high until all 4096 bytes are sent. > > I think this comes from the UART_XMIT_SIZE which is defined to the page > size. > Maybe there is something wrong in imx_transmit_buffer and leads to the > whole circular buffer being sent out all the time, not stopping.. > > Do these debug logs tell you anything? > https://gist.github.com/clemensg/1ac5ee8a8ea32acc9145c5aa8407aea5 > > I am analyzing the signals coming directly from the i.MX6Q, so this must > be a software problem, but I don't understand why it works for you, if > we use the same software. > > Do you use any other patches on top of mainline and do you use the SDMA > scripts from the ROM? No, I use the original 4.9 + the two patches I sent. Yes, I do use the SDMA scripts from ROM. Here is the procedure I did to try to reproduce the issue you reported: (The rs485conf is available at: https://github.com/mniestroj/rs485conf/blob/master/main.c ) First of all I enable rs485 for ttymxc3 using the rs485conf application: root@imx6qsabresd:/home# ./rs485conf /dev/ttymxc3 -e 1 [ 27.106517] random: crng init done = Current configuration: RS485 enabled: false RTS on send: high RTS after send: low RTS delay before send: 0 RTS delay after send: 0 Receive during sending data: true = New configuration: RS485 enabled: true RTS on send: high RTS after send: low RTS delay before send: 0 RTS delay after send: 0 Receive during sending data: true = Saved configuration: RS485 enabled: true RTS on send: high RTS after send: low RTS delay before send: 0 RTS delay after send: 0 Receive during sending data: true root@imx6qsabresd:/ho Then root@imx6qsabresd:/home# echo A > /dev/ttymxc3 (wait 10 seconds) root@imx6qsabresd:/home# echo B > /dev/ttymxc3 (wait 10 seconds) root@imx6qsabresd:/home# echo C > /dev/ttymxc3 On the serial console at 9600bps only the: A B C are seen, so not duplicated characters, nor noise is seen on the console. Regards, Fabio Estevam