This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

processor-sdk-linux-am335x-evm-06.03.00.106-Linux AM3359的USB0 Host功能

  HI,各位好,我使用的processor-sdk-linux-am335x-evm-06.03.00.106-Linux ,使用的是3359的自制板,现在板子的linux已经正常启动,我使用的是am335x-evm.dts,其内部内容包含USB字节的内容修改如下:

&usb {
status = "okay";
};

&usb_ctrl_mod {
status = "okay";
};

&usb0_phy {
status = "okay";
};

&usb1_phy {
status = "okay";
};

&usb0 {
status = "okay";
dr_mode = "host";
};

&usb1 {
status = "okay";
dr_mode = "host";
};

进入系统后lsusb看到如下信息:

Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

插上设备后,测量设备的USB电源上没有5V,USB电路参考了官方开发板设计。 

将IN和OUT短接的话,给USB设备直接供电时,只有在设备插入的一瞬间设备有电,之后电源也接着会消失。
是不是usb host除了dts的配置外,还需要其他地方进行配置?

  • Typical connections for a USB host:
    • USBx_DP and USBx_DM are connected directly to the USB connector
    • USBx_CE is typically not used and can be left unconnected
    • USDx_ID should be grounded
    • USBx_DRVVBUS should be connected to the enable of the 5 V VBUS power source.
    • USBx_VBUS should be connected to the output of the 5 V VBUS power source
    具体可参考am335x EVM usb1的设计。

  • Hi  Nancy,你好。 如果我把板子的sysboot设置为USB启动,可以看到上位机的USB device设备 (AM335x USB),DP DM等应该没问题。我的USB0的原理图见下图:

    USB0 DRVVBUS和USB0_VBUS见第一层中的图片,在测试USB host功能时,• USDx_ID 是接地的。我觉着电路上的应用没有问题。

    我这个自制板子在uboot代码中强制判断自己是board_is_evm_sk,在board_ti_is中直接如下赋值(板子中没有设置EEPROM):

    memcpy(ep->name,"A335X_SK",8);
    memcpy(ep->version,"1.0",3);
    memcpy(ep->serial,"00000001",8);

    感觉像是USB host被其他功能挤占了一样。


    U-Boot 2019.01-gc148924-dirty (Jul 20 2020 - 10:38:48 +0800)

    CPU : AM335X-GP rev 2.1
    Model: TI AM335x EVM-SK
    DRAM: 1 GiB
    board_init
    board_ti_is run,ep->name=A335X_SK
    NAND: 512 MiB
    MMC: OMAP SD/MMC: 0, OMAP SD/MMC: 1
    Loading Environment from FAT... board_ti_is run,ep->name=A335X_SK
    <ethaddr> not set. Validating first E-fuse MAC
    Net: eth0: ethernet@4a100000
    Hit any key to stop autoboot: 0
    ## Error: "bootcmd_nand0" not defined
    starting USB...
    USB0: Port not available.
    link up on port 0, speed 1000, full duplex
    BOOTP broadcast 1
    BOOTP broadcast 2
    BOOTP broadcast 3
    BOOTP broadcast 4
    BOOTP broadcast 5
    BOOTP broadcast 6

    我这个spl和uboot环节会提示USB0: Port not available,这里会不会导致后续使用不正常?


    linux启动过程中 带有USB信息的内容如下:

    [ 18.529663] asoc-simple-card sound: ASoC: no DMI vendor name!
    [ 18.666105] PM: bootloader does not support rtc-only!
    [ 18.705935] omap_gpio 44e07000.gpio: Could not set line 6 debounce to 200000 microseconds (-22)
    [ 18.919188] omap_hsmmc 48060000.mmc: Got CD GPIO
    [ 22.640658] cpsw 4a100000.ethernet eth0: Link is Up - 1Gbps/Full - flow control off
    [ 22.677334] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
    [ OK ] Found device /dev/ttyS3.
    [ 24.857603] omap_gpio 44e07000.gpio: Could not set line 6 debounce to 200000 microseconds (-22)
    [ 24.952534] omap_hsmmc 48060000.mmc: Got CD GPIO
    [ 25.442829] am335x-phy-driver 47401300.usb-phy: 47401300.usb-phy supply vcc not found, using dummy regulator
    [ 25.565967] am335x-phy-driver 47401300.usb-phy: Linked as a consumer to regulator.0
    [ 25.631452] omap_gpio 44e07000.gpio: Could not set line 6 debounce to 200000 microseconds (-22)
    [ 25.660047] am335x-phy-driver 47401b00.usb-phy: 47401b00.usb-phy supply vcc not found, using dummy regulator
    [ 25.721792] omap_hsmmc 48060000.mmc: Got CD GPIO
    [ 25.795672] am335x-phy-driver 47401b00.usb-phy: Linked as a consumer to regulator.0
    [ 25.823910] usbcore: registered new interface driver usbfs
    [ 25.855954] omap_gpio 44e07000.gpio: Could not set line 6 debounce to 200000 microseconds (-22)
    [ 25.874568] usbcore: registered new interface driver hub
    [ 25.951690] usbcore: registered new device driver usb
    [ 25.977711] omap_hsmmc 48060000.mmc: Got CD GPIO
    [ 26.320839] musb-hdrc musb-hdrc.0: MUSB HDRC host driver
    [ 26.326252] musb-hdrc musb-hdrc.0: new USB bus registered, assigned bus number 1
    [ 26.406926] input: ti-tsc as /devices/platform/ocp/44e0d000.tscadc/TI-am335x-tsc.0.auto/input/input2
    [ 26.447899] omap_gpio 44e07000.gpio: Could not set line 6 debounce to 200000 microseconds (-22)
    [ 26.474248] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 4.19
    [ 26.538732] omap_hsmmc 48060000.mmc: Got CD GPIO
    [ 26.567740] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
    [ 26.624050] omap_gpio 44e07000.gpio: Could not set line 6 debounce to 200000 microseconds (-22)
    [ 26.663962] usb usb1: Product: MUSB HDRC host driver
    [ 26.708172] usb usb1: Manufacturer: Linux 4.19.94-gbe5389fd85 musb-hcd
    [ 26.728114] omap_hsmmc 48060000.mmc: Got CD GPIO
    [ 26.772825] usb usb1: SerialNumber: musb-hdrc.0
    [ 26.822343] hub 1-0:1.0: USB hub found
    [ 26.853909] hub 1-0:1.0: 1 port detected
    [ 26.887965] omap_gpio 44e07000.gpio: Could not set line 6 debounce to 200000 microseconds (-22)
    [ 26.957384] omap_hsmmc 48060000.mmc: Got CD GPIO
    [ 27.014301] musb-hdrc musb-hdrc.1: MUSB HDRC host driver
    [ 27.041270] omap_gpio 44e07000.gpio: Could not set line 6 debounce to 200000 microseconds (-22)
    [ 27.084300] musb-hdrc musb-hdrc.1: new USB bus registered, assigned bus number 2
    [ 27.129529] omap_hsmmc 48060000.mmc: Got CD GPIO
    [ 27.157018] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 4.19
    [ 27.231593] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
    [ 27.294466] usb usb2: Product: MUSB HDRC host driver
    [ 27.341026] usb usb2: Manufacturer: Linux 4.19.94-gbe5389fd85 musb-hcd
    [ 27.399305] usb usb2: SerialNumber: musb-hdrc.1
    [ 27.436174] hub 2-0:1.0: USB hub found
    [ 27.487406] hub 2-0:1.0: 1 port detected
    [ 27.524513] omap_gpio 44e07000.gpio: Could not set line 6 debounce to 200000 microseconds (-22)
    [ 27.605861] omap_hsmmc 48060000.mmc: Got CD GPIO
    [ 27.652595] omap_gpio 44e07000.gpio: Could not set line 6 debounce to 200000 microseconds (-22)
    [ 27.774041] omap_hsmmc 48060000.mmc: Got CD GPIO
    [ 27.831232] omap_gpio 44e07000.gpio: Could not set line 6 debounce to 200000 microseconds (-22)
    [ 27.938695] omap_hsmmc 48060000.mmc: Got CD GPIO
    [ 28.637326] omap_gpio 44e07000.gpio: Could not set line 6 debounce to 200000 microseconds (-22)
    [ 28.742819] remoteproc remoteproc1: 4a334000.pru is available
    [ 28.799043] omap_hsmmc 48060000.mmc: Got CD GPIO
    [ 28.836874] pru-rproc 4a334000.pru: PRU rproc node pru@4a334000 probed successfully
    [ 28.921377] omap_gpio 44e07000.gpio: Could not set line 6 debounce to 200000 microseconds (-22)
    [ 28.934466] remoteproc remoteproc2: 4a338000.pru is available
    [ 28.968680] pru-rproc 4a338000.pru: PRU rproc node pru@4a338000 probed successfully
    [ 28.986253] omap_hsmmc 48060000.mmc: Got CD GPIO
    [ 29.051665] omap_gpio 44e07000.gpio: Could not set line 6 debounce to 200000 microseconds (-22)
    [ 29.127796] omap_hsmmc 48060000.mmc: Got CD GPIO
    ***************************************************************
    ***************************************************************
    NOTICE: This file system contains the following GPLv3 packages:
    bash
    bc
    cifs-utils
    cpio
    dosfstools
    elfutils
    gawk
    gzip
    libbfd
    libdw1
    libelf1
    libreadline7
    which

    If you do not wish to distribute GPLv3 components please remove
    the above packages prior to distribution. This can be done using
    the opkg remove command. i.e.:
    opkg remove <package>
    Where <package> is the name printed in the list above

    NOTE: If the package is a dependency of another package you
    will be notified of the dependent packages. You should
    use the --force-removal-of-dependent-packages option to
    also remove the dependent packages as well
    ***************************************************************
    ***************************************************************
    [ OK ] Started Print notice about GPLv3 packages.
    [ 35.039045] lis3_reg: disabling
    [ 35.042250] wlan-en-regulator: disabling
    [ 35.046193] v1_8d: disabling
    [ 35.069290] v3_3d: disabling
    [ OK ] Started Wait for Network to be Configured.
    [ OK ] Reached target Network is Online.
    Starting Save/Restore Sound Card State...
    [ OK ] Listening on Load/Save RF Kill Switch Status /dev/rfkill Watch.
    [ OK ] Started Getty on tty1.
    [ OK ] Started Serial Getty on ttyS3.
    [ OK ] Started Serial Getty on ttyS0.
    [ OK ] Reached target Login Prompts.
    Starting Synchronize System and HW clocks...
    [ OK ] Started NFS status monitor for NFSv2/3 locking..
    Starting LSB: network benchmark...
    Starting thttpd.service...
    [ OK ] Started Save/Restore Sound Card State.
    [ OK ] Started Synchronize System and HW clocks.
    [ OK ] Started LSB: network benchmark.
    [ OK ] Reached target Sound Card.
    [ OK ] Started thttpd.service.
    Starting thermal-zone-init.service...
    [ OK ] Started thermal-zone-init.service.
    [ OK ] Started Login Service.
    [ OK ] Started Avahi mDNS/DNS-SD Stack.
    [ OK ] Reached target Multi-User System.
    Starting Update UTMP about System Runlevel Changes...
    [ OK ] Started Update UTMP about System Runlevel Changes.

    看网上介绍USB配置的,在启动时都有

    [    1.506178] usbcore: registered new interface driver usb-storage

    [    1.779192] usbcore: registered new interface driver usbhid

    [    1.785014] usbhid: USB HID core driver

    这一类HID usb-storage等驱动加载,我这个启动信息并没有发现这些内容。但是进入linux后可以看到如下信息:

    root@am335x-evm:/lib/modules/4.19.94-gbe5389fd85/kernel/drivers/usb# lsusb -tv
    /: Bus 02.Port 1: Dev 1, class="root_hub", Driver=musb-hdrc/1p, 480M
    /: Bus 01.Port 1: Dev 1, class="root_hub", Driver=musb-hdrc/1p, 480M
    root@am335x-evm:/lib/modules/4.19.94-gbe5389fd85/kernel/drivers/usb# lsmod
    Module Size Used by
    pru_rproc 24576 0
    irq_pruss_intc 16384 1 pru_rproc
    pruss 16384 1 pru_rproc
    musb_dsps 20480 0
    musb_hdrc 106496 1 musb_dsps
    udc_core 28672 1 musb_hdrc
    ti_am335x_adc 20480 0
    ti_am335x_tsc 16384 0
    usbcore 217088 1 musb_hdrc
    phy_am335x 16384 2
    phy_generic 16384 1 phy_am335x
    usb_common 16384 5 phy_am335x,udc_core,musb_hdrc,musb_dsps,usbcore
    phy_am335x_control 16384 1 phy_am335x
    snd_soc_simple_card 16384 0
    snd_soc_simple_card_utils 16384 1 snd_soc_simple_card
    pm33xx 16384 0
    wkup_m3_rproc 16384 1
    wkup_m3_ipc 16384 1 pm33xx
    remoteproc 49152 3 pru_rproc,wkup_m3_rproc,wkup_m3_ipc
    omap_aes_driver 24576 0
    crypto_engine 16384 1 omap_aes_driver
    omap_crypto 16384 1 omap_aes_driver
    omap_sham 28672 0
    ti_emif_sram 16384 1 pm33xx
    pruss_soc_bus 16384 0
    snd_soc_tlv320aic3x 57344 1
    rtc_omap 20480 2
    ti_am335x_tscadc 16384 2 ti_am335x_adc,ti_am335x_tsc
    omap_wdt 16384 0
    musb_am335x 16384 0
    matrix_keypad 20480 0
    matrix_keymap 16384 1 matrix_keypad
    sch_fq_codel 20480 3

    是不是我的deconfig中缺少某些驱动控制的内容?如下是我用的配置信息

    1715.tisdk_am335x-evm_defconfig.txt

    这个文件是SDK中自带的内容。

  • 从内核启动打印信息来看usb已经是Host模式,并且usb bus已经识别。
    请问现在是插入usb设备无法识别吗?
  • 我这个需要直接用5V给USB0供电,要将最上面电路图里的IN 和OUT短接才可以,好像还是修改了一个代码
    \arch\arm\mach-omap2\am33xx\board.c
    static struct musb_hdrc_platform_data otg0_plat = {
    //.mode = CONFIG_AM335X_USB0_MODE,
    .mode = MUSB_HOST,
    这里改了起的作用,能识别USB设备了。但是需要额外供电。