Re: [PATCH 06/13] USB: serial: ch341: fix initial line settings

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

 



All testing is with minicom.

Starting with 00013-gc510871:

  In 8-bit mode, interoperates correctly with pl2303.  Switching to
5-bit mode on both sides (I get unicode boxes of indeterminate
values).  Switching back to 8-bit mode on both sides, I get correct
text out both sides.  Switching just the ch341 side back to 5-bit
mode, I get 0xff's out on the pl2303 side (still in 8-bit mode).  This
would seem to imply that byte-size changes are working on this
version.  Changing baud rate also works.

00014-g79e475a:

  dmesg shows on insert:

[ 1430.504116] usb 6-2: new full-speed USB device number 3 using uhci_hcd
[ 1430.682143] usb 6-2: New USB device found, idVendor=1a86, idProduct=7523
[ 1430.682148] usb 6-2: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[ 1430.682152] usb 6-2: Product: USB2.0-Ser!
[ 1430.686294] ch341 6-2:1.0: ch341-uart converter detected
[ 1430.689122] usb 6-2: ch341_dbg - [0x2518] = c3 00, [0x1213] = 00 00
(pre version)
[ 1430.693121] usb 6-2: ch341_dbg - [0x2518] = c3 00, [0x1213] = 00 00
(post init-0)
[ 1430.693124] usb 6-2: ch341_set_baudrate_lcr - speed = 9600, lcr =
c3, a = b202
[ 1430.696120] usb 6-2: ch341_dbg - [0x2518] = c3 00, [0x1213] = 00 00
(post divisor)
[ 1430.699119] usb 6-2: ch341_dbg - [0x2518] = c3 00, [0x1213] = 00 00
(post lcr)
[ 1430.700501] usb 6-2: ch341-uart converter now attached to ttyUSB0

Changing baud rate and then byte-size:

[ 1621.189700] usb 6-2: ch341_set_baudrate_lcr - speed = 9600, lcr =
c3, a = b202
[ 1621.193556] usb 6-2: ch341_dbg - [0x2518] = c3 00, [0x1213] = 00 00
(post divisor)
[ 1621.196557] usb 6-2: ch341_dbg - [0x2518] = c3 00, [0x1213] = 00 00
(post lcr)
[ 1621.199565] usb 6-2: ch341_set_baudrate_lcr - speed = 115200, lcr =
c3, a = cc03
[ 1621.202571] usb 6-2: ch341_dbg - [0x2518] = c3 00, [0x1213] = 00 00
(post divisor)
[ 1621.205569] usb 6-2: ch341_dbg - [0x2518] = c3 00, [0x1213] = 00 00
(post lcr)
[ 1621.207572] usb 6-2: ch341_set_baudrate_lcr - speed = 115200, lcr =
c3, a = cc03
[ 1621.210570] usb 6-2: ch341_dbg - [0x2518] = c3 00, [0x1213] = 00 00
(post divisor)
[ 1621.213573] usb 6-2: ch341_dbg - [0x2518] = c3 00, [0x1213] = 00 00
(post lcr)
[ 1644.117396] usb 6-2: ch341_set_baudrate_lcr - speed = 9600, lcr =
c3, a = b202
[ 1644.120933] usb 6-2: ch341_dbg - [0x2518] = c3 00, [0x1213] = 00 00
(post divisor)
[ 1644.123952] usb 6-2: ch341_dbg - [0x2518] = c3 00, [0x1213] = 00 00
(post lcr)
[ 1666.950341] usb 6-2: ch341_set_baudrate_lcr - speed = 9600, lcr =
c0, a = b202
[ 1666.954320] usb 6-2: ch341_dbg - [0x2518] = c3 00, [0x1213] = 00 00
(post divisor)
[ 1666.957316] usb 6-2: ch341_dbg - [0x2518] = c0 00, [0x1213] = 00 00
(post lcr)
[ 1700.500318] usb 6-2: ch341_set_baudrate_lcr - speed = 9600, lcr =
c3, a = b202
[ 1700.503845] usb 6-2: ch341_dbg - [0x2518] = c0 00, [0x1213] = 00 00
(post divisor)
[ 1700.506866] usb 6-2: ch341_dbg - [0x2518] = c3 00, [0x1213] = 00 00
(post lcr)

