views:

50

answers:

1

Hi everyone,

I am using visual studio 2008 and developing a windows forms application in C# using .net 3.5

I am doing serial communication and on a button click the application getting a list of all the comm ports available. I then scan for the device i am looking for by opening each port in turn, sending my custom handshake request command and waiting the reply for some number of seconds.

It all works fine on my PC (and on other 8 PCs I've tested it on) but when i run the program on a laptop my program seems to see all the comm ports and sends a requires but my device never receives it. I've tried using the hardware comm port and the usb-to-serial converters. I've also tested it on several laptops form different manufacturers. All of the them behave exactly the same.

Has anyone ran into similar problems?

UPDATE 1

The laptops seem to be able to receive data from the device, but still can not transmit. And of course no problems whatsoever with desktops.

UPDATE 2

A laptop can receive and transmit data. Therefore that narrows the problem down to my C# software that can do serial communication on a desktop but can not do same thing on a laptop.

UPDATE 3

Solved it. The problem was caused by built in modems of my test laptops. The com port reserved by the modem (typically COM3) does not appear in the device manager, but can be seen in the windows regestry. So whenever my serial port object would ask for a list of com ports, it would get the modem port, and these modems choked on my handshake requests during the port scan. As usual everything is stupid and simple.

+2  A: 

Sounds like your device is picky about the voltage levels. RS-232 doesn't nail that down very well, allowing anywhere between +/- 5V to +/- 28V. Most devices are happiest with +/- 12V, a standard voltage available in desktop machines. Laptops however are always on the low end, +/- 5V typ. Not much you can do about it.

To test this theory, eliminate the possibility that this is induced by your code and make sure it works with a null modem. Connect TxD to RxD so that you receive what you send. Then use Hyperterminal or Putty. If the latter fails to see the device as well then it's a hardware problem.

Hans Passant
Yes. Now up to the antique-shops for a nul-modem cable.
Henk Holterman
I've tried the hypertermial. I can receive data from the device but can not transmit to it on the laptop.
udushu
That fits the pattern. The device has plenty of oompf on its output signals, the laptop won't have trouble with it. Not enough oompf on the laptop output signals, the device can't see it. Google 'rs232 signal booster'.
Hans Passant
@Henk: jumper pins 2 and 3.
Hans Passant
I still have a couple of those lying around ;)
udushu