How to change USB-TYPE-A prot to a peripheral or otg port?

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

How to change USB-TYPE-A prot to a peripheral or otg port?

2,034 Views
shikai
Contributor I

Hi,

   As we know, the iMX6UL EVK has two otg port, and one designed as USB-TYPE-A HOST port, one designed Micro-USB-TYPEB peripheral port.

   Now i need two peripheral port in this board, could i change the  USB-TYPE-A HOST port to a peripheral or otg port?
    I try change the dts file to fix usbotg2 from host to otg, but it's not work.
    I ever used a other board with a dynamic config USB-TYPE-A port, it can work as Host or Peripheral by write a sys config in runtime.
    Could the iMX6UL Board implement this function?

Labels (1)
0 Kudos
5 Replies

1,685 Views
igorpadykov
NXP Employee
NXP Employee

Hi shi

please try to change usb mode using sect.39.2.6 Changing the Controller

Operation Mode attached Linux Manual.

Best regards

igor

-----------------------------------------------------------------------------------------------------------------------

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

-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,685 Views
shikai
Contributor I

Hi igorpadykov,

I have try to change usb mode according to doc. And change "dr_mode" of usbotg1 and usbotg2 both to "otg".
For test, I load  gadget driver on  two otg ports, usbotg1 can work normal but usbotg2 can't work.

Then I config kernel debug_fs for otg debug, find some difference between usbotg1 and usbotg2 as follow(Not connect otg port with PC when output log).

usbotg1 debug log:

cat /sys/kernel/debug/ci_hdrc.0/otg

OTG state: b_idle

a_bus_drop: 0

a_bus_req: 0

a_srp_det: 0

a_vbus_vld: 0

b_conn: 0

adp_change: 0

power_up: 0

a_bus_resume: 0

a_bus_suspend: 1

a_conn: 0

b_bus_req: 0

b_bus_suspend: 0

b_se0_srp: 1

b_ssend_srp: 1

b_sess_vld: 0

b_srp_done: 1

drv_vbus: 0

loc_conn: 0

loc_sof: 0

adp_prb: 0

id: 1

protocol: 0

usbotg2 debug log:

cat /sys/kernel/debug/ci_hdrc.1/otg

OTG state: b_peripheral

a_bus_drop: 0

a_bus_req: 0

a_srp_det: 0

a_vbus_vld: 0

b_conn: 0

adp_change: 0

power_up: 0

a_bus_resume: 0

a_bus_suspend: 1

a_conn: 0

b_bus_req: 0

b_bus_suspend: 0

b_se0_srp: 0

b_ssend_srp: 0

b_sess_vld: 2048

b_srp_done: 0

drv_vbus: 0

loc_conn: 1

loc_sof: 0

adp_prb: 0

id: 1

protocol: 2

From the log, ​I guess the hardware status of usbotg2 is not right.

Then i check VBUS of usbotg2, and find it still located at high level(about 5V).This is not normal.

I doubt whether need to modify the hardware design of USB  to meet my requirement(two otg port can work on device mode).
Could you give me some suggestion?

0 Kudos

1,685 Views
igorpadykov
NXP Employee
NXP Employee

Hi shi

for turning off VBUS of usbotg2 it is necessary to add modifications

in code for USB_OTG2_PWR, please check U1101 SPF-28616

on i.MX6UL EVK schematic

Schematics (1)

MCIMX6UL-EVK_DESIGNFILES

Design files, including hardware schematics, Gerbers, and OrCAD files. (REV 0)

http://www.nxp.com/products/sensors/gyroscopes/i.mx6ultralite-evaluation-kit:MCIMX6UL-EVK?fpsp=1&tab...

~igor

0 Kudos

1,685 Views
shikai
Contributor I

Hi igorpadykov

Thank you, I have shared the idea with our hardware engineer.

Your comment----"it is necessary to add modifications in code for USB_OTG2_PWR", does it mean that i need to modify the linux source code at driver/usb/chipidea ?

On the other hand, I try to use GPIO control VBUS of USBOTG2 according to sect.39.2.10.2 VBUS Control attached Linux Manual.

Fisrtly, I fix dts and slect GPIO1_IO02 to control VBUS of USBOTG2.

Then I  boot the board with new dtb, but i get such error when try to change GPIO output value by GPIO SYSFS.

GPIO1_IO02,  the GPIO address should be   32 * (1 - 1) + 2 = 2

echo 2 > /sys/class/gpio/export

write error: Device or resource busy

I try the command "echo 0 > /sys/class/gpio/export" and it's OK.

Why the GPIO1_IO02 can't export?  And is using GPIO to control VBUS  effective?

0 Kudos

1,685 Views
igorpadykov
NXP Employee
NXP Employee

seems GPIO1_IO02 is already used as part of pinctrl_tsc: tscgrp :

linux-2.6-imx.git - Freescale i.MX Linux Tree

0 Kudos