From nobody Mon Oct 3 15:26:07 2022 X-Original-To: freebsd-hackers@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 4Mh4Rr2PCDz4d0W9; Mon, 3 Oct 2022 15:26:16 +0000 (UTC) (envelope-from Axel.Rau@Chaos1.DE) Received: from mailout4.lrau.net (mailout4.lrau.net [IPv6:2a05:bec0:26:2::73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mailout4.lrau.net", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Mh4Rp2fZnz47W1; Mon, 3 Oct 2022 15:26:14 +0000 (UTC) (envelope-from Axel.Rau@Chaos1.DE) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=chaos1.de; s=2022; h=References:To:In-Reply-To:Subject:Date:Mime-Version:Content-Type: Message-Id:From:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=ZF30VY8mkoTGfDc+FuzR2D7l7orTPEivtvXR+D0J6WQ=; b=G2eGC1WQH6dE14id0L4rDRiqb2 QWl5v/Wj3MjBUYbHlU2VXtftP0eYTDmRmcISJwunWFXNkKExK2G3dvd+rrWmi3ogFh4iDA4oMKCik IqENNh3hugwUee7+lmVcm+FACFctuxweIT82TRW19CrMt26hSVFUvmNqnbEqvPSMv7o2U7U4zl3yD g4prGOS3xV9qD66E4LAOoqQKCzni8EBg4kWvZ8VJO2WJ2QZMamx59XsDvIMlGAL98UBnF2Z763Z2p ZiX/RiisUYoSJoHaleqVVuy24xY3AsJ+FvETnKTg0yEXhcn7EiIto7jOm7b5+nNMkG0jlxA+G6QVH 7ZALGmdQ==; Received: from [2a05:bec0:26:2::74] (helo=imap4.lrau.net) by mailout4.lrau.net with esmtp (Exim 4.95 (FreeBSD)) (envelope-from ) id 1ofNKb-000Ntl-4t; Mon, 03 Oct 2022 15:26:09 +0000 Received: from Axel.Rau@Chaos1.DE by imap5.lrau.net (Archiveopteryx 3.2.0) with esmtpsa id 1664810768-11078-8168/7/136; Mon, 3 Oct 2022 15:26:08 +0000 From: Axel Rau Message-Id: <35D556D7-56EC-4295-93D6-80A4CFE6DCE9@Chaos1.DE> Content-Type: multipart/alternative; boundary="Apple-Mail=_B4FAB519-BB9C-4D16-82A3-B8D44681F591" List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org Mime-Version: 1.0 Date: Mon, 3 Oct 2022 17:26:07 +0200 Subject: Re: Accessing I2C-Bus via ELV USB-I2C In-Reply-To: <996df5c0-ffa7-f1bf-a9e2-6dd47d7b49e6@Chaos1.DE> To: hardware@freebsd.org, freebsd-hackers@freebsd.org References: <996df5c0-ffa7-f1bf-a9e2-6dd47d7b49e6@Chaos1.DE> X-Mailer: Apple Mail (2.3608.120.23.2.7) X-Rspamd-Queue-Id: 4Mh4Rp2fZnz47W1 X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=chaos1.de header.s=2022 header.b=G2eGC1WQ; dmarc=none; spf=none (mx1.freebsd.org: domain of Axel.Rau@Chaos1.DE has no SPF policy when checking 2a05:bec0:26:2::73) smtp.mailfrom=Axel.Rau@Chaos1.DE X-Spamd-Result: default: False [-3.90 / 15.00]; DWL_DNSWL_LOW(-1.00)[chaos1.de:dkim]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-1.000]; MV_CASE(0.50)[]; R_DKIM_ALLOW(-0.20)[chaos1.de:s=2022]; RCVD_IN_DNSWL_LOW(-0.10)[2a05:bec0:26:2::73:from]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; FROM_EQ_ENVFROM(0.00)[]; ASN(0.00)[asn:197071, ipnet:2a05:bec0::/29, country:DE]; MIME_TRACE(0.00)[0:+,1:+,2:~]; MLMMJ_DEST(0.00)[hardware@freebsd.org,freebsd-hackers@freebsd.org]; R_SPF_NA(0.00)[no SPF record]; RCVD_TLS_LAST(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; RCVD_COUNT_THREE(0.00)[3]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; DKIM_TRACE(0.00)[chaos1.de:+]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DMARC_NA(0.00)[chaos1.de]; TO_DN_NONE(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[] X-ThisMailContainsUnwantedMimeParts: N --Apple-Mail=_B4FAB519-BB9C-4D16-82A3-B8D44681F591 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 =46rom time to time the I2C layer on top of the uart locks up and can=E2=80=99t be recovered via its built in reset command. Initialialization at [1]:2564 is missing the greeting message. looking at the traffic with usbdump -d ugen1.3 -v -v -v -s 1024 > usb.txt I=E2=80=99m missing some response data from the I2C controller. Questions: 1. On usbdump, why is the hexdump mssing on some lines like frame[0] WRITE bytes ? 2. Do we have a tool to dump traffic directly on the uart layer? Any help appreciated, Axel [1]: https://github.com/mc3/home2l/blob/master/brownies/brownies.C > Am 27.04.2022 um 23:08 schrieb Axel Rau : >=20 > Next journey starts: >=20 > For the home2l project, I need a supported I2C interface via USB. > I got this one: > https://de.elv.com/elv-usb-ic-interface-usb-i2c-092255?fs=3D1805459039 > Unfortunately it shows up as a serial device on FreeBSD: >=20 > ugen0.2: at usbus0, cfg=3D0 = md=3DHOST spd=3DFULL (12Mbps) pwr=3DON (500mA) >=20 > bLength =3D 0x0012 > bDescriptorType =3D 0x0001 > bcdUSB =3D 0x0110 > bDeviceClass =3D 0x0000 > bDeviceSubClass =3D 0x0000 > bDeviceProtocol =3D 0x0000 > bMaxPacketSize0 =3D 0x0040 > idVendor =3D 0x10c4 > idProduct =3D 0xea60 > bcdDevice =3D 0x0100 > iManufacturer =3D 0x0001 > iProduct =3D 0x0002 > iSerialNumber =3D 0x0003 > bNumConfigurations =3D 0x0001 >=20 > In loader.conf, I have: > uslcom_load=3D"YES" > iic_load=3D"YES" > iicbus_loa >=20 > But the i2c utility does not show a new bus. >=20 > From dmesg: > root@axels-bsdbox:~ # dmesg | grep iic > ig4iic0: mem 0xdf230000-0xdf23= 0fff irq 16 at device 21.0 on pci0 > ig4iic0: Using MSI > iicbus0: on ig4iic0 > iic0: on iicbus0 > ig4iic1: mem 0xdf22f000-0xdf22= ffff irq 17 at device 21.1 on pci0 > ig4iic1: Using MSI > iicbus1: on ig4iic1 > iic1: on iicbus1 > root@axels-bsdbox:~ # dmesg | grep I2C > ig4iic0: mem 0xdf230000-0xdf23= 0fff irq 16 at device 21.0 on pci0 > iicbus0: on ig4iic0 > iic0: on iicbus0 > ig4iic1: mem 0xdf22f000-0xdf22= ffff irq 17 at device 21.1 on pci0 > iicbus1: on ig4iic1 > iic1: on iicbus1 > ugen0.2: at usbus0 > uslcom0: on usbus0 >=20 > They provide a (linux) driver ("Treiber") which seems to implement the = I2C protocoll on top of the serial interface. > Do we have such a driver on FreeBSD, or exist other supported I2C = devices to be plugged into USB? >=20 > Any help appreciated, > Axel =2D-- PGP-Key: CDE74120 =E2=98=80 computing @ chaos claudius --Apple-Mail=_B4FAB519-BB9C-4D16-82A3-B8D44681F591 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 From time to = time the I2C layer on top of the uart locks up
and can=E2=80= =99t be recovered via its built in reset command.
In= itialialization at [1]:2564 is missing the greeting message.

looking at the traffic with
usbdump -d ugen1.3 -v -v -v -s 1024 > = usb.txt
I=E2=80=99m missing some response = data from the I2C controller.

<= div class=3D"">Questions:
1. On usbdump, why is the = hexdump mssing on some lines like
frame[0] WRITE <n> bytes  ?

2. Do we have a = tool to dump traffic directly on the uart layer?

Any help appreciated, Axel


=
Am 27.04.2022 um 23:08 schrieb Axel Rau <Axel.Rau@chaos1.de>:

Next = journey starts:

For the home2l project, I = need a supported I2C interface via USB.
I got this one:
https://de.elv.com/elv-usb-ic-interface-u= sb-i2c-092255?fs=3D1805459039
Unfortunately it shows = up as a serial device on FreeBSD:

ugen0.2: = <Silicon Labs ELV USB-I2C-Interface> at usbus0, cfg=3D0 md=3DHOST = spd=3DFULL (12Mbps) pwr=3DON (500mA)

=  bLength =3D 0x0012
 bDescriptorType =3D = 0x0001
 bcdUSB =3D 0x0110
 bDevic= eClass =3D 0x0000  <Probed by interface class>
=  bDeviceSubClass =3D 0x0000
 bDeviceProtocol = =3D 0x0000
 bMaxPacketSize0 =3D 0x0040
=  idVendor =3D 0x10c4
 idProduct =3D 0xea60
 bcdDevice =3D 0x0100
 iManufacturer= =3D 0x0001  <Silicon Labs>
 iProduct =3D = 0x0002  <ELV USB-I2C-Interface>
 iSerialNu= mber =3D 0x0003  <B5AAP0EEUK6A3CIZ>
 bNumC= onfigurations =3D 0x0001

In loader.conf, I = have:
uslcom_load=3D"YES"
iic_load=3D"YES"iicbus_loa

But the i2c utility = does not show a new bus.

From dmesg:
root@axels-bsdbox:~ # dmesg | grep iic
ig4iic0: = <Intel Sunrise Point-H I2C Controller-0> mem 0xdf230000-0xdf230fff = irq 16 at device 21.0 on pci0
ig4iic0: Using MSI
iicbus0: <Philips I2C bus (ACPI-hinted)> on ig4iic0
iic0: <I2C generic I/O> on iicbus0
ig4iic1= : <Intel Sunrise Point-H I2C Controller-1> mem 0xdf22f000-0xdf22fff= f irq 17 at device 21.1 on pci0
ig4iic1: Using MSI
iicbus1: <Philips I2C bus (ACPI-hinted)> on ig4iic1
iic1: <I2C generic I/O> on iicbus1
root@ax= els-bsdbox:~ # dmesg | grep I2C
ig4iic0: <Intel Sunrise = Point-H I2C Controller-0> mem 0xdf230000-0xdf230fff irq 16 at device = 21.0 on pci0
iicbus0: <Philips I2C bus (ACPI-hinted)>= on ig4iic0
iic0: <I2C generic I/O> on iicbus0
ig4iic1: <Intel Sunrise Point-H I2C Controller-1> mem = 0xdf22f000-0xdf22ffff irq 17 at device 21.1 on pci0
iicbus1= : <Philips I2C bus (ACPI-hinted)> on ig4iic1
iic1: = <I2C generic I/O> on iicbus1
ugen0.2: <Silicon = Labs ELV USB-I2C-Interface> at usbus0
uslcom0: <ELV = USB-I2C-Interface> on usbus0

They = provide a (linux) driver ("Treiber") which seems to implement the I2C = protocoll on top of the serial interface.
Do we have such = a driver on FreeBSD, or exist other supported I2C devices to be plugged = into USB?

Any help appreciated,
Axel


---
PGP-Key: CDE74120  =E2=98=80 =  computing @ chaos claudius

--Apple-Mail=_B4FAB519-BB9C-4D16-82A3-B8D44681F591--