Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Win32 Serial Under Windows 7

by dasgar (Priest)
on Apr 03, 2018 at 03:53 UTC ( #1212215=note: print w/replies, xml ) Need Help??


in reply to Win32 Serial Under Windows 7

My first thought on debugging would be to log all of the incoming/outcoming communication and check the logs as a way to verify what is actually being sent and received. I didn't see anything in Win32::SerialPort's documentation or the documentation for Win32API::CommPort (which Win32::SerialPort is based on). The logging options are clearly documented for Control::CLI, which uses Win32::SerialPort on Windows for serial port communications. If you don't want to switch over to use Control::CLI, you can check out its source code to see how its doing the logging.

My next thought would be to look at timeouts and buffering. For the timeouts aspect, check out the last portion of the Configuration and Capability Methods section of the Win32::SerialPort documentation. It's been a long time since I worked on code using Win32::SerialPort, but I remember having issues related to timeouts.

Replies are listed 'Best First'.
Re^2: Win32 Serial Under Windows 7
by PilotinControl (Pilgrim) on Apr 03, 2018 at 17:17 UTC
    I downloaded a serial monitoring program and I can see the packets coming and going to the Arduino when I run my script....the sending is fine....the receiving is not being acknowledged...I tried changing the timing to read the data coming it...that did not help any.
      I downloaded a serial monitoring program and I can see the packets coming and going to the Arduino when I run my script

      Based on that description, you have confirmed that "something" is being sent from both sides. If you can get logging going from your Perl code, that would help you to verify that your code is actually sending what you think it is sending and verify exactly what it is receiving. This will help you to catch issues such as extra/missing white space characters (like carriage returns and line feeds) in what you send. By verifying what your code actually receives, you can debug the portions of your code that is reading the data sent from the device by seeing if it is processing the incoming data properly.

      Another debugging method would be to use something like putty to manually connect to the device to try to interact with it manually. If that's not working, then there might be other issues that need to be addressed first.

      I tried changing the timing to read the data coming it

      Have you looked into the buffering aspect of things?

      Another thing you can check is to see if you're using the same versions of Perl and the Win32::SerialPort module on both systems.

        Good News. I just used putty and it connected to the arduino just fine....I have a button connected to a a relay and an led. I just pressed the button and the feedback was sent back to the console screen on Putty. So it does work just as it does on Windows Vista and XP. I will add logging to the perl code and see what that turns up. Same version of perl and win32 serial port on windows vista, 7 and 10.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1212215]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2021-09-19 09:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?