cancel
Showing results for 
Search instead for 
Did you mean: 

UBOOT / DFU - "no usb devices available"

0xedbea4
Associate III

Running through the instructions to flash an eMMC chip via STM32CubeProgrammer.

Board is custom based on STM32MP157F-DK2, boots great off a SD card (SDMMC1).

I can communicate and load uboot via both USB and UART...

uboot can get basic data off the eMMC with `mmc dev1; mmc info`   

but uboot fails to enter DFU mode to continue the process, and running dfu complains about the lack of a USB device. I've tried all sorts of RAM, etc dfu examples.

From the uboot shell:

```

STM32MP> dfu 0
No USB device found
usb_gadget_initialize failed

STM32MP> print dfu_alt_info
dfu_alt_info=ram 0=uImage ram 0xc2000000 0x2000000;devicetree.dtb ram 0xc4000000 0x100000;uramdisk.im
age.gz ram 0xc4400000 0x10000000&mmc 1=mmc1_boot1 raw 0x0 0x400000 mmcpart 1;mmc1_boot2 raw 0x0 0x400000 mmcpart 2&virt 0=OTP&virt 1=PMIC

 

STM32MP> usb dev

no usb devices available

STM32MP> usb reset
resetting USB...
Bus usb@5800c000: USB OHCI 1.0
Bus usb@5800d000: USB EHCI 1.00
scanning bus usb@5800d000 for devices... 1 USB Device(s) found
scanning usb for storage devices... 0 Storage Device(s) found
STM32MP> usb info
1: Hub, USB Revision 2.0
- u-boot EHCI Host Controller
- Class: Hub
- PacketSize: 64 Configurations: 1
- Vendor: 0x0000 Product 0x0000 Version 1.0
Configuration: 1
- Interfaces: 1 Self Powered 0mA
Interface: 0
- Alternate Setting 0, Endpoints: 1
- Class Hub
- Endpoint 1 In Interrupt MaxPacket 8 Interval 255ms

```

Maybe I'm misconfiguring something in the DTS?  The ports work in the kernel (touchscreen and can mount external storage) with the exact same nodes.  So the hardware is fine.

Here's my relevant device tree, (we removed the hub from the DK2, and there's just two 4 pin USB (one A and one internal)

Does DFU need USBOTG?  Why would it switch roles?

```

&usbh_ehci {
status = "okay";

/* USER CODE BEGIN usbh_ehci */
phys = <&usbphyc_port0 &usbphyc_port1>;
#address-cells = <1>;
#size-cells = <0>;

// hub@1{
// compatible = "usb424,2514";
// reg = <1>;
// vdd-supply = <&v3v3>;
// };
/* USER CODE END usbh_ehci */
};

&usbh_ohci {
status = "okay";

/* USER CODE BEGIN usbh_ohci */
phys = <&usbphyc_port0 &usbphyc_port1>;
#address-cells = <1>;
#size-cells = <0>;
/* USER CODE END usbh_ohci */
};

// &usbotg_hs {
// status = "okay";

// /* USER CODE BEGIN usbotg_hs */
// phys = <&usbphyc_port1 0>;
// phy-names = "usb2-phy";
// usb-role-switch;

// // port{

// // usbotg_hs_ep:endpoint{
// // remote-endpoint = <&con_usbotg_hs_ep>;
// // };
// // };
// /* USER CODE END usbotg_hs */
// };

&usbphyc {
status = "okay";

/* USER CODE BEGIN usbphyc */
/* USER CODE END usbphyc */
};

&usbphyc_port0 {
status = "okay";

/* USER CODE BEGIN usbphyc_port0 */
phy-supply = <&vbus_sw>;
st,tune-hs-dc-level = <2>;
st,enable-fs-rftime-tuning;
st,enable-hs-rftime-reduction;
st,trim-hs-current = <15>;
st,trim-hs-impedance = <1>;
st,tune-squelch-level = <3>;
st,tune-hs-rx-offset = <2>;
st,no-lsfs-sc;
/* USER CODE END usbphyc_port0 */
};

&usbphyc_port1 {
status = "okay";

/* USER CODE BEGIN usbphyc_port1 */
phy-supply = <&vdd_usb>;
st,tune-hs-dc-level = <2>;
st,enable-fs-rftime-tuning;
st,enable-hs-rftime-reduction;
st,trim-hs-current = <15>;
st,trim-hs-impedance = <1>;
st,tune-squelch-level = <3>;
st,tune-hs-rx-offset = <2>;
st,no-lsfs-sc;
/* USER CODE END usbphyc_port1 */
};

```

