USB VCP connection fails occasionally

女生的网名这么多〃 提交于 2019-12-11 15:52:24

问题


My question is quite simple: I operate 20 CP210x (Silicon Lab) devices over an industrial 20 Port USB Hub.

In one of about 1000 trials to open the port I get a problem: The call to

CreateFile(portName, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);

is blocking and doesn't return. In this case it doesn't help to repeat or to restart my software. Only plugging out/in the device helps. Of course the port name is including backslashes, as required for higher COM Port numbers. The port is closed without getting an error after each communication by

CloseHandle(comport_p);

I could give more details on my source, but think, that the relevant parts are the mentioned lines. Is there something else I have to consider in my software or could there be a driver problem?

来源:https://stackoverflow.com/questions/49688772/usb-vcp-connection-fails-occasionally

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!