You are here

USBFS_UART how to detect opening of USB Comm-port ? | Cypress Semiconductor

USBFS_UART how to detect opening of USB Comm-port ?

Summary: 1 Reply, Latest post by Paddy72 on 19 Apr 2016 01:59 AM PDT
Verified Answers: 1
Last post
Log in to post new comments.
user_347933176's picture
35 posts

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.



user_347933176's picture
35 posts

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



Log in to post new comments.