2022-11-15 05:52 AM
hi, i'm trying to make USB_FS work on my custom board.
my desired configuration is peripheral (otg can be ok, i have jumper on id: PA_10)
i already have 2 USB HS so i can use only USB_FS mapped on PA_11 and PA_12 as OTG.
i follow the st wiki at the point 3.3.1 witn dr_mode = "peripheral";
my result is:
i can see 49000000.usb-otg under /sys/class/udc/
i can create one gadget device in /sys/kernel/config/usb_gadget/g1 (i created serial over usb)
as i assign 49000000.usb-otg > /sys/kernel/config/usb_gadget/g1/UDC, usb does not turn on, i always have 0V on PA_11 and PA_12
if i follow the st wiki at the point 3.3.2 witn dr_mode = "peripheral";
all works great and i can create my usb gadget
more info:
my micro is STM32MP157F
i'm using linux 5.10.10
i have NO hardware pull_up or pull_down on any line
i have VDD3V3_USBFS shorted with VDD3V3_USBHS (both connected to 3.3v)
my otg port is B_TYPE and i have one jumper to select OTG mode (i need only peripheral)
can anyone help me?
Solved! Go to Solution.
2023-02-17 03:25 AM
Hello @MBell.5 ,
Thanks for sharing the patches with the community.
As explained previously, these patches are temporary and a final version of them will be included in a next official release.
These patches add the support for the utmi clock and allow to be sure that the utmi-clock is enabled when the OTG FS need it. This is needed on stm32mp15, when using the integrated full-speed PHY.
This prevent to have the timeout :
dwc2 49000000.usb-otg: dwc2_core_reset: HANG! Soft Reset timeout GRSTCTL_CSFTRST
Best Regards,
Kevin
In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'
2022-11-16 01:20 AM
Hi,
Not expert, maybe share USB parts of your Device Tree (OTG and USBH).
Sharing BootLog should be also useful.
Your DT should be a combination of https://wiki.st.com/stm32mpu-ecosystem-v3/wiki/OTG_device_tree_configuration#DT_configuration_example_as_full-speed_OTG-2C_with_micro-B_connector
and
Regards.
2022-11-16 06:04 AM
hi,
here is my usb configuration in my device tree:
&usbotg_hs {
compatible = "st,stm32mp15-fsotg", "snps,dwc2";
pinctrl-names = "default";
pinctrl-0 = <&usbotg_hs_pins_a &usbotg_fs_dp_dm_pins_a>;
status = "okay";
};
&usbh_ehci {
phys = <&usbphyc_port0>, <&usbphyc_port1 1>;
phy-names = "usb", "usb";
status = "okay";
};
&usbh_ohci {
phys = <&usbphyc_port0>, <&usbphyc_port1 1>;
phy-names = "usb", "usb";
status = "okay";
};
just to be sure, here is my final configuration: this is the final .dtb reconverted
usbh-ohci@5800c000 {
compatible = "generic-ohci";
reg = <0x5800c000 0x1000>;
clocks = <0x0c 0x6f>;
resets = <0x0c 0xcd8>;
interrupts = <0x00 0x4a 0x04>;
status = "okay";
phys = <0x43 0x44 0x01>;
phy-names = "usb\0usb";
phandle = <0x45>;
};
usbh-ehci@5800d000 {
compatible = "generic-ehci";
reg = <0x5800d000 0x1000>;
clocks = <0x0c 0x6f>;
resets = <0x0c 0xcd8>;
interrupts-extended = <0x0e 0x2b 0x04>;
companion = <0x45>;
power-domains = <0x0f>;
wakeup-source;
status = "okay";
phys = <0x43 0x44 0x01>;
phy-names = "usb\0usb";
};
usb-otg@49000000 {
reg = <0x49000000 0x10000>;
clocks = <0x0c 0xa6>;
clock-names = "otg";
resets = <0x0c 0x4cc8>;
reset-names = "dwc2";
interrupts = <0x00 0x62 0x04>;
dr_mode = "peripheral";
status = "okay";
compatible = "st,stm32mp15-fsotg\0snps,dwc2";
pinctrl-names = "default";
pinctrl-0 = <0x2d 0x2e>;
};
and on attached file you can find my boot log
do not focus on time 13.2 sec error: i assigned no device into config file
if i assign the port USB_HS as otg it works fine as i have the same error
hope it can be usefull to find the problem !!!
ps. if you need anything else, just ask
Best Regards
2022-12-02 07:40 AM
update:
here is the log if i try to link a device
root@stm32mp1:/sys/kernel/config/usb_gadget/g1# echo 49000000.usb-otg > UDC
[ 89.390859] dwc2 49000000.usb-otg: bound driver configfs-gadget
[ 91.778084] dwc2 49000000.usb-otg: dwc2_core_reset: HANG! Soft Reset timeout GRSTCTL_CSFTRST
increasing the timeout on "<my_kernel_path>/driver/usb/dwc2/core.c" have no effect
2023-02-11 12:59 AM
Have you found the solution to the Soft Reset timeout?
2023-02-13 12:06 AM
hi @ZUl A.1 do you have the same problem?
i'm currently in touch with ST support for that.
PS. i switched to yocto 4 and i don't have Soft reset timeout anymore. the USB just don't work.
we are trying to solve the problem.
if you have the same issue i'll keep you updated as soon we have a solution
Best regards
Mattia
2023-02-17 01:02 AM
@MBell.5 I have the same problem, but it happens only in Kirkstone but not in Dunfell. Everything is the same, and I am trying to use the USB on FS OTG. What is the reply from ST support?
2023-02-17 01:06 AM
they give me a patch to that.
so in dunfell you have No problem on the USB full speed in device mode?
2023-02-17 01:12 AM
Yes, on dunfell it is working without giving this SOFT reset, and it is because dunfell, for some reason, is not resetting the core. I have tested it by reading the register GRSTCL. GRSTCL bit 0 is set by the driver, and then it was supposed to come back to 0 itself, but it did not come back. On dunfell though, it never sets the bit, to begin with. I am tracking how it is restarting the core then.
2023-02-17 01:18 AM
if you want i can give you the patch. they told me is not the official release, but the official probabily will be very close.
you can take it "as is". let me know !!!