Skip to content

怎样配置USB为host模式 (AEGHB-1072) #191

@yuanfangcn

Description

@yuanfangcn

Checklist

  • Checked the issue tracker for similar issues to ensure this is not a duplicate
  • Read the documentation to confirm the issue is not addressed there and your configuration is set correctly
  • Tested with the latest version to ensure the issue hasn't been fixed

How often does this bug occurs?

always

Expected behavior

当前问题是:
用USB D+,D-(gpio20, gpio19)连接了usb 4G模组,vbus是直供电5V,
当开机运行到:
espressif__iot_usbh_modem\src\usbh_modem_board.c
中的
static void _modem_daemon_task(void *param)
。。。
无法检测到USB 4G 设备连接

添加过了相应的驱动组件(host, modem, otg...),
1.那么是否需要配置usb otg 为host?如何配置
2.下面是原始otg code,但是当前产品中硬件设计没有用到这些GPIO:BSP_USB_MODE_SEL,BSP_USB_DEV_VBUS_EN 等
#ifdef CONFIG_ESP32_S3_USB_OTG
bsp_usb_mode_select_host();
bsp_usb_host_power_mode(BSP_USB_HOST_POWER_MODE_BATTERY, true);
#endif
那么不启用这个CONFIG_ESP32_S3_USB_OTG情况下,软件直接使能为host模式?

Actual behavior (suspected bug)

开机后没有检测到USB, MODEM等的事件变化:
espressif__iot_usbh_modem\src\usbh_modem_board.c :

while (true) {
/********************************** handle external event *********************************************************/
EventBits_t bits = xEventGroupWaitBits(s_modem_evt_hdl, (PPP_NET_MODE_ON_BIT | PPP_NET_MODE_OFF_BIT | DTE_USB_RECONNECT_BIT | DTE_USB_DISCONNECT_BIT | PPP_NET_RECONNECTING_BIT |
PPP_NET_DISCONNECT_BIT | MODEM_DESTROY_BIT), pdFALSE, pdFALSE, portMAX_DELAY);
ESP_LOGI(TAG, "Handling bits = %04X, stage = %d, retry = %d ", (unsigned int)bits, modem_stage, stage_retry_times);

开机后一直停留在 xEventGroupWaitBits 函数处

Error logs or terminal output

见上

Steps to reproduce the behavior

见上

Project release version

idf 5.4

System architecture

Intel/AMD 64-bit (modern PC, older Mac)

Operating system

Windows

Operating system version

win10

Shell

PowerShell

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions