Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have an application that is monitoring a serial port. Data is sent from the other side only when the port is opened but I found out that I lose some data when I reboot my computer. Why is that?

The computer is running Windows XP.

share|improve this question

migrated from serverfault.com Jan 19 '10 at 3:14

This question came from our site for professional system and network administrators.

3 Answers 3

up vote 7 down vote accepted

This is caused by Windows opening the port at boot time for a very short time (under half a second). During this process, all of the serial ports are opened in order to detect input devices such the mouse.

The solution is to simply tell Windows not to do this, this way you don't lose your data since it's not being received. We can do this by modifying boot.ini and ensuring that we're using the /fastdetect switch. However, this will already be on in most cases, as it's enabled by default in Windows setup. I found the solution here, the article also includes informatation about NT and 9x (there are different solutions).

share|improve this answer
1  
Seems like it should be the other way around. The documentation indicates that /fastdetect prevents windows from querying the serial port. They probably need to ensure that this is in boot.ini support.microsoft.com/kb/833721 –  Greg Askew Jan 18 '10 at 5:12
    
Oops! You're right. I re-read the page I got the info from. Answer updated, and I added a link to my source. –  nbolton Jan 18 '10 at 14:34

I'd triple check that your CTS is being properly set and handled (specifically, that both ends know they're supposed to use hardware flow control). It's astonishingly rare for anyone to get this right, and even rarer for some sensor to have enough buffer to be able to store all its results whilst the machine is rebooting, so even if the flow control is working right, it's quite possible the sensor is discarding some data (either oldest or newest, depending on its design) because your machine is taking too long to reboot and reassert CTS.

share|improve this answer

There is also a command line tool available to disable scanning on selected com ports in the registry, if you want to avoid manually editing the boot.ini file.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.