问题
I am having exactly the problem detailed at Custom baud rate -- SetCommState()
fails with baud=921600 but succeeds with baud=115200 -- albeit on Windows 7 64-bit and with a couple of other odd circumstances, as follows:
1) The port I'm talking to, is a USB-to-UART adapter from Silicon Labs, with their driver but (as I understand it; don't quote me) re-signed to identify itself as from my company (we redistribute it with our hardware product which requires it). The COM port appears in Device Manager when I connect my hardware device to the computer, and disappears when I disconnect it. I don't know a lot about this but I assume it to be normal behavior.
2) 921600 baud used to work, in the app I sell and in a sample program I wrote that ran fine the last time I used it, but yesterday started failing on the grounds that requesting 921600 baud now causes SetCommState()
to fail with "the parameter is incorrect." Changing the requested baud rate to 115200 allows SetCommState()
to succeed, but unacceptably slows communication.
3) 921600 baud STILL WORKS IN REALTERM. I can set the port to 921600 baud and open it; it "just works," with no errors or other complaints. I can talk to my instrument and get data, etc., just as always.
4) I did reinstall the driver a week or two ago, as part of solving a problem in which Windows had incorrectly marked a large number of COM ports as "in use." Driver installation claimed to succeed, but the port could not be opened; Device Manager showed a yellow triangle/exclamation/problem. A lot of trial-and-error eventually revealed that the installation process had failed to copy a .inf file into system32. I copied that file into place "by hand" and normal operation ensued--until today.
5) Device Manager today shows 115200 baud as the highest rate available for the device, but I'm not at all sure it EVER DID show any higher rate; I never worried about it because it "just worked."
So, in short, everything worked fine 'til yesterday, and now suddenly my own apps won't do 921600 baud but RealTerm still will.
Suggestions? Solutions?
来源:https://stackoverflow.com/questions/11475845/custom-baud-rate-redux