Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Win32::SerialPort faster connection than 115200 baud

by LotharWerner (Initiate)
on Feb 09, 2006 at 13:55 UTC ( [id://529081]=perlquestion: print w/replies, xml ) Need Help??

LotharWerner has asked for the wisdom of the Perl Monks concerning the following question:

I'm searching for a solution to use the Win32::SerialPort with faster baud value as 115200 baud. The perl script works fine but to slow with Win32::SerialPort. So my idea is a faster com port communication up to 921600 baud. For my hardware I use a MAX rs232 converter with Mbaud range. On the other hand I ordered a USB2.0 - RS232 converter also with Mbaud driver for Windows. I tried to set the Baud value higher as 115200 baud. But all the time there appear an error massage like this one:

Could not set baudrate on com2 at serielle2gui2.pl line 5304 Missing REQUIRED setting for BAUD at serielle2gui2.pl line 5318 write_settings failed, closing port at serielle2gui2.pl line 5318 Closing Win32::SerialPort=HASH(0x3a67fb4) com2 at serielle2gui2.pl lin +e 5318 Tk::Error: Can't call method "write" on an undefined value at serielle +2gui2.pl l ine 5323, <DATA> line 164. Tk callback for .frame5.button6 Tk::__ANON__ at C:/Perl/site/lib/Tk.pm line 252 Tk::Button::butUp at C:/Perl/site/lib/Tk/Button.pm line 111 <ButtonRelease-1> (command bound to event)

Edit: g0n - code tags

Replies are listed 'Best First'.
Re: Win32::SerialPort faster connection than 115200 baud
by BrowserUk (Patriarch) on Feb 09, 2006 at 17:50 UTC

    You'll need to modify Win32::CommPort. It contains a table of what it believes are the valid values for baudrate:

    COMMPROP=> [ qw( BAUD_USER BAUD_075 BAUD_110 BAUD_134_5 BAUD_150 BAUD_300 BAUD_600 BAUD_1200 BAUD_1800 BAUD_2400 BAUD_4800 BAUD_7200 BAUD_9600 BAUD_14400 BAUD_19200 BAUD_38400 BAUD_56K BAUD_57600 BAUD_115200 BAUD_128K

    You'll need to add the value(s) that you are trying to set to prevent it from rejecting the attempts.

    There is also a second table of baudrate-like values just below that may need updating also.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      After the Win32::SerialPort object has been created, alternate permissable baud rates can be set in the following manner:
      $object->{'_L_BAUD'}{2400} = 2400;
      Where the newly permissable baud rate in this example is 2400 - This behaviour is documented in the perl-win32-porters mailing list at http://aspn.activestate.com/ASPN/Mail/Message/perl-win32-porters/2716767 where this behaviour is described with respect to the manner by which permissable baud rates are determined for a given serial device.

       

      perl -le "print unpack'N', pack'B32', '00000000000000000000001000000000'"

        It would be a good idea to suggest that link be added to the pod under the heading "Known limitations" where it says:

        Since everything is (sometimes convoluted but still pure) Perl, you can fix flaws and change limits if required. But please file a bug report if you do.

        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.
Re: Win32::SerialPort faster connection than 115200 baud
by zentara (Archbishop) on Feb 09, 2006 at 17:03 UTC
    Are you sure the hardware and wires can handle baud rates that high?

    I'm not really a human, but I play one on earth. flash japh

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2024-04-19 19:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found