1 Reply Latest reply on Apr 19, 2016 1:59 AM by pacr_284376

    USBFS_UART how to detect opening of USB Comm-port ?


      Hi there,


      Is there a way to detect the opening/closing of the (virtual) comm-port from the PC side ?


      I tried several USB variables but cannot figur out which one is the correct one to use, mainly because the reaction of the variables depend on which PC program I use.


      For example, using TeraTerm give a configuration change on which I could trigger.


      But unfortunately using Bray's Terminal or the following CSharp program does not (always) give a configuration change.


                  SerialPort Dut=new SerialPort("COM7",115200);
                  Dut.WriteLine("VAR LWR=1\r\n");




      Attached i have the basic USBFS_UART example, I made some changes to run it on my hardware (CY8CKIT-059) but, as said, it only registers changes in settings; not in opening/closing of the USB port.


      Background :


      - In my end-application I have a commandline-interface in which you can start/stop several timers and readout analog values. I want to reset the timers and maybe other stuff as soon as the USB port is closed.





        • 1. Re: USBFS_UART how to detect opening of USB Comm-port ?

          Solved. I also need to set Dut.DtrEnable=true in the CSharp code. This is default false.


          After doing this, the DTR can be checked in the embedded code to detect if the comport is opened or closed.


          It works now, in Bray's Terminal the DTR switch must be set (once) manually to achieve the same.


          I found this information in several forums of other manufacturers/libraries using USB-CDC such as LUFA so the problem is not related to PSOC5lp but to Windows/CSharp