Learn how to a build a cloud-first strategyRegister Now


Maximum baud rate in Visual Basic 2005 on Windows Mobile 5?

Posted on 2009-02-16
Medium Priority
Last Modified: 2013-11-26
I'm connecting a bluetooth SPP device to an ipaq.  It runs at 115200 bps.  I'm using a VB 2005 serialPort object.  The device worked at 38400 bps.  A terminal emulator communicates with the device at 115200 bps, but my program in VB reports an error:

"Unable to open Serial Port System.ArguementOutofRangeException: The maximum baud rate for the device is 65536.  Parameter name: baudRate at System.IO.Ports.SerialStream...."

This error cannot be correct.  The device works fine at that baud rate.  The VB documentation states that the port is functional at 115200 bps.  I find it curious that 65536 is the number for 2^16.  The baud rate data type is integer, but it should be 32 bits.

My question:  How do can VB 2005 in windows mobile 5 be set to run at 115200 bits per second?

The program is not set to dynamically change the baud rate.  The baud rate property in VS for the serial port has 115200.  I have a label text value that shows the current setting is 115200 when the form loads.

Any help would be appreciated.
Question by:plainman98
  • 4
  • 2

Assisted Solution

AdamsConsulting earned 800 total points
ID: 23656078
Are you using the same driver as the terminal emulator? That error your getting is based on the limitations of the serial driver, not of visual basic.

Author Comment

ID: 23656204
I don't know what driver the terminal emulator is using.  It makes sense that they might be different however the subsystem on windows mobile 5.0 isn't as easy to pry into.  The VB project uses the driver that visual studio deploys with... How would one check that?  The serialport component that ships with visual studio 2005 uses what driver under the hood?  I would imagine that the driver is different for windows xp than for windows mobile.

Author Comment

ID: 23656251
I just found this on http://www.learningce.com/Discuss/Windows+CE/773.aspx
Hello Everyone,

I am posting this on behalf of Phytec, a vendor for a great PXA270 board, which features a processor module and carrier board.  The carrier board allows easy customization of the interface to the PXA270, while allowing the processor module hardware to remain unchanged.  To the question at hand...

When using .NET CF with Windows CE serial drivers, if an application requests data rates beyond 115.2 Kbps by assigning the value of the System.IO.Ports.SerialPort.BaudRate member a bit rate beyond 115.2 Kbps (i.e. a value of 1000000 for 1 Mbps), an error value may be returned.  This is true even with custom serial drivers unless a particular change is made to the default serial driver code provided with Platform Builder.  This change is described below:

Windows CE serial port drivers are required to implement the IOCTL IOCTL_SERIAL_GET_PROPERTIES in the COM_IOControl function.  This IOCTL returns a reference to the COMMPROP structure, which contains a member which is of particular importance in answering this question.  This member is called dwMaxBaud and it informs the caller of the maximum supported bit rate for the serial driver.  When a customized CE serial driver needs to indicate to a calling .NET CF application that data rates beyond 115.2 Kbps are supported, this member must be assigned the actual value of the highest supported data rate in bits per second.  So, for example, if the serial driver supports a maximum data rate of 13 Mbps, a value of 13000000 must be assigned to the COMMPROP.dwMaxBaud member.

For those serial drivers which use the CSerialPDD::SetDefaultConfiguration member function in the MDD layer, this will require that this member function be overridden in the derived class to modify the assignment of the dwMaxBaud member with the desired maximum bit rate.  If this is not done, then a custom serial driver will report a maximum bit rate of 115.2 Kbps to .NET CF applications.

Making this change to the serial driver will then allow .NET CF applications to assign the value of the System.IO.Ports.SerialPort.BaudRate member a value up to the value of the dwMaxBaud member.  As in our above example, the .NET CF application would then be able to assign the System.IO.Ports.SerialPort.BaudRate member a value of 13000000 to request a data rate of 13 Mbps.

(on behalf of Josie Adams of Phytec)

I guess my question should be:

How in VB code can this be done: force the max baud rate higher than it is currently set for the driver in use?
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.


Assisted Solution

AdamsConsulting earned 800 total points
ID: 23663196
I only do C# .NET programming for windows mobile, so I don't know if this applies, but when developing I find that I can compile my application for .NET 2.0 or .NET 3.5, providing that I have both on my workstation and the device has both installed. I wonder if that's the difference between your app and the terminal emulator, if it's written in VB.

You can use dependency walker or even possibly debug the terminal emulator in Visual Studio if you want to see what libraries it's using. Another guess is that it's using the DLLs on the phone, and you're using the VB runtime? I wish I could be of more help, but I don't think that what you found is relevant. I don't think you need to work around a VB limitation, but rather use the appropriate driver.

Accepted Solution

plainman98 earned 0 total points
ID: 23736269
Bluetooth serial ports on mobile devices are virtual, so it doesn't matter what the baud rate is.  As per:


Set the baud rate to an acceptable value and it will connect.  I'm still testing it, but it looks like it should be fine.

Author Comment

ID: 23776403

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses
Course of the Month20 days, 23 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question