Skip Menu |

This queue is for tickets about the Win32-SerialPort CPAN distribution.

Report information
The Basics
Id: 73763
Status: open
Priority: 0/
Queue: Win32-SerialPort

People
Owner: Nobody in particular
Requestors: daniele.beorchia [...] u-blox.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.22
Fixed in: (no value)



Subject: Cannot open COM port with baudrate higher than 115200
It is not possible to open a COM port using a baudrate higher than 115200, i.e. my $ComPortObj = Win32::SerialPort->new($ComPortID) or die ("This is the bitter end..."); $ComPortObj->baudrate (460800); fails with the error "Cannot initialize port COM5 with parameters: 460800 8 1 none rts at ..." Would it be possible to support higher baudrates such as 230400, 460800 and 921600? Distribution: Win32-SerialPort-0.22 Perl version: 5.12.3 built for MSWin32-x86-multi-thread OS: Windows XP 32bit, with SP2 Regards, Daniel Beorchia
Subject: Re: [rt.cpan.org #73763] Cannot open COM port with baudrate higher than 115200
Date: Thu, 05 Jan 2012 20:17:23 -0500
To: bug-Win32-SerialPort [...] rt.cpan.org
From: Bill Birthisel <bbirthisel [...] aol.com>
Hi Daniel, When SerialPort was first written, in the days of W95 and NT4, 115200 was the maximum supported by the API. There was a bitmask and that was the maximum bit assigned. And even so, neither of those OSs and the hardware of the time could sustain that rate - there were limited to short bursts. My RedHat linux system (at that time) could do sustained file transfers at that speed - and I confirmed with my own testing the limitations of the others. NT4 could run at 56K, but the handshaking bits were busy. I'll look to see if there is a suitable API call to add the higher speeds. I might not get to it immediately, though. -bill On Thu, 2012-01-05 at 10:28 -0500, Daniel via RT wrote: Show quoted text
> Thu Jan 05 10:28:28 2012: Request 73763 was acted upon. > Transaction: Ticket created by dbeo > Queue: Win32-SerialPort > Subject: Cannot open COM port with baudrate higher than 115200 > Broken in: 0.22 > Severity: (no value) > Owner: Nobody > Requestors: daniele.beorchia@u-blox.com > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=73763 > > > > It is not possible to open a COM port using a baudrate higher than > 115200, i.e. > > my $ComPortObj = Win32::SerialPort->new($ComPortID) or die ("This is the > bitter end..."); > $ComPortObj->baudrate (460800); > > fails with the error > > "Cannot initialize port COM5 with parameters: 460800 8 1 none rts at ..." > > Would it be possible to support higher baudrates such as 230400, 460800 > and 921600? > > Distribution: Win32-SerialPort-0.22 > Perl version: 5.12.3 built for MSWin32-x86-multi-thread > OS: Windows XP 32bit, with SP2 > > Regards, > Daniel Beorchia
Subject: Re: [rt.cpan.org #73763] Cannot open COM port with baudrate higher than 115200
Date: Tue, 10 Jan 2012 22:48:23 -0500
To: bug-Win32-SerialPort [...] rt.cpan.org
From: Bill Birthisel <bbirthisel [...] aol.com>
Hi Daniel, It looks like the current definition of the DCB structure sort of provides for a couple speeds above 115200 - but they are not the "standard" speeds: http://msdn.microsoft.com/en-us/library/windows/desktop/aa363214% 28v=vs.85%29.aspx Specifically: CBR_128000 and CBR_256000. But I'm not convinced you're interested in non-standard speeds. It also looks, from the Requirements, like XP is the last version to natively use the DCB interface - although later OS versions probably support it via emulation. I don't think there is enough demand to justify trying to port Win32::SerialPort to a later driver model just to get faster baudrates. It would probably involve a lot of effort. Sorry. -bill On Thu, 2012-01-05 at 20:17 -0500, Bill Birthisel wrote: Show quoted text
> Hi Daniel, > > When SerialPort was first written, in the days of W95 and NT4, 115200 > was the maximum supported by the API. There was a bitmask and that was > the maximum bit assigned. And even so, neither of those OSs and the > hardware of the time could sustain that rate - there were limited to > short bursts. My RedHat linux system (at that time) could do sustained > file transfers at that speed - and I confirmed with my own testing the > limitations of the others. NT4 could run at 56K, but the handshaking > bits were busy. > > I'll look to see if there is a suitable API call to add the higher > speeds. I might not get to it immediately, though. > > -bill > > On Thu, 2012-01-05 at 10:28 -0500, Daniel via RT wrote:
> > Thu Jan 05 10:28:28 2012: Request 73763 was acted upon. > > Transaction: Ticket created by dbeo > > Queue: Win32-SerialPort > > Subject: Cannot open COM port with baudrate higher than 115200 > > Broken in: 0.22 > > Severity: (no value) > > Owner: Nobody > > Requestors: daniele.beorchia@u-blox.com > > Status: new > > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=73763 > > > > > > > It is not possible to open a COM port using a baudrate higher than > > 115200, i.e. > > > > my $ComPortObj = Win32::SerialPort->new($ComPortID) or die ("This is the > > bitter end..."); > > $ComPortObj->baudrate (460800); > > > > fails with the error > > > > "Cannot initialize port COM5 with parameters: 460800 8 1 none rts at ..." > > > > Would it be possible to support higher baudrates such as 230400, 460800 > > and 921600? > > > > Distribution: Win32-SerialPort-0.22 > > Perl version: 5.12.3 built for MSWin32-x86-multi-thread > > OS: Windows XP 32bit, with SP2 > > > > Regards, > > Daniel Beorchia
>
From: daniele.beorchia [...] u-blox.com
On Tue Jan 10 22:49:40 2012, Bbirthisel@aol.com wrote: Hi, Show quoted text
> It looks like the current definition of the DCB structure sort of > provides for a couple speeds above 115200 - but they are not the > "standard" speeds: > > http://msdn.microsoft.com/en-us/library/windows/desktop/aa363214% > 28v=vs.85%29.aspx > > Specifically: CBR_128000 and CBR_256000. But I'm not convinced you're > interested in non-standard speeds. It also looks, from the > Requirements, > like XP is the last version to natively use the DCB interface - > although > later OS versions probably support it via emulation.
True, I'd need more common baudrates such as 230400, 460800 and 921600. I have taken a look at the specs on MSDN you provided. The "BaudRate" member doesn't necessarily require one of the defined CBR_xxx indexes: "BaudRate The baud rate at which the communications device operates. This member can be an actual baud rate value, or one of the following indexes." A colleague of mine has suggested me to add the last three lines below in the CommPort.pm file: [code] # first check for programmable baud $hr = \%{$self->{"_L_BAUD"}}; if ($CP_MaxBaud & BAUD_USER) { $fmask = $CP_SettableBaud; ${$hr}{110} = CBR_110 if ($fmask & BAUD_110); ${$hr}{300} = CBR_300 if ($fmask & BAUD_300); ${$hr}{600} = CBR_600 if ($fmask & BAUD_600); ${$hr}{1200} = CBR_1200 if ($fmask & BAUD_1200); ${$hr}{2400} = CBR_2400 if ($fmask & BAUD_2400); ${$hr}{4800} = CBR_4800 if ($fmask & BAUD_4800); ${$hr}{9600} = CBR_9600 if ($fmask & BAUD_9600); ${$hr}{14400} = CBR_14400 if ($fmask & BAUD_14400); ${$hr}{19200} = CBR_19200 if ($fmask & BAUD_19200); ${$hr}{38400} = CBR_38400 if ($fmask & BAUD_38400); ${$hr}{56000} = CBR_56000 if ($fmask & BAUD_56K); ${$hr}{57600} = CBR_57600 if ($fmask & BAUD_57600); ${$hr}{115200} = CBR_115200 if ($fmask & BAUD_115200); ${$hr}{128000} = CBR_128000 if ($fmask & BAUD_128K); ${$hr}{256000} = CBR_256000 if (0); # reserved ?? ${$hr}{230400} = 230400 if ($fmask & BAUD_USER); ${$hr}{460800} = 460800 if ($fmask & BAUD_USER); ${$hr}{921600} = 921600 if ($fmask & BAUD_USER); } [/code] where the added baudrates are directly defined instead of using the CBR_xxx indexes. With these modifications I have successfully opened and used a COM port at 230400 and 460800 speeds on an FTDI USB-to-Serial adapter, I haven't tried with the 921600 one. I don't know if my colleague's implementation is clean and/or correct, though. Regarding the API support in Windows, ActivePerl lists your Win32-SerialPort library as compatible with 32-bits Windowses only, and due to tests failing under Windows 7 the library has been set as incompatible and not available anymore with the latest ActivePerl version: http://code.activestate.com/ppm/Win32-SerialPort/ I have tried the library under both 32bit versions of XP and 7 and at least with the previous ActivePerl version it works on both systems. Regards, Daniel Beorchia