USB Host
Posted: Thu Sep 23, 2021 11:07 am
使用USBh_cdc库时遇到如下问题:
[0;32mI (00:00:23.598) USB_HCDC: Resetting Port
[0m
[0;32mI (00:00:23.658) USB_HCDC: Port speed = 1
[0m
[0;32mI (00:00:23.661) USB_HCDC: Pipe Default Created[0m
[0;32mI (00:00:23.663) USB_HCDC: 1. Set Device Addr = 1[0m
[0;33mW (00:00:23.666) USB_HCDC: line 393 Pipe: default HCD_PIPE_EVENT_ERROR_XFER[0m
USB配置部分代码:
void peripherals_usb_config(void)
{
static const char *TAG = "USB_configuration";
usb_ep_desc_t bulk_out_ep_desc =
{
.bLength = sizeof(usb_ep_desc_t),
.bDescriptorType = USB_B_DESCRIPTOR_TYPE_ENDPOINT,
.bEndpointAddress = 0x0f, //endpiont f
.bmAttributes = USB_BM_ATTRIBUTES_XFER_BULK,
.wMaxPacketSize = 64, //MPS of 64 bytes
.bInterval = 0,
};
usb_ep_desc_t bulk_in_ep_desc =
{
.bLength = sizeof(usb_ep_desc_t),
.bDescriptorType = USB_B_DESCRIPTOR_TYPE_ENDPOINT,
.bEndpointAddress = 0x86, //endpoint 6
.bmAttributes = USB_BM_ATTRIBUTES_XFER_BULK,
.wMaxPacketSize = 64, //MPS of 64 bytes
.bInterval = 0,
};
usbh_cdc_config_t usbh_cdc_configuration =
{
.bulk_in_ep = &bulk_in_ep_desc,
.bulk_out_ep = &bulk_out_ep_desc,
.rx_buffer_size = 1024,
.tx_buffer_size = 1024,
.rx_callback = usb_event_cd,
};
esp_err_t ret = usbh_cdc_driver_install(&usbh_cdc_configuration);
assert(ret == ESP_OK);
xTaskCreate(usb_task,"usb_task",4096,NULL,2,NULL);
ESP_LOGI(TAG,"ret:%d",ret);
}
[0;32mI (00:00:23.598) USB_HCDC: Resetting Port
[0m
[0;32mI (00:00:23.658) USB_HCDC: Port speed = 1
[0m
[0;32mI (00:00:23.661) USB_HCDC: Pipe Default Created[0m
[0;32mI (00:00:23.663) USB_HCDC: 1. Set Device Addr = 1[0m
[0;33mW (00:00:23.666) USB_HCDC: line 393 Pipe: default HCD_PIPE_EVENT_ERROR_XFER[0m
USB配置部分代码:
void peripherals_usb_config(void)
{
static const char *TAG = "USB_configuration";
usb_ep_desc_t bulk_out_ep_desc =
{
.bLength = sizeof(usb_ep_desc_t),
.bDescriptorType = USB_B_DESCRIPTOR_TYPE_ENDPOINT,
.bEndpointAddress = 0x0f, //endpiont f
.bmAttributes = USB_BM_ATTRIBUTES_XFER_BULK,
.wMaxPacketSize = 64, //MPS of 64 bytes
.bInterval = 0,
};
usb_ep_desc_t bulk_in_ep_desc =
{
.bLength = sizeof(usb_ep_desc_t),
.bDescriptorType = USB_B_DESCRIPTOR_TYPE_ENDPOINT,
.bEndpointAddress = 0x86, //endpoint 6
.bmAttributes = USB_BM_ATTRIBUTES_XFER_BULK,
.wMaxPacketSize = 64, //MPS of 64 bytes
.bInterval = 0,
};
usbh_cdc_config_t usbh_cdc_configuration =
{
.bulk_in_ep = &bulk_in_ep_desc,
.bulk_out_ep = &bulk_out_ep_desc,
.rx_buffer_size = 1024,
.tx_buffer_size = 1024,
.rx_callback = usb_event_cd,
};
esp_err_t ret = usbh_cdc_driver_install(&usbh_cdc_configuration);
assert(ret == ESP_OK);
xTaskCreate(usb_task,"usb_task",4096,NULL,2,NULL);
ESP_LOGI(TAG,"ret:%d",ret);
}