imx6ul:how can i use the usb to send and receive data with the pc ?

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

imx6ul:how can i use the usb to send and receive data with the pc ?

Jump to solution
2,378 Views
半醒的狐狸
Contributor I

hi

i want to send and receive data with the pc by the usb.

i config the dts:

&usbotg1 {

  dr_mode = "otg";

  status = "okay";

};

After the boot,i connect the pc with MICRO_USB_TYPEB

nothing happen.

how can i  config the dts and the kernel ,so the pc can identify my board .

thanks!

Labels (2)
0 Kudos
Reply
1 Solution
1,401 Views
igorpadykov
NXP Employee
NXP Employee

Hi Li

one can set i.MX6UL as usb gadget, please refer to sect.39.2.6 Changing the Controller

Operation Mode attached Linux Manual and use unit tests (package imx-test-5.4.tar.gz)

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

check folder ../mxc_usb_test and description in /doc, for example for

mass storage.

Best regards

igor

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

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

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

View solution in original post

0 Kudos
Reply
4 Replies
1,402 Views
igorpadykov
NXP Employee
NXP Employee

Hi Li

one can set i.MX6UL as usb gadget, please refer to sect.39.2.6 Changing the Controller

Operation Mode attached Linux Manual and use unit tests (package imx-test-5.4.tar.gz)

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

check folder ../mxc_usb_test and description in /doc, for example for

mass storage.

Best regards

igor

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

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

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

0 Kudos
Reply
1,401 Views
半醒的狐狸
Contributor I

hi igorpadykov

    i'm very sorry to trouble you。

    i found the  reason of the problem .

    same days ago ,i altered the dts  in  &iomuxc,i delete same Pin definition....

    today, i use the default dts,and i can use the usb OTG..

    thanks for all you help!

Best regards

li

0 Kudos
Reply
1,401 Views
半醒的狐狸
Contributor I

hi igorpadykov

    i alter the dts as:

&usbotg1 {

  dr_mode = "peripheral";

  status = "okay";

};

and do it :

FSL-UT-USB-030-Connected-Test

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

|====================================================================

|Name | Description

| Summary |

USB Connected Test During Booting Up

| Automated |

No

| Kernel Config Option |

| Software Dependency |

N/A

| Non-default Hardware Configuration |

N/A

| Test Procedure |

NOTICE: please check clkcount often using dump-clocks.sh

1.1: With USB Disk connected at OTG Port

/unit_tests/dump-clocks.sh | grep usb

modprobe g_mass_storage file=/dev/mmcblk0p1 removable=1

modprobe -r g_mass_storage

/unit_tests/dump-clocks.sh | grep usb

1.2: With USB Disk connected at Host 1 Port

/unit_tests/dump-clocks.sh | grep usb

1.3: With USB Cable connected with PC, load gadget module

/unit_tests/dump-clocks.sh | grep usb

modprobe g_mass_storage file=/dev/mmcblk0p1 removable=1

/unit_tests/dump-clocks.sh | grep usb

disconnet PC

/unit_tests/dump-clocks.sh | grep usb

1.4: With USB Cable connected with USB Charger, load gadget module

modprobe g_mass_storage file=/dev/mmcblk0p1 removable=1

/unit_tests/dump-clocks.sh | grep usb

disconnect usb charger

connect to pc

1.5: With Micro B-To-A cable, but without anything connected

/unit_tests/dump-clocks.sh | grep usb

plug in usb disk

plug out Micro B-To-A cable

modprobe g_mass_storage file=/dev/mmcblk0p1 removable=1

connect to pc

disconnect with pc

/unit_tests/dump-clocks.sh | grep usb

| Expected Result |

Without kernel dump, without clock mismatch

|====================================================================

<<<

what's the mean of "modprobe g_mass_storage file=/dev/mmcblk0p1 removable=1" ?

why i have to do it  1.1~1.5?

i have refer Controller Operation Mode was peripheral,but the pc didn't find my board when i connect it.

the pc display nothing.

i saw the source .and add same debug infromation:

kernel-source\drivers\usb\chipidea\core.c

static irqreturn_t ci_irq(int irq, void *data)

{

  printk("0000000000000000000000\n");

  struct ci_hdrc *ci = data;

  irqreturn_t ret = IRQ_NONE;

  u32 otgsc = 0;

  printk("ci->in_lpm:%x\n",ci->in_lpm);

  if (ci->in_lpm) {

  printk("irq:%x\n",irq);

  disable_irq_nosync(irq);

  ci->wakeup_int = true;

  pm_runtime_get(ci->dev);

  return IRQ_HANDLED;

  }

printk("ci->is_otg:%x\n",ci->is_otg);

  if (ci->is_otg) {

  otgsc = hw_read_otgsc(ci, ~0);

  if (ci_otg_is_fsm_mode(ci)) {

  ret = ci_otg_fsm_irq(ci);

  if (ret == IRQ_HANDLED)

  return ret;

  }

  }

  /*

  * Handle id change interrupt, it indicates device/host function

  * switch.

  */

  if (ci->is_otg && (otgsc & OTGSC_IDIE) && (otgsc & OTGSC_IDIS)) {

  printk("Handle id change interrupt\n");

  ci->id_event = true;

  /* Clear ID change irq status */

  hw_write_otgsc(ci, OTGSC_IDIS, OTGSC_IDIS);

  ci_otg_queue_work(ci);

  return IRQ_HANDLED;

  }

  /*

  * Handle vbus change interrupt, it indicates device connection

  * and disconnection events.

  */

  if (ci->is_otg && (otgsc & OTGSC_BSVIE) && (otgsc & OTGSC_BSVIS)) {

printk("Handle vbus change interrupt\n");

  ci->vbus_glitch_check_event = true;

  /* Clear BSV irq */

  hw_write_otgsc(ci, OTGSC_BSVIS, OTGSC_BSVIS);

  ci_otg_queue_work(ci);

  return IRQ_HANDLED;

  }

  /* Handle device/host interrupt */

  if (ci->role != CI_ROLE_END){

  printk("Handle device/host interrupt\n");

  ret = ci_role(ci)->irq(ci);

  }

  return ret;

}

when i connect the pc :

usb连接反应.png

first irq:change the low power mode.

but i can't understand the second time,why the ci->is_otg is 1?

my   dr_mode = "peripheral";

i know   ret = ci_role(ci)->irq(ci); is enable the irq for peripheral

source in: static irqreturn_t udc_irq(struct ci_hdrc *ci)  //kernel-source\drivers\usb\chipidea\udc.c

but it didn't happend.

my board:

开发板截图.png

i use the usb otg to connect the pc..

in my mind ,if i want to send and reveice the data with the pc :

1.alter the dts ,rebuilt the dtb,reboot the board.

2 .when i connect to the pc i can see  the  board information on pc device manager such as VENDOR_ID and PRODUCT_ID

3......

..

..

it's right?

i have altered the dts ,but the pc didn't identify  it...

why?

if i have to alter the kernel?

it's my first time to learn usb ,thanks for all the help!

0 Kudos
Reply
1,401 Views
半醒的狐狸
Contributor I

hi igorpadykov

    thanks for you help,i saw the  description in /doc,but i can't understand the dump-clocks.sh.

clock.png

what's the mean of the "flags"  、"en_cnt"、"pre_cnt"?

i can't found the description of this..

thanks!

0 Kudos
Reply