From nobody Thu Sep 15 12:29:45 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 4MSxNY3Cc7z4c5r7; Thu, 15 Sep 2022 12:29:49 +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 4MSxNX1xbMz3m6q; Thu, 15 Sep 2022 12:29:48 +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=TNdaM3VANthJACElyypZr+WCr+ok+5+JzyJyrQeZQLI=; b=ZPARK5T7cx4rtjlL7mEmeC9jFS7JqKP1x/rCnFdbti1NkPK1JMynJzeXsmOsS8xaDBU5JBpAc/HXUd8VIOBX795ymF3WEAwxlYASTRa7Mi3woTgXULY8FIV6iDHpL5r33AuX4WQJyQSGvXCoKAuDJyvkGWt38z4/6+OylPv5+MkayZf921aYY/wswBxUlbgahqr12ZcW9R+BdG29vPDNXKSmVAt6RF5fsr4UC9xS0UoYNDbAogoWv7v/5u1sbZcPVJmQfF871fCtJN+bLtBjleXMp+2WCElQEbEpPOwOC9o1Y4qhxW6+LKtjJqnKpMvLajV997NeEWKQgCPKOo6oqw==; Received: from imac.bk.cs.huji.ac.il ([132.65.179.42] helo=smtpclient.apple) by kabab.cs.huji.ac.il with esmtp id 1oYo01-000DIc-8s; Thu, 15 Sep 2022 15:29:45 +0300 From: Daniel Braniss Message-Id: <2658B51D-E40A-4B08-8EDF-7CF1264B0FB4@cs.huji.ac.il> Content-Type: multipart/alternative; boundary="Apple-Mail=_8B7298CB-40D9-437F-8508-6C670CBDA90B" 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 16.0 \(3696.120.41.1.1\)) Subject: Re: USB chip CH9102F Date: Thu, 15 Sep 2022 15:29:45 +0300 In-Reply-To: Cc: freebsd-hackers , "usb@freebsd.org" To: CeDeROM References: X-Mailer: Apple Mail (2.3696.120.41.1.1) X-Rspamd-Queue-Id: 4MSxNX1xbMz3m6q X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=cs.huji.ac.il header.s=57791128 header.b=ZPARK5T7; 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]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-0.995]; DMARC_POLICY_ALLOW(-0.50)[huji.ac.il,none]; MV_CASE(0.50)[]; R_DKIM_ALLOW(-0.20)[cs.huji.ac.il:s=57791128]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; FROM_EQ_ENVFROM(0.00)[]; MLMMJ_DEST(0.00)[hackers@freebsd.org,usb@freebsd.org]; R_SPF_NA(0.00)[no SPF record]; ASN(0.00)[asn:378, ipnet:132.64.0.0/15, country:IL]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; TO_DN_EQ_ADDR_SOME(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FREEFALL_USER(0.00)[danny]; ARC_NA(0.00)[]; DKIM_TRACE(0.00)[cs.huji.ac.il:+]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; MID_RHS_MATCH_FROM(0.00)[] X-ThisMailContainsUnwantedMimeParts: N --Apple-Mail=_8B7298CB-40D9-437F-8508-6C670CBDA90B Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On 14 Sep 2022, at 18:14, CeDeROM wrote: >=20 > On Wed, Sep 14, 2022 at 3:43 PM Daniel Braniss wrote: >> Hi, >> is there/will there be any support for this chip? CH9102F. >>=20 >> there is a driver for linux and windows, but event though it sort of = works on FreeBSD, >> the magic needed to flash the firmware on newer esp32=E2=80=99s is = not working. >=20 > I also bought USB-C based UART-to-USB adapter from Waveshare with > CH343G chip and use it for ESP32 flashing. >=20 > This chip is a bit tricky and I have noticed it is less reliable for > initial flashing on a custom ESP32 board (boot mode selection using > RTS/CTS pins). It sometimes fails, while older USB-UART converters > works fine. >=20 > What are your problems exactly? >=20 pampa> /vol/src/esp/current/components/esptool_py/esptool/esptool.py -p = /dev/ttyU0 read_mac esptool.py v3.3-dev Serial port /dev/ttyU0 Connecting... Failed to get PID of a device on /dev/ttyU0, using standard reset = sequence. . Detecting chip type... ESP32-C3 Chip is ESP32-C3 (revision 3) Features: Wi-Fi Crystal is 40MHz MAC: 7c:df:a1:a3:61:74 Uploading stub... A fatal error occurred: Failed to write to target RAM (result was = 01070000: Operation timed out) > Are you sure this is not the custom hardware design issue? >=20 no, it=E2=80=99 happens on several esp32s specially from m5stack > Do you have Reset and BootSel pins on your board that you can trigger > by hand in order to help USB-UART cable? this particular onw, m6stack black/basic, has no gpio-0 available to = enter download mode, the older models have no problem with the usb-c >=20 > What is your magic that you need to do in order to flash the chip = successfully? see the above. some other boards I just connect gpio-0 to ground, or have to press a = button before power on, but I can flash. Also, as soon as I manage to flash, I can continue = flashing over the air. >=20 > Does standard operations (UART CLI) work as expected? again, all boards/thingis i have no problem reading the console, and = even writing >=20 > Did you take a look at man stty and use stty crtscts / stty > -crtscts to see if that fixes anything? the initial (or when my software crashes) flashing is done via a python = that does all the magic. >=20 > -- > CeDeROM, SQ7MHZ, http://www.tomek.cedro.info >=20 well, it does feel better knowing i=E2=80=99m not the only one with this = problem :-) --Apple-Mail=_8B7298CB-40D9-437F-8508-6C670CBDA90B Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

On 14 Sep 2022, at 18:14, CeDeROM <cederom@tlen.pl> = wrote:

On Wed, Sep 14, 2022 at 3:43 PM Daniel Braniss wrote:
Hi,
is = there/will there be any support for this chip? CH9102F.

there is a driver for linux and windows, but event though it = sort of works on FreeBSD,
the magic needed to flash the = firmware on newer esp32=E2=80=99s is not working.

I also bought USB-C based = UART-to-USB adapter from Waveshare with
CH343G chip and = use it for ESP32 flashing.

This chip is a = bit tricky and I have noticed it is less reliable for
initial flashing on a custom ESP32 board (boot mode selection = using
RTS/CTS pins). It sometimes fails, while older = USB-UART converters
works fine.

What are your problems exactly?

pampa> = /vol/src/esp/current/components/esptool_py/esptool/esptool.py -p = /dev/ttyU0 read_mac
esptool.py = v3.3-dev
Serial port = /dev/ttyU0
Connecting...
Failed to get PID of a device on = /dev/ttyU0, using standard reset sequence.
.
Detecting chip type... = ESP32-C3
Chip is ESP32-C3 (revision = 3)
Features: Wi-Fi
Crystal is 40MHz
MAC: 7c:df:a1:a3:61:74
Uploading stub...

A fatal error occurred: Failed to write to target RAM (result = was 01070000: Operation timed out)

Are you sure = this is not the custom hardware design issue?

no, it=E2=80=99 happens on several = esp32s specially from m5stack

Do you have = Reset and BootSel pins on your board that you can trigger
by= hand in order to help USB-UART cable?
this particular onw, m6stack = black/basic, has no gpio-0 available to enter
download mode, = the older models have no problem with the usb-c

What is your magic that you need to do in order to flash the = chip successfully?
see the = above.
some other boards I just connect gpio-0 to ground, or = have to press a button before power on,
but I can flash. Also, = as soon as I manage to flash, I can continue flashing over the = air.


Does standard operations (UART = CLI) work as expected?
again, all = boards/thingis i have no problem reading the console, and even = writing

Did you take a look at man = stty and use stty crtscts <port> / stty
-crtscts = <port> to see if that fixes anything?

the = initial (or when my software crashes) flashing is done via a python that = does all the magic.

--
CeDeROM, SQ7MHZ, http://www.tomek.cedro.info



well, it does feel = better knowing i=E2=80=99m not the only one with this problem = :-)

= --Apple-Mail=_8B7298CB-40D9-437F-8508-6C670CBDA90B--