Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1213986 > unrolled thread

Likely issue with ch341 kernel-module/driver

Started byAjay Garg <ajaygargnsit@gmail.com>
First post2015-08-26 18:10 +0200
Last post2015-08-27 14:10 +0200
Articles 9 — 3 participants

Back to article view | Back to linux.kernel


Contents

  Likely issue with ch341 kernel-module/driver Ajay Garg <ajaygargnsit@gmail.com> - 2015-08-26 18:10 +0200
    Re: Likely issue with ch341 kernel-module/driver Johan Hovold <johan@kernel.org> - 2015-08-26 19:10 +0200
      Re: Likely issue with ch341 kernel-module/driver Peter Stuge <peter@stuge.se> - 2015-08-26 20:10 +0200
        Re: Likely issue with ch341 kernel-module/driver Johan Hovold <johan@kernel.org> - 2015-08-26 20:20 +0200
          Re: Likely issue with ch341 kernel-module/driver Ajay Garg <ajaygargnsit@gmail.com> - 2015-08-27 08:50 +0200
            Re: Likely issue with ch341 kernel-module/driver Johan Hovold <johan@kernel.org> - 2015-08-27 09:40 +0200
              Re: Likely issue with ch341 kernel-module/driver Ajay Garg <ajaygargnsit@gmail.com> - 2015-08-27 10:30 +0200
                Re: Likely issue with ch341 kernel-module/driver Johan Hovold <johan@kernel.org> - 2015-08-27 11:50 +0200
              Re: Likely issue with ch341 kernel-module/driver Peter Stuge <peter@stuge.se> - 2015-08-27 14:10 +0200

#1213986 — Likely issue with ch341 kernel-module/driver

FromAjay Garg <ajaygargnsit@gmail.com>
Date2015-08-26 18:10 +0200
SubjectLikely issue with ch341 kernel-module/driver
Message-ID<q1LqV-2d7-13@gated-at.bofh.it>
Hi all.

I am attaching the RS232-TTL via a serial-USB converter on my machine.

However, when I connect a putty-session with my embedded-device, I see
strange issues (garbage characters transmitted from embedded-device to
putty; nothing can be read from putty into embedded-device).

It seems that there is some issue with the driver.
Lots of these lines are seen in dmesg ::


########################################################################################
[ 8657.022997] ch341-uart ttyUSB0:
usb_serial_generic_read_bulk_callback - nonzero urb status: -71
########################################################################################



Other informations ::

########################################################################################
ajay@ajay-HP-15-Notebook-PC:~$ lsusb
Bus 001 Device 002: ID 8087:8001 Intel Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 003: ID 05c8:036e Cheng Uei Precision Industry Co., Ltd (Foxlink)
Bus 002 Device 002: ID 0bda:b001 Realtek Semiconductor Corp.
Bus 002 Device 011: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
########################################################################################


########################################################################################
ajay@ajay-HP-15-Notebook-PC:~$ lsmod | grep ch341
ch341                  13761  1
usbserial              38972  3 ch341
########################################################################################


########################################################################################
ajay@ajay-HP-15-Notebook-PC:~$ uname -a
Linux ajay-HP-15-Notebook-PC 3.16.0-30-generic #40~14.04.1-Ubuntu SMP
Thu Jan 15 17:45:15 UTC 2015 i686 i686 i686 GNU/Linux
########################################################################################



Any chance this can be made to work? Any upgrade that might solve the issue?
We will be grateful for ideas.


Thanks and Regards,
Ajay
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1214049

FromJohan Hovold <johan@kernel.org>
Date2015-08-26 19:10 +0200
Message-ID<q1Mn1-3z4-23@gated-at.bofh.it>
In reply to#1213986
[ +CC: linux-usb ]

On Wed, Aug 26, 2015 at 09:39:36PM +0530, Ajay Garg wrote:
> Hi all.
> 
> I am attaching the RS232-TTL via a serial-USB converter on my machine.
> 
> However, when I connect a putty-session with my embedded-device, I see
> strange issues (garbage characters transmitted from embedded-device to
> putty; nothing can be read from putty into embedded-device).
> 
> It seems that there is some issue with the driver.

Why do think it's a driver issue?

> Lots of these lines are seen in dmesg ::
> 
> 
> ########################################################################################
> [ 8657.022997] ch341-uart ttyUSB0:
> usb_serial_generic_read_bulk_callback - nonzero urb status: -71
> ########################################################################################
> 
> 
> 
> Other informations ::
> 
> ########################################################################################
> ajay@ajay-HP-15-Notebook-PC:~$ lsusb
> Bus 001 Device 002: ID 8087:8001 Intel Corp.
> Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
> Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
> Bus 002 Device 003: ID 05c8:036e Cheng Uei Precision Industry Co., Ltd (Foxlink)
> Bus 002 Device 002: ID 0bda:b001 Realtek Semiconductor Corp.
> Bus 002 Device 011: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter
> Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
> ########################################################################################
> 
> 
> ########################################################################################
> ajay@ajay-HP-15-Notebook-PC:~$ lsmod | grep ch341
> ch341                  13761  1
> usbserial              38972  3 ch341
> ########################################################################################
> 
> 
> ########################################################################################
> ajay@ajay-HP-15-Notebook-PC:~$ uname -a
> Linux ajay-HP-15-Notebook-PC 3.16.0-30-generic #40~14.04.1-Ubuntu SMP
> Thu Jan 15 17:45:15 UTC 2015 i686 i686 i686 GNU/Linux
> ########################################################################################
> 
> 
> 
> Any chance this can be made to work? Any upgrade that might solve the issue?
> We will be grateful for ideas.

This is a known issue with your device that has been reported in this
thread:

	https://lkml.kernel.org/r/CAF3ayyDe44POd1NoSBqn_gjA8XLoK3r_getDYnWx+a_1rL0r5g@mail.gmail.com

Looks like a hardware issue, I'm afraid.

Johan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1214087

FromPeter Stuge <peter@stuge.se>
Date2015-08-26 20:10 +0200
Message-ID<q1Nj4-4Uz-5@gated-at.bofh.it>
In reply to#1214049
Johan Hovold wrote:
> On Wed, Aug 26, 2015 at 09:39:36PM +0530, Ajay Garg wrote:
..
> > garbage characters transmitted from embedded-device
..
> > It seems that there is some issue with the driver.
> 
> Why do think it's a driver issue?

I can confirm similar issues with the in-tree driver and my hardware.


> > Any chance this can be made to work?

Ajay, please try building the vendor driver. That works well for me.


> > Any upgrade that might solve the issue?

There is no upgrade. Someone needs to spend a day or so on adding
functionality from the vendor driver to the in-tree driver, in a
backwards-compatible way.


> Looks like a hardware issue, I'm afraid.

When I got garbage from the in-tree driver it was indeed a driver issue.


//Peter
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1214094

FromJohan Hovold <johan@kernel.org>
Date2015-08-26 20:20 +0200
Message-ID<q1NsK-55Y-25@gated-at.bofh.it>
In reply to#1214087
On Wed, Aug 26, 2015 at 08:09:30PM +0200, Peter Stuge wrote:
> Johan Hovold wrote:
> > On Wed, Aug 26, 2015 at 09:39:36PM +0530, Ajay Garg wrote:
> ..
> > > garbage characters transmitted from embedded-device
> ..
> > > It seems that there is some issue with the driver.
> > 
> > Why do think it's a driver issue?
> 
> I can confirm similar issues with the in-tree driver and my hardware.

What hardware is that?

> > > Any chance this can be made to work?
> 
> Ajay, please try building the vendor driver. That works well for me.

Yes, please do.

> > > Any upgrade that might solve the issue?
> 
> There is no upgrade. Someone needs to spend a day or so on adding
> functionality from the vendor driver to the in-tree driver, in a
> backwards-compatible way.
> 
> > Looks like a hardware issue, I'm afraid.
> 
> When I got garbage from the in-tree driver it was indeed a driver issue.

That's good to hear. Care to write up a patch? :)

Thanks,
Johan 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1214340

FromAjay Garg <ajaygargnsit@gmail.com>
Date2015-08-27 08:50 +0200
Message-ID<q1Zay-524-9@gated-at.bofh.it>
In reply to#1214094
I started in the morning to build the driver from the source provided
by the vendor, but it was written in the times of kernel-version 2.4,
and I got hopelessly stuck.

Wanting to take a break, I reset my setup, and VERY strangely, what I
now observe is ::

a)
I am NOT able to send anything from the embedded-system to
putty-session (nothing appears at all on the putty session).

b)
Receive is working perfectly (anything I type in the putty-session is
received fine in the embedded-application).


Not sure what the hell is going on :(

Also, as per http://lxr.free-electrons.com/source/drivers/usb/serial/ch341.c?v=3.16,
the particular serial-USB-adapter device is added into the id_table,
so seems supported as per say.


Additionally, the message has changed to

###########################################################
usb 2-2: device not accepting address 8, error -71
###########################################################



Completely lost :(

On Wed, Aug 26, 2015 at 11:45 PM, Johan Hovold <johan@kernel.org> wrote:
> On Wed, Aug 26, 2015 at 08:09:30PM +0200, Peter Stuge wrote:
>> Johan Hovold wrote:
>> > On Wed, Aug 26, 2015 at 09:39:36PM +0530, Ajay Garg wrote:
>> ..
>> > > garbage characters transmitted from embedded-device
>> ..
>> > > It seems that there is some issue with the driver.
>> >
>> > Why do think it's a driver issue?
>>
>> I can confirm similar issues with the in-tree driver and my hardware.
>
> What hardware is that?
>
>> > > Any chance this can be made to work?
>>
>> Ajay, please try building the vendor driver. That works well for me.
>
> Yes, please do.
>
>> > > Any upgrade that might solve the issue?
>>
>> There is no upgrade. Someone needs to spend a day or so on adding
>> functionality from the vendor driver to the in-tree driver, in a
>> backwards-compatible way.
>>
>> > Looks like a hardware issue, I'm afraid.
>>
>> When I got garbage from the in-tree driver it was indeed a driver issue.
>
> That's good to hear. Care to write up a patch? :)
>
> Thanks,
> Johan



-- 
Regards,
Ajay
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1214367

FromJohan Hovold <johan@kernel.org>
Date2015-08-27 09:40 +0200
Message-ID<q1ZWV-6e9-5@gated-at.bofh.it>
In reply to#1214340
[ Please avoid top-posting. ]

On Thu, Aug 27, 2015 at 12:13:32PM +0530, Ajay Garg wrote:
> I started in the morning to build the driver from the source provided
> by the vendor, but it was written in the times of kernel-version 2.4,
> and I got hopelessly stuck.

The vendor driver is only for 2.4? Peter?

> Wanting to take a break, I reset my setup, and VERY strangely, what I
> now observe is ::
> 
> a)
> I am NOT able to send anything from the embedded-system to
> putty-session (nothing appears at all on the putty session).
> 
> b)
> Receive is working perfectly (anything I type in the putty-session is
> received fine in the embedded-application).
> 
> 
> Not sure what the hell is going on :(

Did you enable hardware flow control somewhere perhaps?

> Also, as per http://lxr.free-electrons.com/source/drivers/usb/serial/ch341.c?v=3.16,
> the particular serial-USB-adapter device is added into the id_table,
> so seems supported as per say.

That id was added by 82078234d402 ("USB: serial: ch341: New VID/PID for
CH341 USB-serial") in 2008, which claims that the driver supports both
old and new devices.

> Additionally, the message has changed to
> 
> ###########################################################
> usb 2-2: device not accepting address 8, error -71
> ###########################################################

This still looks like a hardware issue to me. Specifically, this happens
before the ch341 driver is even involved.

> Completely lost :(

Try to see if you can get the device to work reliably with some other
driver (vendor driver or other OS) to rule out a broken device. 

Thanks,
Johan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1214380

FromAjay Garg <ajaygargnsit@gmail.com>
Date2015-08-27 10:30 +0200
Message-ID<q20Jk-7q5-17@gated-at.bofh.it>
In reply to#1214367
Hi John.

On Thu, Aug 27, 2015 at 1:07 PM, Johan Hovold <johan@kernel.org> wrote:
>
> Try to see if you can get the device to work reliably with some other
> driver (vendor driver or other OS) to rule out a broken device.
>

I tested the serial-usb adapter using a loopback-hardware-tool
(confirmed to be perfect).
Using this, I see what I type, echo it back, and see what I receive.

The putty session-settings are standard one - 9600, 8N-1, no parity.


The byte flow is
putty-on-laptop => usb-interface => serial-interface => loopback =>
serial-interface => usb-interface => putty-on-laptop.

Thereafter, following are the echo-sequences I see ::

a ==> 0
b ==> '
c ==> N



This (I guess) confirms a problem on (at least) the driver-side.

Thanks everyone for the quick replies so far, I am grateful.


Thanks and Regards,
Ajay
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1214432

FromJohan Hovold <johan@kernel.org>
Date2015-08-27 11:50 +0200
Message-ID<q21YJ-Gn-3@gated-at.bofh.it>
In reply to#1214380
On Thu, Aug 27, 2015 at 01:57:01PM +0530, Ajay Garg wrote:
> Hi John.
> 
> On Thu, Aug 27, 2015 at 1:07 PM, Johan Hovold <johan@kernel.org> wrote:
> >
> > Try to see if you can get the device to work reliably with some other
> > driver (vendor driver or other OS) to rule out a broken device.
> >
> 
> I tested the serial-usb adapter using a loopback-hardware-tool
> (confirmed to be perfect).
>
> Using this, I see what I type, echo it back, and see what I receive.
> 
> The putty session-settings are standard one - 9600, 8N-1, no parity.
> 
> The byte flow is
> putty-on-laptop => usb-interface => serial-interface => loopback =>
> serial-interface => usb-interface => putty-on-laptop.
>
> Thereafter, following are the echo-sequences I see ::
> 
> a ==> 0
> b ==> '
> c ==> N
> 
> This (I guess) confirms a problem on (at least) the driver-side.

Not unless you confirm that the same setup works when using a different
driver, right? Otherwise, it could still be a hw issue.

Johan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1214499

FromPeter Stuge <peter@stuge.se>
Date2015-08-27 14:10 +0200
Message-ID<q24ae-3Zi-27@gated-at.bofh.it>
In reply to#1214367

[Multipart message — attachments visible in raw view] — view raw

Johan Hovold wrote:
> > I started in the morning to build the driver from the source provided
> > by the vendor, but it was written in the times of kernel-version 2.4,
> > and I got hopelessly stuck.
> 
> The vendor driver is only for 2.4? Peter?

http://www.wch.cn/download/CH341SER_LINUX_ZIP.html
http://www.wch.cn/downfile/177

The vendor driver version 1.2 readme.txt from 2014-10-10 says:

Current Driver support versions of linux kernel range from 2.6.25 to 3.13.x

It didn't build immediately against the kernel I had at hand, but with
a small touchup (patch attached) it built fine against a 3.10 kernel.


> > Also, as per http://lxr.free-electrons.com/source/drivers/usb/serial/ch341.c?v=3.16,
> > the particular serial-USB-adapter device is added into the id_table,
> > so seems supported as per say.
> 
> That id was added by 82078234d402 ("USB: serial: ch341: New VID/PID for
> CH341 USB-serial") in 2008, which claims that the driver supports both
> old and new devices.

My hardware has that same VID/PID, but there is a version request
sent to the device and my version number is quite a bit higher (20-30)
than what is mentioned in the in-tree driver comments; I guess the
protocol grew with newer versions of the device, but VID/PID weren't
updated. I'm sure it's possible to have a backwards-compatible
driver, but the vendor driver differs enough from the in-tree driver
that I can't be confident that simply doing what the vendor driver
does will work also on older versions of the device.


> > ###########################################################
> > usb 2-2: device not accepting address 8, error -71
> > ###########################################################
> 
> This still looks like a hardware issue to me. Specifically, this happens
> before the ch341 driver is even involved.

I haven't seen any messages like this with my hardware.


//Peter

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web