From nobody Thu Feb 17 13:12:51 2022 X-Original-To: usb@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id D85E319CE550; Thu, 17 Feb 2022 13:12:56 +0000 (UTC) (envelope-from danny@cs.huji.ac.il) Received: from kabab.cs.huji.ac.il (kabab.cs.huji.ac.il [132.65.116.210]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4JzwHC5Ntvz3JkL; Thu, 17 Feb 2022 13:12:55 +0000 (UTC) (envelope-from danny@cs.huji.ac.il) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=cs.huji.ac.il; s=57791128; h=References:To:Cc:In-Reply-To:Date:Subject:Mime-Version:Content-Type:Message-Id:From; bh=l7AhjBdRPUl+PvLcIrjk7I8I7lWORGvnQfOgMqJsBvI=; b=QdHZ7BMMf8xeTuArH/yT451jGng5Oox+XvQInS99979Vv0P79zwZaLvNC8yXyzl4QfsACOFVxXNJ+O+yRuBM7b4HREIrEcMqXwghxDxelVEDHH2EvZv8xZoMBal0elsfMGyIGO7ZmSIaTTjsg4sCEHn3CyOTXGS0xNEjzSaYq6/FNzX4yNtpjBM5Fn4F6+XT7Ew7WDM1RcZtPFHptJ70S2rYbHrpAl04kKl9BTznhZDrahGKZsg/DYk66Kz8aVmGUUeUddo7paxFfqSYYpMkzWfOt4MjsVa2u0yWOFY2otGNIiD8wTlXaNk3wQHFu5Vxwhd2CDQo7QDPO1tzO3ZEsg==; Received: from imac.bk.cs.huji.ac.il ([132.65.179.42] helo=smtpclient.apple) by kabab.cs.huji.ac.il with esmtp id 1nKgaZ-000FiX-R7; Thu, 17 Feb 2022 15:12:51 +0200 From: Daniel Braniss Message-Id: <59810B39-C889-436F-8BC4-81680E09154B@cs.huji.ac.il> Content-Type: multipart/alternative; boundary="Apple-Mail=_89F3905D-F8FB-42AA-A831-8CE40CE41E81" List-Id: FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-usb List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-usb@freebsd.org X-BeenThere: freebsd-usb@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 15.0 \(3693.40.0.1.81\)) Subject: Re: usb CH9102 serial chip Date: Thu, 17 Feb 2022 15:12:51 +0200 In-Reply-To: Cc: freebsd- , "usb@freebsd.org" To: Daniel O'Connor References: <7DD6E1FA-3EA4-44D9-A272-9E51FB9F2BFC@dons.net.au> <013FB4BA-7D32-4FFB-AFD3-E594CF638A66@dons.net.au> <17E09096-A45B-43F5-BFE4-7645E8A2275D@cs.huji.ac.il> X-Mailer: Apple Mail (2.3693.40.0.1.81) X-Rspamd-Queue-Id: 4JzwHC5Ntvz3JkL X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=cs.huji.ac.il header.s=57791128 header.b=QdHZ7BMM; dmarc=pass (policy=none) header.from=huji.ac.il; spf=none (mx1.freebsd.org: domain of danny@cs.huji.ac.il has no SPF policy when checking 132.65.116.210) smtp.mailfrom=danny@cs.huji.ac.il X-Spamd-Result: default: False [-3.30 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[cs.huji.ac.il:s=57791128]; FREEFALL_USER(0.00)[danny]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; MV_CASE(0.50)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[cs.huji.ac.il:+]; DMARC_POLICY_ALLOW(-0.50)[huji.ac.il,none]; NEURAL_HAM_SHORT(-1.00)[-1.000]; MLMMJ_DEST(0.00)[hackers,usb]; R_SPF_NA(0.00)[no SPF record]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:378, ipnet:132.64.0.0/15, country:IL]; RCVD_COUNT_TWO(0.00)[2]; MID_RHS_MATCH_FROM(0.00)[] X-ThisMailContainsUnwantedMimeParts: N --Apple-Mail=_89F3905D-F8FB-42AA-A831-8CE40CE41E81 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On 17 Feb 2022, at 11:48, Daniel O'Connor wrote: >=20 >=20 >=20 >> On 17 Feb 2022, at 20:04, Daniel Braniss wrote: >>> On 17 Feb 2022, at 11:30, Daniel O'Connor = wrote: >>>=20 >>>> On 17 Feb 2022, at 19:50, Daniel Braniss = wrote: >>>>=20 >>>>> If that is the case then the chip/driver are working fine since = that requires bidirectional communication etc.. >>>>>=20 >>>>=20 >>>> but that works only if I power up the board while pressing a = button, then it also appears as /dev/ttyU0, and >>>> so then I can flash, after reset, the device is gone and there are = errors ( BTW, the flashed image workes): >>>>=20 >>>> Feb 17 09:46:59 pampero kernel: usbd_setup_device_desc: getting = device descriptor at addr 4 failed, USB_ERR_IOERROR >>>> Feb 17 09:47:00 pampero kernel: usbd_req_re_enumerate: addr=3D4, = set address failed! (USB_ERR_IOERROR, ignored) >>>=20 >>> What sort of dev board is it? >> m5 stamp C3U >> = https://shop.m5stack.com/products/m5stamp-c3u-mate-with-pin-headers?_pos=3D= 2&_sid=3D3df9b5f0d&_ss=3Dr&variant=3D42341016633601 >=20 > According to the docs the 'U' variant doesn't have a serial chip on = it. If you look at the schematic the USB +/- pins go straight to the = MCU. >=20 RTFM, then again RTFM :-) to quote: By default, USB CDC is not enabled, the serial port output started by = C3U will be output through UART0, if you need to output through USB, = please use IDE to make it USB CDC before downloading the program option = enabled. (Arduino users can enable it through Tools->USB CDC on = Boot-Enabled, IDF users please refer to ESP IDF official documentation.) now to hunt down the =E2=80=98official documentation=E2=80=99. thanks, danny > I suspect it has a boot loader which emulates the CH9102, when your = code is running it is whatever that does with the USB port, so if there = is a bug or whatever then it will exhibit weird behaviour. >=20 > -- > Daniel O'Connor > "The nice thing about standards is that there > are so many of them to choose from." > -- Andrew Tanenbaum --Apple-Mail=_89F3905D-F8FB-42AA-A831-8CE40CE41E81 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

On 17 Feb 2022, at 11:48, Daniel O'Connor <darius@dons.net.au> = wrote:



On 17 = Feb 2022, at 20:04, Daniel Braniss <danny@cs.huji.ac.il>= wrote:
On 17 Feb = 2022, at 11:30, Daniel O'Connor <darius@dons.net.au> wrote:

On 17 Feb 2022, at = 19:50, Daniel Braniss <danny@cs.huji.ac.il> wrote:

If that is the case then = the chip/driver are working fine since that requires bidirectional = communication etc..


but that works only if I power up the board while pressing a = button, then it also appears as /dev/ttyU0, and
so then I = can flash, after reset, the device is gone and there are errors ( BTW, = the flashed image workes):

Feb 17 09:46:59 = pampero kernel: usbd_setup_device_desc: getting device descriptor at = addr 4 failed, USB_ERR_IOERROR
Feb 17 09:47:00 pampero = kernel: usbd_req_re_enumerate: addr=3D4, set address failed! = (USB_ERR_IOERROR, ignored)

What = sort of dev board is it?
m5 stamp = C3U
https://shop.m5stack.com/products/m5stamp-c3u-mate-with-pin-hea= ders?_pos=3D2&_sid=3D3df9b5f0d&_ss=3Dr&variant=3D4234101663360= 1

According to the docs the 'U' variant doesn't have a serial = chip on it. If you look at the schematic the USB +/- pins go straight to = the MCU.

RTFM, then again RTFM = :-)
to quote:
By default, USB CDC is not enabled, = the serial port output started by=20 C3U will be output through UART0, if you need to output through USB,=20 please use IDE to make it USB CDC before downloading the program option=20= enabled. (Arduino users can enable it through Tools->USB CDC on = Boot-Enabled, IDF users please refer to = ESP IDF official documentation.)
now to hunt down the = =E2=80=98official documentation=E2=80=99.

thanks,
danny


I suspect it has a boot loader which emulates the CH9102, = when your code is running it is whatever that does with the USB port, so = if there is a bug or whatever then it will exhibit weird = behaviour.

--
Daniel = O'Connor
"The nice = thing about standards is that there
are so many of them to choose from."
-- Andrew = Tanenbaum

= --Apple-Mail=_89F3905D-F8FB-42AA-A831-8CE40CE41E81--