你好。
我有一个基于 am5728的定制板。
我们希望将此板用作 USB 设备(也用作另一个端口上的主机)、但我没有成功使用它。
主机系统无法识别主板(在 Windows 和 Linux 主机上检查)。
在板上、我们修改了 USB Type-A 端口连接器-使用电源线指示连接。 我们将该信号路由到 GPIO。
与 am5728-EVM 不同的是、我没有 PMIC、因此我们应该用另一种方式通知驱动器。
我只有 VBUS、没有 ID。
G20焊球被选择、并将其设置为 mux_data.h 作为 GPIO。
首先、我决定检查该引脚是否正常工作。
mux_data.h 设置:
{DCAN1_TX, (M14 | PIN_INPUT_PULLUP)}, /* dcan1_tx.gpio1_14 */
DTS-file 未更改。
在 Linux 中、我使用 GPIO 驱动程序导出此引脚并读取其状态:
/sys/class/gpio # echo 14 >导出
/sys/class/gpio # cat gpio14/值
它成功显示已连接到主机 USB 电缆的状态。
之后、我更改了 DTS 文件。
这是我解编译的 DTB 文件的一部分:
extcon_usb2mi { compatible = "linux,extcon-usb-gpio"; vbus-gpio = <0xaf 0xe 0x0>; /*vbus-gpio = <&gpio1 14 GPIO_ACTIVE_HIGH>;*/ phandle = <0xf2>; }; ... omap_dwc3_1@48880000 { compatible = "ti,dwc3"; ti,hwmods = "usb_otg_ss1"; reg = <0x48880000 0x10000>; interrupts = <0x0 0x48 0x4>; #address-cells = <0x1>; #size-cells = <0x1>; utmi-mode = <0x2>; ranges; phandle = <0x1f4>; usb@48890000 { compatible = "snps,dwc3"; reg = <0x48890000 0x17000>; interrupts = <0x0 0x47 0x4 0x0 0x47 0x4 0x0 0x48 0x4>; interrupt-names = "peripheral", "host", "otg"; phys = <0xf0 0xf1>; phy-names = "usb2-phy", "usb3-phy"; maximum-speed = "super-speed"; dr_mode = "host"; snps,dis_u3_susphy_quirk; snps,dis_u2_susphy_quirk; phandle = <0x1f5>; }; }; omap_dwc3_2@488c0000 { compatible = "ti,dwc3"; ti,hwmods = "usb_otg_ss2"; reg = <0x488c0000 0x10000>; interrupts = <0x0 0x57 0x4>; #address-cells = <0x1>; #size-cells = <0x1>; utmi-mode = <0x2>; ranges; extcon = <0xf2>; phandle = <0x1f6>; usb@488d0000 { compatible = "snps,dwc3"; reg = <0x488d0000 0x17000>; interrupts = <0x0 0x49 0x4 0x0 0x49 0x4 0x0 0x57 0x4>; interrupt-names = "peripheral", "host", "otg"; phys = <0xf3>; phy-names = "usb2-phy"; maximum-speed = "high-speed"; dr_mode = "peripheral"; snps,dis_u3_susphy_quirk; snps,dis_u2_susphy_quirk; snps,dis_metastability_quirk; phandle = <0x1f7>; }; }; omap_dwc3_3@48900000 { compatible = "ti,dwc3"; ti,hwmods = "usb_otg_ss3"; reg = <0x48900000 0x10000>; interrupts = <0x0 0x158 0x4>; #address-cells = <0x1>; #size-cells = <0x1>; utmi-mode = <0x2>; ranges; status = "disabled"; phandle = <0x1f8>; usb@48910000 { compatible = "snps,dwc3"; reg = <0x48910000 0x17000>; interrupts = <0x0 0x58 0x4 0x0 0x58 0x4 0x0 0x158 0x4>; interrupt-names = "peripheral", "host", "otg"; maximum-speed = "high-speed"; dr_mode = "otg"; snps,dis_u3_susphy_quirk; snps,dis_u2_susphy_quirk; phandle = <0x1f9>; }; };
系统加载后、我使用 g_serial 驱动程序:
# modprobe g_serial [ 576.257184] udc 488d0000.usb: registering UDC driver [g_serial] [ 576.274083] userial_init: registered 4 ttyGS* devices [ 576.281874] g_serial gadget: adding 'acm'/d34a2540 to config 'CDC ACM config'/bf398004 [ 576.289848] g_serial gadget: acm ttyGS0: dual speed IN/ep1in OUT/ep1out NOTIFY/ep2in [ 576.298162] g_serial gadget: Gadget Serial v2.4 [ 576.303636] g_serial gadget: g_serial ready
/dev/ttyGS0也出现了。
除此之外、我运行了 chkusb 脚本。 有输出:
chkusb.sh Version 0.2.8 Linux K2M-5G-9876549999 4.14.79-gbde58ab01e #1 SMP PREEMPT Mon Dec 19 18:35:20 +07 2022 armv7l GNU/Linux USB is initialized Warning: CONFIG_USB_OTG undefined, which is required for DRD mode. ./0184.chkusb-0.2.8.sh: line 384: /proc/device-tree//ocp/omap_dwc3_1@48880000/usb@48890000/status: No such file or directory usb@48890000: host, ./0184.chkusb-0.2.8.sh: line 384: /proc/device-tree//ocp/omap_dwc3_2@488c0000/usb@488d0000/status: No such file or directory usb@488d0000: peripheral, Gadget Kernel Config: g_zero is enabled Gadget Kernel Config: g_audio is enabled Gadget Kernel Config: g_ether is enabled Gadget Kernel Config: g_ncm is enabled Gadget Kernel Config: g_mass_storage is enabled Gadget Kernel Config: g_serial is enabled Gadget Kernel Config: g_printer is enabled gadget driver loaded: DRIVER=g_serial The list of USB gadget drivers installed: /lib/modules/4.14.79-gbde58ab01e/kernel/drivers/usb/gadget/: function/ legacy/ libcomposite.ko /lib/modules/4.14.79-gbde58ab01e/kernel/drivers/usb/gadget/function: u_audio.ko u_ether.ko u_serial.ko usb_f_acm.ko usb_f_ecm.ko usb_f_ecm_subset.ko usb_f_eem.ko usb_f_fs.ko usb_f_hid.ko usb_f_mass_storage.ko usb_f_midi.ko usb_f_ncm.ko usb_f_obex.ko usb_f_printer.ko usb_f_rndis.ko usb_f_serial.ko usb_f_ss_lb.ko usb_f_uac1.ko usb_f_uac2.ko usb_f_uvc.ko /lib/modules/4.14.79-gbde58ab01e/kernel/drivers/usb/gadget/legacy: g_acm_ms.ko g_audio.ko g_cdc.ko g_dbgp.ko g_ether.ko g_ffs.ko g_hid.ko g_mass_storage.ko g_midi.ko g_multi.ko g_ncm.ko g_printer.ko g_serial.ko g_webcam.ko g_zero.ko gadgetfs.ko
此外、我尝试使用此设置、但没有成功:
{DCAN1_TX、(M14 | PIN_INPUT | SLEWCONTROL)}、 /* dcan1_TX.GPIO1_14 *
我不明白为什么主机无法识别电路板。
可以帮帮我吗? 您有任何建议吗?