现已经实现host通过cdc驱动ch340正常收发通信 波特率是默认的19200 按照网上的资料修改波特率
static USBH_StatusTypeDef SetLineCoding(USBH_HandleTypeDef *phost,
CDC_LineCodingTypeDef *linecoding)
{
phost->Control.setup.b.bmRequestType = USB_H2D | USB_REQ_TYPE_CLASS |
USB_REQ_RECIPIENT_INTERFACE;
phost->Control.setup.b.bRequest = CDC_SET_LINE_CODING;
phost->Control.setup.b.wValue.w = 0U;
phost->Control.setup.b.wIndex.w = 0U;
phost->Control.setup.b.wLength.w = LINE_CODING_STRUCTURE_SIZE;
phost->Control.setup.d8[0] = 0x000ca140;
phost->Control.setup.d8[1] = 0x0000cc03;
return USBH_CtlReq(phost, linecoding->Array, LINE_CODING_STRUCTURE_SIZE);
}
一直返回usb_busy
波特率没有任何改变 usb转串口芯片是ch340g 有人知道是啥问题吗