esp32s3开发板 使用USB -host-cdc-acm历程 识别不成功

Moderator: ESP_Bob

wishlucky
Posts: 6
Joined: Tue Aug 15, 2023 5:36 am

esp32s3开发板 使用USB -host-cdc-acm历程 识别不成功

Postby wishlucky » Fri Sep 15, 2023 12:23 pm

我使用的是 esp32-s3 使用usb host-cdc-acm 历程。
从机用的是 stm32f407 标准库 的usb-cdc-vcp 历程,
从机和PC端连接,可以识别到设备,
从机和ESP32相连识别不到设备???
程序错误点: 这个函数 (_check_client_opened_device(client_obj, dev_addr)) 返回来错误标志

esp_err_t usb_host_device_open(usb_host_client_handle_t client_hdl, uint8_t dev_addr, usb_device_handle_t *dev_hdl_ret)
{
HOST_CHECK(dev_addr > 0 && client_hdl != NULL && dev_hdl_ret != NULL, ESP_ERR_INVALID_ARG);
client_t *client_obj = (client_t *)client_hdl;

esp_err_t ret;
usb_device_handle_t dev_hdl;

ret = usbh_dev_open(dev_addr, &dev_hdl);
if (ret != ESP_OK) {
goto exit;
}

HOST_ENTER_CRITICAL();
if (_check_client_opened_device(client_obj, dev_addr)) {
//Client has already opened the device. Close it and return an error
ret = ESP_ERR_INVALID_STATE;
HOST_EXIT_CRITICAL();
ESP_LOGE("----","ESP_ERROR_CHECK cong zhe li mian guan diao le ");
goto already_opened;
}

//Record in client object that we have opened the device of this address
_record_client_opened_device(client_obj, dev_addr);
HOST_EXIT_CRITICAL();
*dev_hdl_ret = dev_hdl;
ret = ESP_OK;
ESP_LOGE("----","_record_client_opened_device ok ");
return ret;


already_opened:

ESP_ERROR_CHECK(usbh_dev_close(dev_hdl));
exit:

return ret;
}

请问一下 这是什么原因导致的??
我用stm32的 HAL库历程没有问题:这是什么情况

Who is online

Users browsing this forum: No registered users and 66 guests