It works in 8-bit mode, I can change to 5-bit mode and then back, as
before.  And I can change baud rate.

00015-gee5a27b:

  dmesg on insert:

[ 2047.116076] usb 6-2: new full-speed USB device number 4 using uhci_hcd
[ 2047.289208] usb 6-2: New USB device found, idVendor=1a86, idProduct=7523
[ 2047.289213] usb 6-2: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[ 2047.289217] usb 6-2: Product: USB2.0-Ser!
[ 2047.291561] ch341 6-2:1.0: ch341-uart converter detected
[ 2047.294210] usb 6-2: ch341_dbg - [0x2518] = c3 00, [0x1213] = 00 00
(pre version)
[ 2047.298205] usb 6-2: ch341_dbg - [0x2518] = c3 00, [0x1213] = 00 00
(post init-0)
[ 2047.298211] usb 6-2: ch341_set_baudrate_lcr - speed = 9600, lcr =
c3, a = b202
[ 2047.301210] usb 6-2: ch341_dbg - [0x2518] = c3 00, [0x1213] = 00 00
(post divisor)
[ 2047.304187] usb 6-2: ch341_dbg - [0x2518] = c3 00, [0x1213] = 00 00
(post lcr)
[ 2047.305285] usb 6-2: ch341-uart converter now attached to ttyUSB0

Changing baud rate and byte-size:

[ 2148.141851] usb 6-2: ch341_set_baudrate_lcr - speed = 9600, lcr =
c3, a = b202
[ 2148.145537] usb 6-2: ch341_dbg - [0x2518] = c3 00, [0x1213] = 00 00
(post divisor)
[ 2148.148536] usb 6-2: ch341_dbg - [0x2518] = c3 00, [0x1213] = 00 00
(post lcr)
[ 2148.151553] usb 6-2: ch341_set_baudrate_lcr - speed = 115200, lcr =
c3, a = cc03
[ 2148.154535] usb 6-2: ch341_dbg - [0x2518] = c3 00, [0x1213] = 00 00
(post divisor)
[ 2148.157561] usb 6-2: ch341_dbg - [0x2518] = c3 00, [0x1213] = 00 00
(post lcr)
[ 2148.159536] usb 6-2: ch341_set_baudrate_lcr - speed = 115200, lcr =
c3, a = cc03
[ 2148.162554] usb 6-2: ch341_dbg - [0x2518] = c3 00, [0x1213] = 00 00
(post divisor)
[ 2148.165562] usb 6-2: ch341_dbg - [0x2518] = c3 00, [0x1213] = 00 00
(post lcr)
[ 2230.407595] usb 6-2: ch341_set_baudrate_lcr - speed = 115200, lcr =
c0, a = cc03
[ 2230.410927] usb 6-2: ch341_dbg - [0x2518] = c3 00, [0x1213] = 00 00
(post divisor)
[ 2230.413927] usb 6-2: ch341_dbg - [0x2518] = c0 00, [0x1213] = 00 00
(post lcr)
[ 2243.757894] usb 6-2: ch341_set_baudrate_lcr - speed = 115200, lcr =
c3, a = cc03
[ 2243.761857] usb 6-2: ch341_dbg - [0x2518] = c0 00, [0x1213] = 00 00
(post divisor)
[ 2243.764854] usb 6-2: ch341_dbg - [0x2518] = c3 00, [0x1213] = 00 00
(post lcr)
[ 2285.091728] usb 6-2: ch341_set_baudrate_lcr - speed = 115200, lcr =
c0, a = cc03
[ 2285.095680] usb 6-2: ch341_dbg - [0x2518] = c3 00, [0x1213] = 00 00
(post divisor)
[ 2285.098694] usb 6-2: ch341_dbg - [0x2518] = c0 00, [0x1213] = 00 00
(post lcr)
[ 2291.998763] usb 6-2: ch341_set_baudrate_lcr - speed = 115200, lcr =
c3, a = cc03
[ 2292.002652] usb 6-2: ch341_dbg - [0x2518] = c0 00, [0x1213] = 00 00
(post divisor)
[ 2292.005654] usb 6-2: ch341_dbg - [0x2518] = c3 00, [0x1213] = 00 00
(post lcr)
[ 2320.039252] usb 6-2: ch341_set_baudrate_lcr - speed = 9600, lcr =
c3, a = b202
[ 2320.042603] usb 6-2: ch341_dbg - [0x2518] = c3 00, [0x1213] = 00 00
(post divisor)
[ 2320.045602] usb 6-2: ch341_dbg - [0x2518] = c3 00, [0x1213] = 00 00
(post lcr)

I can switch baud rate and byte size back and forth and it seems to
work.  In 5-bit mode, I guess minicom just doesn't know how to render
the values, so that makes sense, switching back to 8-bit mode and I
get readable text again.  So, this one is working too, afaict.

00016-ga06b45d:

  dmesg on insert:

[ 2588.016052] usb 6-2: new full-speed USB device number 5 using uhci_hcd
[ 2588.189182] usb 6-2: New USB device found, idVendor=1a86, idProduct=7523
[ 2588.189187] usb 6-2: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[ 2588.189192] usb 6-2: Product: USB2.0-Ser!
[ 2588.193366] ch341 6-2:1.0: ch341-uart converter detected
[ 2588.196146] usb 6-2: ch341_dbg - [0x2518] = c3 00, [0x1213] = 00 00
(pre version)
[ 2588.200162] usb 6-2: ch341_dbg - [0x2518] = c3 00, [0x1213] = 00 00
(post init-0)
[ 2588.200165] usb 6-2: ch341_set_baudrate_lcr - speed = 9600, lcr =
c3, a = b202
[ 2588.203182] usb 6-2: ch341_dbg - [0x2518] = c3 00, [0x1213] = 00 00
(post init)
[ 2588.204488] usb 6-2: ch341-uart converter now attached to ttyUSB0

This doesn't work.  Even when matching baud rate and byte size, the
best I get is 0xff's out on the ch341.  Nothing decodes as printable
anything at the pl2303 side.

[ 2659.459912] usb 6-2: ch341_set_baudrate_lcr - speed = 9600, lcr =
c3, a = b202
[ 2659.463618] usb 6-2: ch341_dbg - [0x2518] = c3 00, [0x1213] = 00 00
(post init)
[ 2659.466629] usb 6-2: ch341_set_baudrate_lcr - speed = 115200, lcr =
c3, a = cc03
[ 2659.469617] usb 6-2: ch341_dbg - [0x2518] = c3 00, [0x1213] = 00 00
(post init)
[ 2659.471603] usb 6-2: ch341_set_baudrate_lcr - speed = 115200, lcr =
c3, a = cc03
[ 2659.474617] usb 6-2: ch341_dbg - [0x2518] = c3 00, [0x1213] = 00 00
(post init)
[ 2705.211020] usb 6-2: ch341_set_baudrate_lcr - speed = 115200, lcr =
c0, a = cc03
[ 2705.214981] usb 6-2: ch341_dbg - [0x2518] = c3 00, [0x1213] = 00 00
(post init)
[ 2742.117334] usb 6-2: ch341_set_baudrate_lcr - speed = 115200, lcr =
c3, a = cc03
[ 2742.121289] usb 6-2: ch341_dbg - [0x2518] = c3 00, [0x1213] = 00 00
(post init)

00017-g6edc283:

  dmesg on insert:

[ 2981.092168] usb 6-2: new full-speed USB device number 6 using uhci_hcd
[ 2981.272177] usb 6-2: New USB device found, idVendor=1a86, idProduct=7523
[ 2981.272182] usb 6-2: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[ 2981.272186] usb 6-2: Product: USB2.0-Ser!
[ 2981.275288] ch341 6-2:1.0: ch341-uart converter detected
[ 2981.278157] usb 6-2: ch341_dbg - [0x2518] = c3 00, [0x1213] = 00 00
(pre version)
[ 2981.282155] usb 6-2: ch341_dbg - [0x2518] = c3 00, [0x1213] = 00 00
(post init-0)
[ 2981.282158] usb 6-2: ch341_set_baudrate_lcr - speed = 9600, lcr =
c3, a = b202
[ 2981.285157] usb 6-2: ch341_dbg - [0x2518] = c3 00, [0x1213] = 00 00
(post init - lcr reset)
[ 2981.286340] usb 6-2: ch341-uart converter now attached to ttyUSB0

