cancel
Showing results for 
Search instead for 
Did you mean: 

STM32MP157D using otg as a device with micro-b connector ,and computer cannot find it.

qqwe.3
Associate II

I'm trying to set otg on stm32mp157d in device only mode, according to the guidance on OTG device tree configuration - stm32mpu (stmicroelectronics.cn),

&usbotg_hs {

compatible = "st,stm32mp15-hsotg", "snps,dwc2";

phys = <&usbphyc_port1 0>; /* 0: UTMI switch selects the OTG controller */

phy-names = "usb2-phy";

dr_mode = "peripheral"; /* could be "host", see USB generic bindings [6] */

usb-role-switch; /* see USB generic bindings [6] */

role-switch-default-mode = "peripheral"; /* could be "host", see USB generic bindings [6] */

status = "okay"; /* enable OTG */

};

I also enable usbphyc like this:

&usbphyc {

  status = "okay";

};

&usbphyc_port0 {

  phy-supply = <&vdd_usb>;

  st,phy-tuning = <&usb_phy_tuning>;

};

&usbphyc_port1 {

  phy-supply = <&vdd_usb>;

  st,phy-tuning = <&usb_phy_tuning>;

};

However , when I using the Uboot system ,I can use the otg port using the command ums to load it as a usb flash disk and the computer can detected it. But when I using the linux arm system, trying to set the otg port as a usb falsh disk or usb webcam with gadget, the computer cannot find anyway and device manager on computer can't even find any usb device plug in ,I wonder if there is someting important I miss to setup.

As for the hardware , I only connect the otg_dm and otg_dp to the micro-b connecter.

4 REPLIES 4
PatrickF
ST Employee

Hi @Community member​ 

With some previous ecosystem, the Device Tree syntax has some subtle differences between uBoot and Linux.

Please ensure you are using latest ecosystem v4.x, otherwise, DTS definition might be different (refer to https://wiki.st.com/stm32mpu/wiki/Main_Page#STM32_MPU_archived_wikis)

Regards.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

thank you for your answer, but I've check that it is the latest version, also in the old version the device tree is the same ,as for the uboot ,here is the device tree setting about otg in uboot:

&usbotg_hs {

u-boot,force-b-session-valid;

hnp-srp-disable;

/* TEMP: force peripheral for USB OTG */

dr_mode = "peripheral";

};

Is there any other reasons may cause that?

Hi @Community member​ 

From my side, DT for Linux and uBoot seems OK.

Could you share the complete console boot log (from TF-A, uBoot and Linux) ?

Regards.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
  • Thank you for your helping, I'm really appreciate it. Here is the log.
  • Here is some imformation that might involved with the otg port from the log:

[  2.881050] dwc2 49000000.usb-otg: 49000000.usb-otg supply vusb_d not found, using dummy regulator

[  2.888838] dwc2 49000000.usb-otg: 49000000.usb-otg supply vusb_a not found, using dummy regulator

[  2.898772] dwc2 49000000.usb-otg: EPs: 9, dedicated fifos, 952 entries in SPRAM

And after the Linux is ready ,here is what I do:

# modprobe libcomposite

# modprobe g_webcam

[  26.199335] g_webcam gadget: uvc: uvc_function_bind()

[  26.203481] g_webcam gadget: Webcam Video Gadget

[  26.207839] g_webcam gadget: g_webcam ready

[  26.212144] dwc2 49000000.usb-otg: bound driver g_webcam

It seem the mod is install, but when I pulg in the usb port ,the computer cannot find , not even some information about the usb device.

But in uboot when I use command:

ums 0 mmc 1 

the computer can find and read it.