How to determine when USBUART terminal software client connects to PSOC 5

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
WaMa_286156
Level 5
Level 5
First comment on blog 100 replies posted 50 replies posted

I would like to know how to determine when a software client (like teraterm in windows or screen in linux/macintosh) connects to the PSOC5 USB configured as a USBUart device using the standard Cypress provided USB Drivers in windows and the generic drivers in Linux/Macintosh.

The following example code:

       /* Host can send double SET_INTERFACE request. */

        if (0u != USBUART_IsConfigurationChanged())

        {

            /* Initialize IN endpoints when device is configured. */

            if (0u != USBUART_GetConfiguration())

            {

                /* Enumeration is done, enable OUT endpoint to receive data

                 * from host. */

                USBUART_CDC_Init();

            }

        }

       

        if(0 != USBUART_GetConfiguration()){  

            /* Check for input data from host. */

            if (0u != USBUART_DataIsReady()){

......

}

Only lets you know when the USB is enumerated and the endpoints are established.   This is ages before the Software program connects (in CPU time).

I have tried reading the DataSheet for the USBFS/USBUart module, and searched the automatically generated code, but I have not been able to determine what interrupts/signals/data are given to the PSOC when a software program connects to the USB port.

I would like to generate a sign-on message through the USB Serial port so the connecting program (or user) knows the device is alive and ready.

Can someone help?

Thank You!

1 Solution
RodolfoGL
Employee
Employee
250 solutions authored 250 sign-ins 5 comments on KBA

You can use the function Cy_USB_Dev_CDC_IsLineChanged to find out if anything changed. It would return a value different then zero when connecting, disconnecting or changing the COM settings in the terminal emulator.

View solution in original post

2 Replies
RodolfoGL
Employee
Employee
250 solutions authored 250 sign-ins 5 comments on KBA

You can use the function Cy_USB_Dev_CDC_IsLineChanged to find out if anything changed. It would return a value different then zero when connecting, disconnecting or changing the COM settings in the terminal emulator.

WaMa_286156
Level 5
Level 5
First comment on blog 100 replies posted 50 replies posted

That function morphs into USBUART_IsLineChanged() if you name your USBFS component USBUART.

It appears to work well. 

I looked through the auto-generated code, but never saw where it was written to in memory, but I did not delve into the component.

Thanks!

0 Likes