STM32F723E-Disco: how to use USB in high-speed mode


Dirk-Jan C. Binnema
 

Dear List,

I'm trying to use the USB-OTG HS port on an STM32F723E Discovery Board
to mount a ramdisk on a Linux 5.11 host; this works fine in FS-mode;
however, I want to use high-speed mode instead.

In an overlay file I have:
------------------------------------------------------------
&usbotg_fs {
status = "disabled";
};

&usbotg_hs {
pinctrl-0 = <&usb_otg_hs_dm_pb14 &usb_otg_hs_dp_pb15>;
maximum-speed = "high-speed";
status = "okay";
};
------------------------------------------------------------
(based on the data sheet / some older posts)

This *almost* works, but Linux fails to mount (dmesg output):
------------------------------------------------------------
usb 1-3: new high-speed USB device number 6 using xhci_hcd
usb 1-3: device descriptor read/64, error -71
usb 1-3: config 1 interface 0 altsetting 0 bulk endpoint 0x81 has invalid maxpacket 64
usb 1-3: config 1 interface 0 altsetting 0 bulk endpoint 0x1 has invalid maxpacket 64
usb 1-3: New USB device found, idVendor=2fe3, idProduct=0100, bcdDevice= 2.06
usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-3: Product: USB-DEV
usb 1-3: Manufacturer: ZEPHYR
usb 1-3: SerialNumber: 363238313136510A
usb-storage 1-4.2:1.1: USB Mass Storage device detected
scsi host10: usb-storage 1-4.2:1.1
usb-storage 1-3:1.0: USB Mass Storage device detected
scsi host11: usb-storage 1-3:1.0
usbcore: registered new interface driver usb-storage
usbcore: registered new interface driver uas
scsi 11:0:0:0: Direct-Access ZEPHYR ZEPHYR USB DISK 0.01 PQ: 0 ANSI: 0 CCS
sd 11:0:0:0: Attached scsi generic sg2 type 0
sd 11:0:0:0: [sdc] 192 512-byte logical blocks: (98.3 kB/96.0 KiB)
sd 11:0:0:0: [sdc] Write Protect is off
sd 11:0:0:0: [sdc] Mode Sense: 03 00 00 00
sd 11:0:0:0: [sdc] No Caching mode page found
sd 11:0:0:0: [sdc] Assuming drive cache: write through
usb 1-3: reset high-speed USB device number 6 using xhci_hcd
usb 1-3: reset high-speed USB device number 6 using xhci_hcd
usb 1-3: reset high-speed USB device number 6 using xhci_hcd
usb 1-3: reset high-speed USB device number 6 using xhci_hcd
usb 1-3: reset high-speed USB device number 6 using xhci_hcd
usb 1-3: reset high-speed USB device number 6 using xhci_hcd
sd 11:0:0:0: [sdc] tag#0 FAILED Result: hostbyte=DID_ERROR driverbyte=DRIVER_OK cmd_age=2s
sd 11:0:0:0: [sdc] tag#0 CDB: Read(10) 28 00 00 00 00 00 00 00 08 00
blk_update_request: I/O error, dev sdc, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 0
Buffer I/O error on dev sdc, logical block 0, async page read
sb 1-3: reset high-speed USB device number 6 using xhci_hcd
(repeating)
------------------------------------------------------------


Just for testing, When I set "maximum-speed" to "full-speed" in the
overlay (i.e, using the HS in FS mode), I get:


------------------------------------------------------------
usb 1-4: new full-speed USB device number 88 using xhci_hcd
usb 1-4: New USB device found, idVendor=2fe3, idProduct=0100, bcdDevice= 2.06
usb 1-4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-4: Product: USB-DEV
usb 1-4: Manufacturer: ZEPHYR
usb 1-4: SerialNumber: 363238313136510A
usb-storage 1-4:1.0: USB Mass Storage device detected
scsi host11: usb-storage 1-4:1.0
scsi 11:0:0:0: Direct-Access ZEPHYR ZEPHYR USB DISK 0.01 PQ: 0 ANSI: 0 CCS
sd 11:0:0:0: Attached scsi generic sg3 type 0
sd 11:0:0:0: [sdd] 192 512-byte logical blocks: (98.3 kB/96.0 KiB)
sd 11:0:0:0: [sdd] Write Protect is off
sd 11:0:0:0: [sdd] Mode Sense: 03 00 00 00
sd 11:0:0:0: [sdd] No Caching mode page found
sd 11:0:0:0: [sdd] Assuming drive cache: write through
sdd:
sd 11:0:0:0: [sdd] Attached SCSI removable disk
------------------------------------------------------------

that gets me a little further, and I it even shows up in the linux file
browser as a mount-point browser ("98 KB Volume"); however, trying to
mount does not work (times out).

So to summarize, with the same code, using the FS-connection works; the
HS connection does not, even though it seems we're close.

Any idea of what I'm missing, or what I should check? Any insights very
much appreciated!

Kind regards,
Dirk.

--
Dirk-Jan C. Binnema Helsinki, Finland
e:djcb@djcbsoftware.nl w:www.djcbsoftware.nl
gpg: 6987 9CED 1745 9375 0F14 DA98 11DD FEA9 DCC4 A036


Dirk-Jan C. Binnema
 

On Friday May 21 2021, Dirk-Jan C. Binnema via lists.zephyrproject.org wrote:

Dear List,

I'm trying to use the USB-OTG HS port on an STM32F723E Discovery Board
to mount a ramdisk on a Linux 5.11 host; this works fine in FS-mode;
however, I want to use high-speed mode instead.

In an overlay file I have:
------------------------------------------------------------
&usbotg_fs {
status = "disabled";
};

&usbotg_hs {
pinctrl-0 = <&usb_otg_hs_dm_pb14 &usb_otg_hs_dp_pb15>;
maximum-speed = "high-speed";
status = "okay";
};
------------------------------------------------------------
(based on the data sheet / some older posts)

This *almost* works, but Linux fails to mount (dmesg output):
[...]

To reply to myself: it actually _does_ work when I tried some other
machine running Debian Testing / kernel 4.9 (using ehci_hdc rather than
xhci_hcd); even there it can take up to a minute or so for the mounting
to succeed.

Since this is only for testing, it's good enough for me, but still would
be nice to have the mounting to work smoothly will all kernels.

Also note the

,----
| > usb 1-3: config 1 interface 0 altsetting 0 bulk endpoint 0x81 has
| > invalid maxpacket 64
`----

I think for mass-storage maxpacket the value should be 512 instead
(hence the warning)... is this a bug?

Kind regards,
Dirk.

--
Dirk-Jan C. Binnema Helsinki, Finland
e:djcb@djcbsoftware.nl w:www.djcbsoftware.nl
gpg: 6987 9CED 1745 9375 0F14 DA98 11DD FEA9 DCC4 A036