cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1 MCU

1 Solution
Employee

Please try to add an additional USBUART_IsConfigurationChanged() prior USBUART_CDC_Init() as follows.

    for(;;) {

        // Wait for initialization completed

        while (USBUART_GetConfiguration() == 0);

        USBUART_IsConfigurationChanged();       // Ensure to clear the CHANGE flag

        USBUART_CDC_Init();                     // Initialize the CDC feature

        for (;;) {

            // Re-initialize if the configuration is changed

            if (USBUART_IsConfigurationChanged()) {

                break;

            }

This is required for me because Windows issues two SET_CONFIGURATION requests.

Regards,

Noriaki

View solution in original post

0 Likes
Reply
4 Replies
Employee

Please try to add an additional USBUART_IsConfigurationChanged() prior USBUART_CDC_Init() as follows.

    for(;;) {

        // Wait for initialization completed

        while (USBUART_GetConfiguration() == 0);

        USBUART_IsConfigurationChanged();       // Ensure to clear the CHANGE flag

        USBUART_CDC_Init();                     // Initialize the CDC feature

        for (;;) {

            // Re-initialize if the configuration is changed

            if (USBUART_IsConfigurationChanged()) {

                break;

            }

This is required for me because Windows issues two SET_CONFIGURATION requests.

Regards,

Noriaki

View solution in original post

0 Likes
Reply
Moderator
Moderator

Hello aaja_4705826

As already mentioned by Noriaki, windows can double send the SET_CONFIGUARTION request. Thus, you need to continuously check in a for loop if the configuration of the device has been changed and reinitialize the USB in case that case. You can do it as follows:

pastedImage_0.png

You can also refer to the USB UART code example for PSoC 5LP: https://www.cypress.com/documentation/code-examples/ce95396-usb-uart-psoc-35lp for  proper implementation.

Best Regards

Ekta

0 Likes
Reply
Honored Contributor

aaja,

Has Noriaki or Ekta helped?

Are you willing to share your project?

Len

Len
Engineering is an Art. The Art of Compromise."
0 Likes
Reply
Honored Contributor

aaja,

If you're using the USBUART in a conventional UART manner and if you're interested, I created a new component called "Term" that should handle many of the Terminal communication interfaces.  As the app designer you can chose to configure "Term" as a standard UART using the standard serial interface or you can configure it to use the USBUART (like that on the CY8CKIT-059).  It uses many of the same API commands as the UART component to make it very easy to configure it either way in your code.

Here's a copy of the link to the component library:

Terminal Support Component Library

I've used this component (and the other components included in the library) on many projects with great success.

Len

Len
Engineering is an Art. The Art of Compromise."
0 Likes
Reply