-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pyserial 3.4 with Python 2.17.13 under Windows 10 #258
Comments
There are quite a few people that have this issue. I've googled long and hard but cannot find an answer. I have a Virtual Com Port installed (COM90 <=> COM91 loopback) and my pyserial (Win10) app can connect ok to it. I have a real device on COM3, but my serial app wont connect and I get the Another program written in C/C++ (Embarcadero aka C++Builder) can connect to COM3 fine. So what do we make of that? The standard Win 10 Microsoft driver must be OK since the C/C++ app talks to it fine. The only thing that doesn't talk to it is the pyserial app, but the pyserial app works fine with COM90 (which uses a different driver, by the Virtual Com Port provider). My guess it's something to do with the Python mappings to the Windows system calls, but where ??? |
I've investigated this issue further. The Embarcadero C++ app does work, however when I debug it I can see that the call to So I edited the pySerial source to not raise an exception if So the question is why does Either it's bug in the Microsoft driver on Win 10, or maybe it's something to do with the USB descriptor/configuration info which the driver uses to check what parameters can be set? |
OK. So it looks like the Win 10 CDC drivers are more thorough and more fussy than Win 7 (and prior presumably). I was using an STM32 controller with in-built USB peripheral and the ST provided driver software, and the driver software does not return the correct comm parameter settings after they have been set (i.e. they are set to 115200, 8, N, 1 but do not reply with same values when read back). I made a change so that the set values are cached and the same values returned when reading them back and You may find a similar solution for your issue @mbarzanti ? For my situation I can't fix the problem in the devices that are already out in customers hands (the bootloader firmware is not field upgradeable) so am going to start a new issue with a couple of PySerial modification proposals. |
I opened #362 to discuss or get some advice on changes to PySerial to work better with Windows 10. |
"caches the set values" sounds a good idea. Thanks a lot, I'll try it. |
@BrendanSimon How can I cache these set values ? |
If you found out how please do not hesitate to share |
I meant the device firmware response to USB-CDC Control request from PC: it needs to cache LINECODING settings (baud rate/format/parity/data bits), or PC may suggest "the device has some error" and pyserial will raise exception in windows. I guess WINDOWS may write and readback and compare the settings and I did not found that problem in Ubuntu. |
I'm using pyserial 3.4 with Python 2.17.13 under Windows 10.
When open COM5 port, I obtained the following error.
Same source, same pyserial, same python versions, runs correctly under Windows 7 and 8.1
Traceback (most recent call last):
File "NAPOSend1.0.py", line 327, in
r = sendfile(NAPOport, PATHNAME, os.path.getsize(PATHNAME))
File "NAPOSend1.0.py", line 116, in sendfile
ser = Serial('COM5', 115200, timeout=10, writeTimeout=0)
File "build\bdist.win-amd64\egg\serial\serialwin32.py", line 31, in init
File "build\bdist.win-amd64\egg\serial\serialutil.py", line 240, in init
File "build\bdist.win-amd64\egg\serial\serialwin32.py", line 78, in open
File "build\bdist.win-amd64\egg\serial\serialwin32.py", line 222, in _reconfig
ure_port
serial.serialutil.SerialException: Cannot configure port, something went wrong.
Original message: WindowsError(87, 'Incorrect Parameter.')
The text was updated successfully, but these errors were encountered: