Embarrassing to a degree, but I'm happy we can move forward and I can put learning Java off for another day. My answer is below. UPDATE. So I have more or less given up on this. I think it is a bug that goes down to the API but I have neither the time, resources nor skill- set to get to the bottom of it. I think there exists some hardware to whom Windows just gives the middle finger. I have downloaded Eclipse, switched to Java and will try to see if that works. If not, you'll see me back here. However, I would absolutely love to solve this and so if anyone has the time or inclination to dig deep into this one, I'd love to see what you come up with. Obviously I will be checking back here from time to time. Please make sure you '@' me in your comments so I am alerted. ORIGINAL POSTI know there are a few other people dealing with this issue, but I was hoping someone could help me. I am trying to connect to a COM Port but I am getting an IO exception when I try to use the serialport. Open() command: System. IO. IOException: The parameter is incorrect. I can open, access and I get good results using Termite (a terminal program) but whenever I try with Visual Studio it won't even connect and I get this error. Now I don't even really know what this error means and I despite trying to read elsewhere I still feel lost. Can anyone explain to me what is happening here and maybe I can begin to try to figure this out? I can include more code, but to be honest there isn't much there; all the properties of the serialport device are as normal, and it is only happening with this device (I can use an MSP4. My code is shown below for people who would like to see it (note this is just a 'sandbox', not the actual program but the symptoms are identical): try. I can open COM5 with Termite so I know the connection is good). And no, I am not trying to open them at the same time. If you need more info let me know and I can post more. Thanks! EDIT: I'm on day three of trying to figure this out and still no luck. I don't really understand why I can access this COM through a terminal program and not my own when as near as I can see there is absolutely no difference. Does anyone know of a program that can 'examine' a COM port to see the properties of it (besides windows manager I mean)? I'm getting pretty frustrated and am sort of at a stand still in my project until I figure this out.. EDIT2: I've found an apparent workaround, but I've yet to get it to work here. Now I get a few different IO errors, but at least it is motion (not sure if it is progress). I've also learned that this is a . NET bug, which has existed since 2. I'd still love any help, but if I figure it out I will report back. Zach's code (the workaround linked above) is shown below: using System. System. IO. using System. IO. Ports. using System. Runtime. Interop. Services. using System. Text. using Microsoft. Win. 32. Safe. Handles. Serial. Port. Tester. My water rations are low but still I struggle on. I feel help must surely be on the horizon. Whoever finds this journal bring my remains back to Canada and find Nicole. Takeoff: How to start the program. For maximum performance it is recommended that you to minimize. The program will tell you which joysticks, if any. Scanner Setup and Trouble Shooting. Serial port comunication using visual basic. Can u please tell me when will the Com1 Program the bootloader. If you are using a USB Arduino. Serial Communication using C# and Whidbey. When I am using VC#, Idon't receive anything and the program became busy. My code: using System; using System.Text; using System.Windows.Forms. Tell her I love her. But seriously, I have no idea what is causing this problem. I'm wondering if it is purely on the embedded side; maybe because it is USB- to- go, or because the device is capable of being a host also. Has anyone run into that problem? It doesn't explain why I can use Termite (a terminal program, for those viewers just joining us) though. I have been trying to find an open source terminal program that a) works and b) see a). As per usual, I will report back if I discover the issue here as I have now found countless forums where it sounds people have had this issue dating back to 2. EDIT4: So as per the advice given, I downloaded a port monitoring software app (I got Eltima Serial Port Monitor) and it does look like a baud issue: but strangely no matter what baud I set it still fails. And also can someone explain what the up/down thing means? I tried googling it but the keywords are too general. As usual, I will keep reporting back any changes. Also, for the record, I can connect using Eltima at a baud of 1. Termite). Unfortunately this does not work in Visual Studio. EDIT5: Our plot takes a surprise twist. I was monitoring what happens when Termite connects to the COM port in question and BLAM! Termite throws the exact same error as my program, but it ignores it. Now I need to learn how to ignore IOExceptions. I'll report back when I get it figured out. EDIT6: So as it turns out it is a baud rate issue, but it goes deeper. I have been using Eltima Serial Port Monitoring software and it is very intuitive and easy to use. After some research I have learned that you cannot ignore this exception and still connect to the serial port using . NETs library. So I have to go deeper into the Win. API and write my own. I have found a few pages that touch on this, but to be honest I have never done anything like this before so it may be a while before I report back but I will definitely figure this out and get back to everyone. There are way too many who suffer from this problem. I have found quite a few forums and websites where I can see the exact same symptoms but nobody has really done much besides say 'Yeah, . NET sucks'. I plan on writing a full static library class and then publish either on my website, here and wherever else I can. Hopefully . NET will take notice (this bug has existed since 2. I'll report back when it is done! EDIT7: This is a lot harder than I thought it would be. EDIT8: I don't know if anyone is following this or not but I wanted to say that I am still at it but am out of town for a week on a business trip. I'm still happy to hear suggestions and alternative ideas though!
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2016
Categories |