I can't find any close problems on this or other forums.

1 ACCEPTED SOLUTION

Accepted Solutions
0xedbea4
Associate III

Alright!

The issue was solved, along with the above work, by setting:

 

compatible = "usb-c-connector";
 
on the OTG port and/ or forcing the OTG role / negotiation
 
//usb-role-switch;
u-boot,force-b-session-valid;
dr_mode = "peripheral";
 
in the u-boot dts
 
Maybe both, but likely just the later...  so the USB ports weren't fighting over roles....

View solution in original post

6 REPLIES 6
0xedbea4
Associate III

Why does Uboot have menuconfig disabed in the "dist-package" yocto build????

 

0xedbea4
Associate III

Hmm...  it's looking like "usb_gadget_init" might be implying that OTG is required for DFU...  building an image with it declared in the devicetrees

 

0xedbea4
Associate III

Updating the relevant DTS did get us one error message further:
```
Hit any key to stop autoboot: 0
Boot over usb0!
DFU alt info setting: done
dwc2-udc-otg usb-otg@49000000: No UCLASS_USB_TYPEC for remote-endpoint

```

Do I need to declare this 4 pin JST connector as typeC really?

```

&usbh_ehci {
status = "okay";

/* USER CODE BEGIN usbh_ehci */
phys = <&usbphyc_port0 &usbphyc_port1>;
#address-cells = <1>;
#size-cells = <0>;

// hub@1{
// compatible = "usb424,2514";
// reg = <1>;
// vdd-supply = <&v3v3>;
// };
/* USER CODE END usbh_ehci */
};

&usbh_ohci {
status = "okay";

/* USER CODE BEGIN usbh_ohci */
phys = <&usbphyc_port0 &usbphyc_port1>;
#address-cells = <1>;
#size-cells = <0>;
/* USER CODE END usbh_ohci */
};

&usbotg_hs {
status = "okay";

/* USER CODE BEGIN usbotg_hs */
phys = <&usbphyc_port1 0>;
phy-names = "usb2-phy";
usb-role-switch;

port{
usbotg_hs_ep:endpoint{
remote-endpoint = <&con_usbotg_hs_ep>;
};
};
/* USER CODE END usbotg_hs */
};

&usbphyc {
status = "okay";

/* USER CODE BEGIN usbphyc */
/* USER CODE END usbphyc */
};

&usbphyc_port0 {
status = "okay";

/* USER CODE BEGIN usbphyc_port0 */
phy-supply = <&vbus_sw>;
st,tune-hs-dc-level = <2>;
st,enable-fs-rftime-tuning;
st,enable-hs-rftime-reduction;
st,trim-hs-current = <15>;
st,trim-hs-impedance = <1>;
st,tune-squelch-level = <3>;
st,tune-hs-rx-offset = <2>;
st,no-lsfs-sc;
connector {
compatible = "usb-a-connector";
vbus-supply = <&vbus_sw>;
self-powered;
};
/* USER CODE END usbphyc_port0 */
};

&usbphyc_port1 {
status = "okay";

/* USER CODE BEGIN usbphyc_port1 */
phy-supply = <&vdd_usb>;
st,tune-hs-dc-level = <2>;
st,enable-fs-rftime-tuning;
st,enable-hs-rftime-reduction;
st,trim-hs-current = <15>;
st,trim-hs-impedance = <1>;
st,tune-squelch-level = <3>;
st,tune-hs-rx-offset = <2>;
st,no-lsfs-sc;
connector {
compatible = "usb-a-connector";
vbus-supply = <&vdd_usb>;
self-powered;
port {
con_usbotg_hs_ep: endpoint {
remote-endpoint = <&usbotg_hs_ep>;
};
};
};
/* USER CODE END usbphyc_port1 */
};

```

