Date: Mon, 14 Mar 2022 18:12:40 +0800 From: Archimedes Gaviola <archimedes.gaviola@gmail.com> To: Hans Petter Selasky <hps@selasky.org> Cc: freebsd-arm@freebsd.org Subject: Re: Raspberry Pi 3B USB Printing Issue Message-ID: <CAJFbk7EutGbB-LoHxN_mUZbSb70C8yjxfZBADvejuCLwTcD5FA@mail.gmail.com> In-Reply-To: <7a77e3bd-1186-56a6-e60e-89e51c190a01@selasky.org> References: <CAJFbk7EzSfPNbaGxiweKrivwNrKXCPVzA1b7_=0_bTvbs8oBow@mail.gmail.com> <7c67118e-f6ec-c87d-9a81-3ee6a5952f49@selasky.org> <CAJFbk7GYbLAFTJY077Nzh3CTBJM6bk8swr4AkgGMaukCxrfcHQ@mail.gmail.com> <60f98b10-dcdc-cdf4-3d7a-fe9fd4dff223@selasky.org> <CAJFbk7EAjrQG5Kj_upVKW72opOS%2B8d63VrMnQdLxcJjUcfsd=g@mail.gmail.com> <8226461b-5740-9c19-0575-2740bd952e16@selasky.org> <CAJFbk7GwjFA-=GrJG3KTCnqVfEPhRSY1g8xyws_nE8pAohErEg@mail.gmail.com> <dabb798c-435c-6dd3-ac9b-8db3fb02a43c@selasky.org> <CAJFbk7FFeNTKvbNMr41kkwwYtyamJybTzk3=DQB1Hg3z%2Bx2hgQ@mail.gmail.com> <CAJFbk7GZF4ahORzCUKaLZS4b=fCJQbEADPJmMYZjyaJwRR%2Bhbw@mail.gmail.com> <CAJFbk7Fxz24r73AzHGhZHHKYwyHLqn-HCpiCpsAi4D-E6oKtKg@mail.gmail.com> <7a77e3bd-1186-56a6-e60e-89e51c190a01@selasky.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--0000000000001ed12005da2aec65 Content-Type: text/plain; charset="UTF-8" On Mon, Mar 14, 2022 at 5:31 PM Hans Petter Selasky <hps@selasky.org> wrote: > On 3/14/22 10:20, Archimedes Gaviola wrote: > > On Sun, Mar 13, 2022 at 11:25 PM Archimedes Gaviola < > > archimedes.gaviola@gmail.com> wrote: > > > >> > >> > >> On Sun, Mar 13, 2022 at 2:27 PM Archimedes Gaviola < > >> archimedes.gaviola@gmail.com> wrote: > >> > >>> > >>> > >>> On Sun, Mar 13, 2022 at 12:38 AM Hans Petter Selasky <hps@selasky.org> > >>> wrote: > >>> > >>>> On 3/12/22 16:31, Archimedes Gaviola wrote: > >>>>>> > >>>>>> IOERROR usually means an electrical error. The RPI3B will use a > >>>>>> transaction translator for the FULL speed traffic, which is driven > by > >>>>>> software. > >>>>> > >>>> > >>>> Hi Archimedes, > >>>> > >>>>> Hi Hans, > >>>>> > >>>>> I'm curious about the transaction translator you've mentioned, any > >>>> idea why > >>>>> there's a need for translation and what is being translated? > >>>> > >>>> When the High Speed USB HUB was invented, there was a need to support > >>>> FULL and LOW speed USB transactions. Because FULL and LOW speed > >>>> transactions are slow and take up much bandwidth, a transactions > >>>> translator was invented which translates between High Speed USB and > >>>> FULL/LOW speed USB. That means the RPi 3B consists of a single USB > HIGH > >>>> speed port, followed by a USB HUB. These transactions are not visible > in > >>>> usbdump . > >>>> > >>>> >Does this only > >>>>> happen when RPi 3B (acting as host controller) is transmitting data > to > >>>> the > >>>>> Epson printer? Are translation events visible in the usbdump? In this > >>>> case > >>>>> there's a way to possibly track what's going on and how to identify > any > >>>>> info that is being translated? > >>>> > >>>> By turning on the HC debugging, you can possibly track via debug > >>>> messages what is going on. Maybe it is a timing issue, that the SW is > >>>> too slow serving the micro transactions. > >>>> > >>>> Any idea also if translation is being > >>>>> performed in RPi 4B? > >>>> > >>>> The later RPi's do the transaction translator bits in HW or via the > XHCI > >>>> block. > >>>> > >>>> As I have conducted several printing cases with my > >>>>> Epson printer without any issues with either of the 4 ports. > >>>>> > >>>>> Sorry for these questions as I am catching-up to the USB technology > >>>>> internal workings under the hood. > >>>> > >>>> You are welcome! > >>>> > >>> > >>> > >>> Thank you so much Hans for answering my questions, really appreciate > it! > >>> I have a much better understanding now. > >>> > >>> I came from testing with 13.0-RELEASE having the same RPi 3B hardware > and > >>> setup and it's very stable. I haven't encountered any IOERROR and > >>> incomplete printed outputs that were encountered with 14.0-CURRENT > >>> (February 24, 2022). By the way, I found in the repository here > >>> https://download.freebsd.org/snapshots/arm64/aarch64/ISO-IMAGES/14.0/ > >>> that there were two latest snapshots released dated March 3 and March > 10, > >>> respectively. I need to take printing tests first, especially the > latest to > >>> check if it also manifests before I go back to the Feb. 24 snapshot > and do > >>> a thorough test with debugging. I'll provide updates for any > observations. > >>> > >>> Thanks, > >>> Archimedes > >>> > >> > >> > >> Hi Hans, > >> > >> Initial testing conducted with the latest 14.0-CURRENT (March 10, 2022 > >> snapshot) seems to be stable. Another test will be performed tomorrow. > >> > >> Thanks, > >> Archimedes > >> > > > > Hi Hans, > > > > I still encountered the issue this morning with 14.0-CURRENT (March 10, > > 2022 snapshot). I just noticed when I left my RPi 3B idle for a long > period > > of time (2-3 hours and more) and started printing, then the issue > pops-up. > > Another concern I encountered was when I started enabling > > hw.usb.dwc_otg.debug but after 1-2 minutes my USB keyboard and network > > interface (remotely connected over SSH from my laptop) seemed to freeze > and > > I got disconnected. > > > > freebsd@generic:~ % uname -a > > FreeBSD generic 14.0-CURRENT FreeBSD 14.0-CURRENT #0 > > main-n253697-f1d450ddee6: Thu Mar 10 09:32:38 UTC 2022 > > root@releng1.nyi.freebsd.org:/usr/obj/usr/src/arm64.aarch64/sys/GENERIC > > arm64 > > > > root@generic:~ # sysctl -w hw.usb.dwc_otg.debug=1 > > hw.usb.dwc_otg.debug: 0 -> 1 > > > > See attached initial debug info (no printing testing yet). > Hi Hans, > > Hi, > > Nothing obvious there. > > Maybe you need to add a conditional to DPRINTF's in the fast path, to > only print for a certain device, to reduce the debug prints. > > How many USB devices are connected? > Only two devices, one is my USB keyboard and the other one is my Epson printer. > > One experiment you might try is to comment out: > > usbd_transfer_submit(xfer); > > in > > uhub_intr_callback() > > in > > /usr/src/sys/dev/usb/usb_hub.c > > It will save some USB resources, but also makes USB enumeration a bit > slower. This is noted, I'll try. > Maybe the chip is out of USB HW endpoints and is only polling > for RX data ... > This is noted as well, we'll probably see later what's going on. I'll get back to you once I recompile the kernel and perform the testing. Thanks, Archimedes --0000000000001ed12005da2aec65 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div dir=3D"ltr"><br></div><br><div class=3D"gmail_quote">= <div dir=3D"ltr" class=3D"gmail_attr">On Mon, Mar 14, 2022 at 5:31 PM Hans = Petter Selasky <<a href=3D"mailto:hps@selasky.org">hps@selasky.org</a>&g= t; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0p= x 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 3/1= 4/22 10:20, Archimedes Gaviola wrote:<br> > On Sun, Mar 13, 2022 at 11:25 PM Archimedes Gaviola <<br> > <a href=3D"mailto:archimedes.gaviola@gmail.com" target=3D"_blank">arch= imedes.gaviola@gmail.com</a>> wrote:<br> > <br> >><br> >><br> >> On Sun, Mar 13, 2022 at 2:27 PM Archimedes Gaviola <<br> >> <a href=3D"mailto:archimedes.gaviola@gmail.com" target=3D"_blank">= archimedes.gaviola@gmail.com</a>> wrote:<br> >><br> >>><br> >>><br> >>> On Sun, Mar 13, 2022 at 12:38 AM Hans Petter Selasky <<a hr= ef=3D"mailto:hps@selasky.org" target=3D"_blank">hps@selasky.org</a>><br> >>> wrote:<br> >>><br> >>>> On 3/12/22 16:31, Archimedes Gaviola wrote:<br> >>>>>><br> >>>>>> IOERROR usually means an electrical error. The RPI= 3B will use a<br> >>>>>> transaction translator for the FULL speed traffic,= which is driven by<br> >>>>>> software.<br> >>>>><br> >>>><br> >>>> Hi Archimedes,<br> >>>><br> >>>>> Hi Hans,<br> >>>>><br> >>>>> I'm curious about the transaction translator you&#= 39;ve mentioned, any<br> >>>> idea why<br> >>>>> there's a need for translation and what is being t= ranslated?<br> >>>><br> >>>> When the High Speed USB HUB was invented, there was a need= to support<br> >>>> FULL and LOW speed USB transactions. Because FULL and LOW = speed<br> >>>> transactions are slow and take up much bandwidth, a transa= ctions<br> >>>> translator was invented which translates between High Spee= d USB and<br> >>>> FULL/LOW speed USB. That means the RPi 3B consists of a si= ngle USB HIGH<br> >>>> speed port, followed by a USB HUB. These transactions are = not visible in<br> >>>> usbdump .<br> >>>><br> >>>>=C2=A0 =C2=A0>Does this only<br> >>>>> happen when RPi 3B (acting as host controller) is tran= smitting data to<br> >>>> the<br> >>>>> Epson printer? Are translation events visible in the u= sbdump? In this<br> >>>> case<br> >>>>> there's a way to possibly track what's going o= n and how to identify any<br> >>>>> info that is being translated?<br> >>>><br> >>>> By turning on the HC debugging, you can possibly track via= debug<br> >>>> messages what is going on. Maybe it is a timing issue, tha= t the SW is<br> >>>> too slow serving the micro transactions.<br> >>>><br> >>>> Any idea also if translation is being<br> >>>>> performed in RPi 4B?<br> >>>><br> >>>> The later RPi's do the transaction translator bits in = HW or via the XHCI<br> >>>> block.<br> >>>><br> >>>> As I have conducted several printing cases with my<br> >>>>> Epson printer without any issues with either of the 4 = ports.<br> >>>>><br> >>>>> Sorry for these questions as I am catching-up to the U= SB technology<br> >>>>> internal workings under the hood.<br> >>>><br> >>>> You are welcome!<br> >>>><br> >>><br> >>><br> >>> Thank you so much Hans for answering my questions, really appr= eciate it!<br> >>> I have a much better understanding now.<br> >>><br> >>> I came from testing with 13.0-RELEASE having the same RPi 3B h= ardware and<br> >>> setup and it's very stable. I haven't encountered any = IOERROR and<br> >>> incomplete printed outputs that were encountered with 14.0-CUR= RENT<br> >>> (February 24, 2022). By the way, I found in the repository her= e<br> >>> <a href=3D"https://download.freebsd.org/snapshots/arm64/aarch6= 4/ISO-IMAGES/14.0/" rel=3D"noreferrer" target=3D"_blank">https://download.f= reebsd.org/snapshots/arm64/aarch64/ISO-IMAGES/14.0/</a><br> >>> that there were two latest snapshots released dated March 3 an= d March 10,<br> >>> respectively. I need to take printing tests first, especially = the latest to<br> >>> check if it also manifests before I go back to the Feb. 24 sna= pshot and do<br> >>> a thorough test with debugging. I'll provide updates for a= ny observations.<br> >>><br> >>> Thanks,<br> >>> Archimedes<br> >>><br> >><br> >><br> >> Hi Hans,<br> >><br> >> Initial testing conducted with the latest 14.0-CURRENT (March 10, = 2022<br> >> snapshot) seems to be stable. Another test will be performed tomor= row.<br> >><br> >> Thanks,<br> >> Archimedes<br> >><br> > <br> > Hi Hans,<br> > <br> > I still encountered the issue this morning with 14.0-CURRENT (March 10= ,<br> > 2022 snapshot). I just noticed when I left my RPi 3B idle for a long p= eriod<br> > of time (2-3 hours and more) and started printing, then the issue pops= -up.<br> > Another concern I encountered was when I started enabling<br> > hw.usb.dwc_otg.debug but after 1-2 minutes my USB keyboard and network= <br> > interface (remotely connected over SSH from my laptop) seemed to freez= e and<br> > I got disconnected.<br> > <br> > freebsd@generic:~ % uname -a<br> > FreeBSD generic 14.0-CURRENT FreeBSD 14.0-CURRENT #0<br> > main-n253697-f1d450ddee6: Thu Mar 10 09:32:38 UTC 2022<br> > root@releng1.nyi.freebsd.org:/usr/obj/usr/src/arm64.aarch64/sys/GENERI= C<br> > arm64<br> > <br> > root@generic:~ # sysctl -w hw.usb.dwc_otg.debug=3D1<br> > hw.usb.dwc_otg.debug: 0 -> 1<br> > <br> > See attached initial debug info (no printing testing yet).<br></blockq= uote><div><br></div><div><br></div><div>Hi Hans,</div><div>=C2=A0<br></div>= <blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-= left:1px solid rgb(204,204,204);padding-left:1ex"> <br> Hi,<br> <br> Nothing obvious there.<br> <br> Maybe you need to add a conditional to DPRINTF's in the fast path, to <= br> only print for a certain device, to reduce the debug prints.<br> <br> How many USB devices are connected?<br></blockquote><div><br></div><div>Onl= y two devices, one is my USB keyboard and the other one is my Epson printer= .</div><div>=C2=A0<br></div><blockquote class=3D"gmail_quote" style=3D"marg= in:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1e= x"> <br> One experiment you might try is to comment out:<br> <br> usbd_transfer_submit(xfer);<br> <br> in<br> <br> uhub_intr_callback()<br> <br> in<br> <br> /usr/src/sys/dev/usb/usb_hub.c<br> <br> It will save some USB resources, but also makes USB enumeration a bit <br> slower. </blockquote><div><br></div><div>This is noted, I'll try.<br></= div><div>=C2=A0<br></div><blockquote class=3D"gmail_quote" style=3D"margin:= 0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">= Maybe the chip is out of USB HW endpoints and is only polling <br> for RX data ...<br></blockquote><div><br></div><div>This is noted as well, = we'll probably see later what's going on. I'll get back to you = once I recompile the kernel and perform the testing.</div><div><br></div><d= iv>Thanks,</div><div>Archimedes<br></div><br></div></div> --0000000000001ed12005da2aec65--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJFbk7EutGbB-LoHxN_mUZbSb70C8yjxfZBADvejuCLwTcD5FA>