-
Notifications
You must be signed in to change notification settings - Fork 200
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
Device Error #25
Comments
I've had a few Device Errors on our hardware too, usually on the first read if at all. Although I found they could be ignored. Have you tried catching it and repeating? |
Catching and repeating doesn't work. |
Sounds like the reading thread died. Can you please provide .net logs? |
Debug output with enabled trace:
|
The driver doesn't support the OS Call As a fix can only be made with the hardware to test (I have no idea what this driver is doing), would you be willing to make some changes and debug? It will probably take some time before we get to a final solution. The first would be to comment out the exception in the method
That will make the main thread think that the result is pending (it will never arrive) effectively disabling it. Getting the EOF, flushing and errors from the driver won't work as expected. But I'm hoping at least the OS call |
After commenting out
|
This is going to take a little time to get a full solution (I can only work on this in my free time). I would want to build in a detection mechanism for this. Then I need to deactivate or change some behaviour, such as flushing. I need to analyse the logs. I might have some more tests that add extra logging. I want to check how the GetReceiveStat function works on your hardware. |
Ready to help. |
@splitice you indicated that you sometimes had the Device Error also but it only happened a few times. Do you have any logs for that situation? I've spent a few hours trying to reproduce and analysing code, but I can't see how this can occur. If you can, could you open a new issue? |
I have the same hardware - Arduino Uno clone (with CH340 on board) and I face the same problem with DataReceived event (the Read thread exited with code 0). When commenting the line |
Some devices, notably a Arduino Uno clone (with CH340 on board), would return error 87 (ERROR_INVALID_PARAMETER) on a call to WaitCommEvent, but it does work with the GetReceiveStats (Windows API ClearCommError function) to know when data is available to read. The flush functionality should still work on write, even without the TX_EMPTY event that we'd miss with WaitCommEvent, because we set this every time our internal buffer is empty. All unit test cases on Windows with the COM-0-COM driver work. Haven't tested with an Arduino board though. Issue: DOTNET-98, #25
I've made a commit to the branch "feature/dotnet-98" if you could please test. It's slightly different. If it's OK, I'll merge and put in the next release. |
feature/dotnet-98 works fine with CH340.
|
Some devices, notably a Arduino Uno clone (with CH340 on board), would return error 87 (ERROR_INVALID_PARAMETER) on a call to WaitCommEvent, but it does work with the GetReceiveStats (Windows API ClearCommError function) to know when data is available to read. The flush functionality should still work on write, even without the TX_EMPTY event that we'd miss with WaitCommEvent, because we set this every time our internal buffer is empty. All unit test cases on Windows with the COM-0-COM driver work. Testing on the Arduino CH340 borad done by GitHub user AndreiGorlov. Issue: DOTNET-98, #25
Merged on master |
Trying to read output from Arduino Uno clone (with CH340 on board):
ReadExisting() throws:
Same code with System.IO.Ports.SerialPort works fine.
Windows 10 x64 1703, .NET 4.6.1
The text was updated successfully, but these errors were encountered: