cancel
Showing results for 
Search instead for 
Did you mean: 

STM32MP1 Configure USB OTG interface as a gadget device in Linux kernel

debugging
Senior III

0690X00000Bw0IKQAZ.pngA particular STM32MP1 based board uses the USB OTG interface configured to the cortex A7. Is there any guidance how to configure the kernel so that it will use the USB device port with a gadget driver, so that the host sees it as keyboard, serial port, mouse, audio interface ? For example, as pictured, a snippet of usb otg in the .dts ( high speed). It uses dwc2 as driver for OTG function, How to assign the device descriptor to the otg/usb interface ? Full speed would be fine as well. In the kernel sources there is "legacy" and "function" code.

1 ACCEPTED SOLUTION

Accepted Solutions
PatrickF
ST Employee

This is currently the case on STM32MP157C-DK2 board with latest starter package, you could put a keyboard or a mouse on the Type-C port which is connected to USB OTG in high-speed.

e.g. console log on mouse plug

[ ...] usb 1-1: new low-speed USB device number 4 using dwc2
[ ...] input: HP HP USB 1000dpi Laser Mouse as /devices/platform/soc/49000000.usb-otg/usb1/1-1/1-1:1.0/0003:03F0:1198.0003/input/input4
[ ...] hid-generic 0003:03F0:1198.0003: input: USB HID v2.00 Mouse [HP HP USB 1000dpi Laser Mouse] on usb-49000000.usb-otg-1/input0
[ ...] hid-generic 0003:03F0:1198.0004: device has no listeners, quitting

please have a look to https://wiki.st.com/stm32mpu/wiki/OTG_device_tree_configuration for DT configuration.

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.

View solution in original post

2 REPLIES 2
PatrickF
ST Employee

This is currently the case on STM32MP157C-DK2 board with latest starter package, you could put a keyboard or a mouse on the Type-C port which is connected to USB OTG in high-speed.

e.g. console log on mouse plug

[ ...] usb 1-1: new low-speed USB device number 4 using dwc2
[ ...] input: HP HP USB 1000dpi Laser Mouse as /devices/platform/soc/49000000.usb-otg/usb1/1-1/1-1:1.0/0003:03F0:1198.0003/input/input4
[ ...] hid-generic 0003:03F0:1198.0003: input: USB HID v2.00 Mouse [HP HP USB 1000dpi Laser Mouse] on usb-49000000.usb-otg-1/input0
[ ...] hid-generic 0003:03F0:1198.0004: device has no listeners, quitting

please have a look to https://wiki.st.com/stm32mpu/wiki/OTG_device_tree_configuration for DT configuration.

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.

To close this:  fixed this by adding support in the custom  kernel configuration.