Use USB host as Dual role

cancel
Showing results for 
Search instead for 
Did you mean: 

Use USB host as Dual role

281 Views
Contributor III

Hi,

I am working  on iMX6ul. I am using one USB port as host means i can connect pendrive, USB mouse,keyboard etc.

Now I want to use that USB port as a dual role.

1. USB host - pendriver, mouse etc. that is now working.

2. USB client - connect to PC and send data to serially . that i want to develop.

How can i use my USB port as dual role?

0 Kudos
3 Replies

12 Views
NXP TechSupport
NXP TechSupport

Hi Jignesh

please check 044-DR-Mode-Test.txt in imx-test package

www.nxp.com/lgfiles/NMG/MAD/YOCTO/imx-test-5.7.tar.gz

and documentation in

linux/Documentation/usb/chipidea.txt

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

12 Views
Contributor III

Thanks igor,

As per document to do test operation, I need to change value of device of b_bus_req & a_bus_drop. 

But There is no even input in my path "/sys/bus/platform/devices/ci_hdrc.0/".

/sys/bus/platform/devices/ci_hdrc.0/ path contains following sub directory & devices,

driver/ modalias subsystem/ driver_override pools udc/ gadget/ power/ uevent

I have enable the option "CONFIG_USB_OTG_FSM" in kernel configuration. 

Is there any other wrong configuration in my USB ?

please help me to sort out this problem.

you input is highly appreciable.

0 Kudos

12 Views
NXP TechSupport
NXP TechSupport

Hi Jignesh

FSL-UT-USB-044-USB-DR-MODE-Test
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

[cols=">s,6a",frame="topbot",options="header"]
|====================================================================
|Name | Description

| Summary |
Test peripheral-only and host-only mode through dt file

| Automated |
No

| Kernel Config Option |

| Software Dependency |
N/A

| Non-default Hardware Configuration |
N/A

| Test Procedure |
Change dts file to support it (eg: arch/arm/boot/dts/imx6qdl-sabreauto.dtsi)

1. Test dr_mode = "host"
1.1 Rebuild dtb
# modprobe -r ci_hdrc_imx; modprobe -r phy_mxs_usb; modprobe phy_mxs_usb && modprobe ci_hdrc_imx
try if peripheral function is ok, the g_serial should not be inserted.

1.2 Hotplug test in low power status without host wakeup support
# echo mem > /sys/power/state
Plugin u-disk into Host/OTG port
Resume system by POWER switch and the u-disk should be found
For ARD, use console wakeup
# echo mem > /sys/power/state
Plugout u-disk from Host/OTG port
Resume system by POWER switch and the u-disk detach disconnet should be noticed
Repeat this step 3 times
1.3 USB mouse remote wakeup test
Connect USB mouse to Host/OTG port
# low_power_usb.sh; echo mem > /sys/power/state
Click USB mouse to wakeup system
Repeat this step to verify system can suspend/resume again
1.4 Connect/disconnect wakeup
# low_power_usb.sh; echo mem > /sys/power/state
Plugin or plug out USB device from Host/OTG,
System should be wakeup
5. Special for OTG port
# echo mem > /sys/power/state
Then only plugin a microAB to female A cable(without device) to OTG port
The system should NOT be wakeup
Resume board by POWER switch and
# echo mem > /sys/power/state
Connect OTG port to PC
The system should NOT be wakeup

2 Test dr_mode = "peripheral"
2.1 boot from rebuilt kernel and dtb and usb mouse at the board
# modprobe -r ci_hdrc_imx; modprobe -r phy_mxs_usb; modprobe phy_mxs_usb && modprobe ci_hdrc_imx
The mouse should not be recognized.

2. Test g_mass_storage module
In board
# dd if=/dev/zero of=/var/storage.img bs=1M count=64
# mkfs.vfat /var/storage.img
# modprobe g_mass_storage file=/var/storage.img removable=1
In Host PC:
# mkdir -p /mnt/flash
# umount /mnt/flash
# mount -t vfat /dev/sdxx /mnt/flash (sdxx is the partition exported by g_file_storage in target board whose size is near 64M)
# bonnie++ -d /mnt/flash -u 0:0 -s 32 -r 16
# dt of=/mnt/flash/test_file bs=4k limit=63m passes=20
Above commands should pass
In board:
# modprobe -r g_mass_storage
# modprobe -r ci_hdrc_imx; modprobe -r phy_mxs_usb
Remove the USB cable from OTG port
3. Repeat steps 1 & 2

| Expected Result |
There should be no error during the test

Best regards
igor

0 Kudos