0xedbea4
Associate III

No, the TYPEC error doesn't look to be terminal...  I can CTRL-C out of DFU mode on the device... 

https://community.st.com/t5/stm32-mpus-embedded-software-and/dwc2-udc-otg-usb-otg-49000000-no-uclass-usb-typec-for-remote/td-p/728810

STM32CubeProgrammer does completely crash while trying to connect however...

0xedbea4_0-1758831542307.png

I'll try the commandline

 

0xedbea4
Associate III

Basically the same behaviour with STM32CubeProgrammer_CLI, but it times out gracefully.

Quirky that adding the OTG node doesn't reflect much in the uboot usb commands, but DFU does start....

```

STM32MP> usb info
USB is stopped. Please issue 'usb start' first.
STM32MP> usb start
starting USB...
Bus usb@5800c000: USB OHCI 1.0
Bus usb@5800d000: USB EHCI 1.00
scanning bus usb@5800d000 for devices... 1 USB Device(s) found
scanning usb for storage devices... 0 Storage Device(s) found
STM32MP> usb info
1: Hub, USB Revision 2.0
- u-boot EHCI Host Controller
- Class: Hub
- PacketSize: 64 Configurations: 1
- Vendor: 0x0000 Product 0x0000 Version 1.0
Configuration: 1
- Interfaces: 1 Self Powered 0mA
Interface: 0
- Alternate Setting 0, Endpoints: 1
- Class Hub
- Endpoint 1 In Interrupt MaxPacket 8 Interval 255ms

STM32MP> usb dev

no usb devices available
STM32MP> dfu 0 list
DFU alt settings list:
dev: RAM alt: 0 name: uImage layout: RAM_ADDR
dev: RAM alt: 1 name: devicetree.dtb layout: RAM_ADDR
dev: RAM alt: 2 name: uramdisk.image.gz layout: RAM_ADDR
dev: eMMC alt: 3 name: mmc1_boot1 layout: RAW_ADDR
dev: eMMC alt: 4 name: mmc1_boot2 layout: RAW_ADDR
dev: VIRT alt: 5 name: OTP layout: RAW_ADDR
dev: VIRT alt: 6 name: PMIC layout: RAW_ADDR

```

 

And there's definitely a lower level error after uboot enters DFU

From hostmachine:

```

[19987.379768] usb 1-7: new high-speed USB device number 49 using xhci_hcd
[19992.795668] usb 1-7: device descriptor read/64, error -110
```

5 volts on the USB is not connected between my host machine and the target?

I would suspect hardware if I couldn't successfully load via the ROM DFU bootloaders...

```

[19910.004156] usb 1-7: new high-speed USB device number 47 using xhci_hcd
[19910.131725] usb 1-7: New USB device found, idVendor=0483, idProduct=df11, bcdDevice= 2.00
[19910.131732] usb 1-7: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[19910.131734] usb 1-7: Product: DFU in HS Mode @Device ID /0x500, @Revision ID /0x0000
[19910.131736] usb 1-7: Manufacturer: STMicroelectronics
[19910.131737] usb 1-7: SerialNumber: 0023003E3133511035323633

```

0xedbea4
Associate III

Alright!

The issue was solved, along with the above work, by setting:

 

compatible = "usb-c-connector";
 
on the OTG port and/ or forcing the OTG role / negotiation
 
//usb-role-switch;
u-boot,force-b-session-valid;
dr_mode = "peripheral";
 
in the u-boot dts
 
Maybe both, but likely just the later...  so the USB ports weren't fighting over roles....