CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2004
    Posts
    13

    Help! Virtual COM port problem.

    Hello, I meet some problem on COM-Port(RS232) programming recently.
    I use a USB-to-RS23 converter IC name CP2102(from Silicon Lab) for the front end of 8051 device. The 8051 will do some jobs for me after receiving the instruction from PC(software). The communication between PC and UART is done by Windows API, WriteFile and ReadFile.

    My problem is that sometimes the PC software will lost the handle of COM-Port which is already get and works well. Why?

    Is there any hardware release mechanism by Windows?
    Because I use 4 COM-Ports at once and the software may idle 1 min between each instruction. Will Window release the hardware resource(COM Port) because I use 4 at once and idle?

    If so, how to solve the problem?

    Thanks for help.

  2. #2
    Join Date
    Mar 2008
    Posts
    6

    Re: Help! Virtual COM port problem.

    Quote Originally Posted by ymmace
    My problem is that sometimes the PC software will lost the handle of COM-Port which is already get and works well. Why?
    What do you mean? Is it that whatever you send sometimes is lost and you have to send it again? please clarify.

  3. #3
    Join Date
    Mar 2004
    Posts
    13

    Re: Help! Virtual COM port problem.

    Quote Originally Posted by Keba
    What do you mean? Is it that whatever you send sometimes is lost and you have to send it again? please clarify.

    No. If the software lost the COM-Port, not only the communication is incorrect but also the software can't re-open the COM-Port.

    This tool kit (software+hardware) is setup on 6 independant NB. All the NB is the same. However, the error condition occurs in different frequence.

  4. #4
    Join Date
    Jul 1999
    Location
    Munich, Germany
    Posts
    142

    Re: Help! Virtual COM port problem.

    From my experience in the past I learned that some of those USB-to-RS232 converters ( I do not remember the ICs inside) have problems when the system is hibernating.

  5. #5
    Join Date
    Mar 2004
    Posts
    13

    Re: Help! Virtual COM port problem.

    Quote Originally Posted by Peter Sparlinek
    From my experience in the past I learned that some of those USB-to-RS232 converters ( I do not remember the ICs inside) have problems when the system is hibernating.

    If I keep communicating with the COM-Port, will hibernating condition occur?

    Now, I try to send a lot of "PurgeComm()" function which is the Windows API.

    I don't know will it fix the problem.

  6. #6
    Join Date
    Jul 1999
    Location
    Munich, Germany
    Posts
    142

    Re: Help! Virtual COM port problem.

    Assuming hibernating is really the source of your problems, it would be interesting to see whether PurgeComm will solve it.
    When I had this problem, I just switched hibernating off in the power management of the PC and it worked.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured