Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Apr 2015 12:57:21 +0200
From:      Hans Petter Selasky <hps@selasky.org>
To:        ticso@cicely.de
Cc:        freebsd-usb@freebsd.org, Bernd Walter <ticso@cicely7.cicely.de>
Subject:   Re: Strange problems with CH340G (uchcom)
Message-ID:  <55362D11.5080106@selasky.org>
In-Reply-To: <20150421104931.GC29418@cicely7.cicely.de>
References:  <20150420194855.GA29418@cicely7.cicely.de> <5535E84D.2010905@selasky.org> <20150421104931.GC29418@cicely7.cicely.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On 04/21/15 12:49, Bernd Walter wrote:
> On Tue, Apr 21, 2015 at 08:03:57AM +0200, Hans Petter Selasky wrote:
>> On 04/20/15 21:48, Bernd Walter wrote:
>>> I tried to flash an ESP8266 with the onboard CH340.
>>> The same board works fine when I use a CP2102 instead of the CH340.
>>> Flashing requires a python tool, which sends a SLIP encoded request
>>> and expects a SLIP encoded response with 115200@8n1.
>>> The read function however times out receiving the response without
>>> getting a single byte, even if I add a high delay between sending and
>>> reading.
>>> The strange thing is that I can see a valid response on a scope just
>>> a few µs after the request completes, while the receiver don't even
>>> see the first byte.
>>> If however I physically loopback the CH340 it receives it's own request
>>> just fine.
>>> Two CH340 xconnected work fine too.
>>> Same when I xconnect a CH340 and a CP2102.
>>> Now I'm completely out of ideas, why the python tool has problems
>>> to see the response data with the CH340.
>>>
>>
>> Try using:
>>
>> usbdump -i usbusX -f Y -vvv -s 65536
>>
>> And see if the reply is seen by the USB ... maybe it is a timing issue
>> like one character at a time instead of a word.
>
> I can't see the reply on USB.
> This is the first request:
> 12:32:44.019677 usbus1.6 SUBM-BULK-EP=00000002,SPD=FULL,NFR=1,SLEN=48,IVAL=0
>   frame[0] WRITE 46 bytes
>   0000  C0 00 08 24 00 00 00 00  00 07 07 12 20 55 55 55  |...$........ UUU|
>   0010  55 55 55 55 55 55 55 55  55 55 55 55 55 55 55 55  |UUUUUUUUUUUUUUUU|
>   0020  55 55 55 55 55 55 55 55  55 55 55 55 55 C0 -- --  |UUUUUUUUUUUUU.  |
>   flags 0x9 <FORCE_SHORT_XFER|PIPE_BOF|0>
>   status 0xca023 <OPEN|TRANSFERRING|STARTED|BDMA_ENABLE|BDMA_SETUP|CAN_CANCEL_IMMED|DOING_CALLBACK|0>
>
> It retries this a few times.
> But all BULK reads happen before.
>
> In the usbdump.ch340x I'd tried something else.
> I'd hit 'd' during that on a CP2102 terminal programm, which was connected to the RX-line.
> And at the beginning they got read:
> 12:42:51.930004 usbus1.6 DONE-BULK-EP=00000082,SPD=FULL,NFR=1,SLEN=32,IVAL=0,ERR=0
>   frame[0] READ 31 bytes
>   0000  64 64 64 64 64 64 64 64  64 64 64 64 64 64 64 64  |dddddddddddddddd|
>   0010  64 64 64 64 64 64 64 64  64 64 64 64 64 64 0D --  |dddddddddddddd. |
> But no reading after sending the request.
>

Hi,

If you don't see the traffic on USB and there are no USB errors, then 
maybe one of those control messages "SUBM-CTRL-EP=00000000" are clearing 
the FIFO. Could you check if there is such a message just before the 
expected data?

--HPS



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?55362D11.5080106>