This doesn't work either.  At 9600 8N1, I get 0xff's on the pl2303,
and some unicode on the ch341.

[ 3043.235776] usb 6-2: ch341_set_baudrate_lcr - speed = 9600, lcr =
c3, a = b202
[ 3043.238999] usb 6-2: ch341_dbg - [0x2518] = c3 00, [0x1213] = 00 00
(post init - lcr reset)
[ 3043.241915] usb 6-2: ch341_set_baudrate_lcr - speed = 115200, lcr =
c3, a = cc03
[ 3043.244882] usb 6-2: ch341_dbg - [0x2518] = c3 00, [0x1213] = 00 00
(post init - lcr reset)
[ 3043.246899] usb 6-2: ch341_set_baudrate_lcr - speed = 115200, lcr =
c3, a = cc03
[ 3043.249890] usb 6-2: ch341_dbg - [0x2518] = c3 00, [0x1213] = 00 00
(post init - lcr reset)
[ 3060.100774] usb 6-2: ch341_set_baudrate_lcr - speed = 115200, lcr =
c0, a = cc03
[ 3060.104407] usb 6-2: ch341_dbg - [0x2518] = c3 00, [0x1213] = 00 00
(post init - lcr reset)
[ 3066.121089] usb 6-2: ch341_set_baudrate_lcr - speed = 115200, lcr =
c3, a = cc03
[ 3066.124400] usb 6-2: ch341_dbg - [0x2518] = c3 00, [0x1213] = 00 00
(post init - lcr reset)
[ 3075.702374] usb 6-2: ch341_set_baudrate_lcr - speed = 9600, lcr =
c3, a = b202
[ 3075.706305] usb 6-2: ch341_dbg - [0x2518] = c3 00, [0x1213] = 00 00
(post init - lcr reset)

Let me know if I can test anything else!


On Fri, Dec 16, 2016 at 9:30 AM, Johan Hovold <johan@xxxxxxxxxx> wrote:
> On Fri, Dec 16, 2016 at 05:13:50PM +0100, Johan Hovold wrote:
>> On Fri, Dec 16, 2016 at 08:04:18AM -0800, Russell Senior wrote:
>> > Sorry, I got distracted.  I'm back now.  Do you want me to test your
>> > 13 patch series?  And what is that on top of?
>>
>> Yes, please. It's against my usb-next branch.
>>
>> I'll send you a couple of diagnostics patches as well shortly.
>
> I ended up pushing a new branch, ch341 to my tree
>
>         git://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial.git
>
> which contains the full series as well as four debug patches (on top of
> usb-next).
>
> Could you first try and see if the series works with some register dumps
> enabled:
>
>         79e475a77796 dbg: ch341: add divisor and lcr debugging
>
> If that works, could you try the next commit and see if all still works
>
>         ee5a27b51e95 dbg: ch341: enable rx timer
>
> Either way, could you also try the next commit which again tries to use
> the init-command for all devices:
>
>         a06b45d910e3 dbg: ch341: use init for all devices
>
> and if that does not work, the final commit tries to use the init
> command but always use the chip default LCR:
>
>         6edc2830abe1 dbg: ch341: always use default LCR
>
> As you know there are, at least two levels of "working" here
>
>         1. Your device works and you can change baud rate, but you're
>            stuck with 8N1
>
>         2. Changing LCR also works (e.g. switching back and forth
>            between say 5N1 and 8N1 also works).
>
> When testing a new commit, always make sure to disconnect and reconnect
> the device first.
>
> Logs from all tests would be helpful (e.g. to see what effects the
> various commands has on the registers).
>
> Just let me know if you have any questions.
>
> Thanks,
> Johan
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]