imx8mm as usb gadget not detected on host PC

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

imx8mm as usb gadget not detected on host PC

Jump to solution
1,926 Views
borysszefler
Contributor II

I have a imx8mm with type-C connector and Power Delivery chip. When I set up usbotg1 as a host, it works fine. I can connect mass storage device and it's working. Dts settings:

&usbotg1 {
	dr_mode = "host";
        hnp-disable;
	srp-disable;
	adp-disable;
	disable-over-current;
	status = "okay";
};
	

When I try to set it as a peripheral in dts, load some gadget module and then connect it to host PC there is complete silence on host PC. No usb detection, no error messages, nothing. Dts settings:

&usbotg1 {
	dr_mode = "peripheral";
        hnp-disable;
	srp-disable;
	adp-disable;
	disable-over-current;
	status = "okay";
};

It looks like gadget is configured.

# cat /sys/kernel/debug/usb/ci_hdrc.0/role
gadget

When I load g_ether I can see:

cat /sys/kernel/debug/usb/ci_hdrc.0/device
speed             = 0
max_speed         = 3
is_otg            = 0
is_a_peripheral   = 0
b_hnp_enable      = 0
a_hnp_support     = 0
a_alt_hnp_support = 0
name              = 32e40000.usb
gadget function   = g_ether
gadget max speed  = 5

and usb0 interface is present, but still nothing on host PC.

Is there something more that must be configured to let imx8mm work as usb peripheral?

Labels (1)
0 Kudos
1 Solution
1,900 Views
borysszefler
Contributor II

It turned out that USB1_VBUS line was not correctly asserted and it's watched by chipidea driver I think, so gadget was probably in some sleep mode or something.

It's working now.

View solution in original post

0 Kudos
6 Replies
1,609 Views
StanleyShen
Contributor IV

@borysszefler 

Hi I seem to have encountered the same trouble, even setting it to OTG does not work properly.

Can you tell me what you have modified? thank you

0 Kudos
1,574 Views
borysszefler
Contributor II

I had to set USB1_VBUS line to high when host device is connected to your gadget device. I did it using gpio from power delivery chip.

Solution from this thread helped me also.

https://community.nxp.com/t5/i-MX-Processors/i-MX8-USB-VBUS-voltage/m-p/1266085

0 Kudos
1,532 Views
StanleyShen
Contributor IV

Thank you very much for your reply.

I measured the voltage of my  S32G-VNP-RDB2 board USB1_VBUS, Looks like it's okay(5v)

And I found some information for Gadget, it seems that before use the OTG-Device function, some configuration (just like PID VID) must be set,  so I consulted the manual and made the settings, and then it can run normally.

 

0 Kudos
1,901 Views
borysszefler
Contributor II

It turned out that USB1_VBUS line was not correctly asserted and it's watched by chipidea driver I think, so gadget was probably in some sleep mode or something.

It's working now.

0 Kudos
1,909 Views
Rita_Wang
NXP TechSupport
NXP TechSupport

The usb1 support dual roles.

0 Kudos
1,909 Views
Rita_Wang
NXP TechSupport
NXP TechSupport

How about set it as otg, you can try to see if it can work.

0 Kudos