Bug report

O

Ole

There is for sure a bug in Compact Framework 2.0 in the System.IO.Ports
namespace. The bug is in the BaudRate property of the SerialPort when a
Bluetooth unit is connected to the Port. The Error can be recreated by
runnning the following code (at least on a Pocket PC 2003 Device):
using System.IO.Ports;

SerialPort Commport = new SerialPort("COM8"); // COM8 is a Bluetooth
outbound port

Commport.Open();
Commport.BaudRate = 115200;

Following exception occurs:
innerException = {System.ArgumentOutOfRangeException: Argument must be
between 0 and 65536.
Parameter name: baudRate
at System.IO.Ports.SerialStream.set_BaudRate()
at System.IO.Ports.SerialPort.set_BaudRate()
at TestCom.Form1.button1_Click()
at System.Windows.Forms.C...

But there is no problem when using the API SetCommState!!!

Thanks
Ole
 
O

Ole

To others who are struggling the same problem there is a hint to a
workaround:
Check if the COM port you are trying to set baudrate of is a Bluetooth
module and if it is then Don't set the baud rate! A bluetooth module doesn't
care about baud rates as it is a radio port so even if the baudrate is set
to 9600 it will communicate at 115200. If the port is a normal wired serial
port there is no problem by setting it to 115200.

BR
Ole
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top