2025-09-25 11:58 AM
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?
```
```
I can't find any close problems on this or other forums.
Solved! Go to Solution.
2025-09-25 2:59 PM - edited 2025-09-25 3:00 PM
Alright!
The issue was solved, along with the above work, by setting:
2025-09-25 12:29 PM
Why does Uboot have menuconfig disabed in the "dist-package" yocto build????
2025-09-25 1:01 PM
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
2025-09-25 1:13 PM
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?
```
```
2025-09-25 1:19 PM - edited 2025-09-25 1:36 PM
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...
I'll try the commandline
2025-09-25 1:36 PM - edited 2025-09-25 1:36 PM
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
```
2025-09-25 2:59 PM - edited 2025-09-25 3:00 PM
Alright!
The issue was solved, along with the above work, by setting: