By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,505 Members | 1,034 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,505 IT Pros & Developers. It's quick & easy.

Win32::SerialPort: can not set baudrate

P: n/a
Hi
I am trying to control my mobile from my WinXP machine. The
mobile is connected through USB which is mapped on COM 5. With
Hyperterminal everything looks good.
But when I try:
---------------------------------------------------------------
use Win32::SerialPort qw( :STAT 0.19 );
$ob = new Win32::SerialPort ('COM5') || die "Can't open COM5:
$^E\n";

my $baud = $ob->baudrate;
my $parity = $ob->parity;
my $data = $ob->databits;
my $stop = $ob->stopbits;
my $hshake = $ob->handshake;

print "\n\nCurrent Settings: ";
print "B = $baud, D = $data, S = $stop, P = $parity, H = $hshake\n";
$ob->baudrate($baud) || die "fail setting baud";
------------------------------------------------------------------
I get:

Current Settings: B = 115200, D = 8, S = , P = , H = none
Could not set baudrate on COM5 at C:\tools\Perl\Utility\COMS2.pl line
24
fail setting baud at C:\tools\Perl\Utility\COMS2.pl line 24, <DATA>
line 164.
---------------------------------------------------------------------

So I can not read the stop and parity and I can not set the baudrate
(which is required by Win32::SerialPort). A "mode COM5" from the
console give me:

Status for device COM5:
-----------------------
Baud: 115200
Parity: None
Data Bits: 8
Stop Bits: 1
Timeout: OFF
XON/XOFF: OFF
CTS handshaking: OFF
DSR handshaking: OFF
DSR sensitivity: OFF
DTR circuit: ON
RTS circuit: ON

Any idea??
Thanks
Carlo
Jul 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.