PSoC5LP: USBFS Out EP status not reading OUT_BUFFER_FULL when command is sent: only on USB3 ports?

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

cross mob
KyTr_1955226
Level 6
Level 6
250 sign-ins 10 likes given 50 solutions authored

So I've got a really weird issue with USBFS on PSoC5LP.  Currently trying to determine if it's something on the PSoC side or an issue with the HID API I am using on the PC side.

I've got the PSoC acting as a 64-byte Generic HID:

  • EP1 IN, 10ms, 64-bytes,  INT 
  • EP2 OUT, 10ms, 64-bytes, INT

The issue looks to be on EP2, where I have the following code to handle the endpoints.  This is called regularly every time through the main loop for as long as the USB device is connected.  It follows for the most part the same pattern for servicing the endpoints as laid out in AN82072 Appendix A (pg 58) :

 

void Process_USB (void){
    static bool is_connected = false;
    is_connected = USB_UpdateConnection();    //Are we connected to a host?
    
    if (is_connected){

        /*IN Buffer is data going IN to Host PC*/
        if (USBFS_bGetEPState(USBFS_EP1) == USBFS_IN_BUFFER_EMPTY){
            USBFS_LoadInEP(USBFS_EP1, USB_HIDInBuffer, 64);
            memset(USB_HIDInBuffer,0x00,64);
            USBFS_EnableOutEP(USBFS_EP2);
        }

        /*OUT Buffer is data coming OUT of Host PC*/
        if (USBFS_bGetEPState(USBFS_EP2) == USBFS_OUT_BUFFER_FULL){
            USBFS_ReadOutEP(USBFS_EP2, USB_HIDOutBuffer, 64);  
            /*Incoming data processing SNIPPED*/
            memset(USB_HIDOutBuffer,0x00,65);
            USBFS_EnableOutEP(USBFS_EP2);   //Re-Arm the OUT Endpoint
        }
    }
}

 

What I'm seeing is that on typical USB 2.0 ports, there's no problem, endpoint data gets across fine, and when data is received by the PSoC, the (USBFS_bGetEPState(USBFS_EP2) == USBFS_OUT_BUFFER_FULL) evaluates to true and the processing code is entered where a message is queued to be sent back on EP1.

What I'm seeing though, is that when connected to a USB3 port, the device is recognized properly by windows and enumerates, but the processing code never fires since bGetEPState(USBFS_EP2) never evaluates to USBFS_OUT_BUFFER_FULL when a command is sent.

I have a USB protocol analyzer I hooked up to see if I could find anything out and I can see the OUT EP with the command (0x05 0x06) makes it out onto the EP, but why is it not being properly seen by the PSoC?  I have no idea why this is the case, or why it seems to only happen with USB3 ports (tested on 2 different PCs)?

On USB 2 Port you can see the OUT EP carrying the command 0x05 0x06 and the PSoC response on EP1 shortly after:

KyTr_1955226_0-1644252696921.png

On USB 3 Port you can see the OUT EP carrying the command 0x05 0x06, but the PSoC never responds:

KyTr_1955226_1-1644252729441.png

Has anyone seen anything like this in their experience?  I'm willing to believe it could be something with the HID API I am using on the PC side (HidSharp), but I want to rule out anything on the PSoC side as well if I can.  The fact that I can actually see the data coming from the PC through the Analyzer (A Beagle 12, FWIW) makes me lean toward something on the PSoC side not properly recognizing that data has come in through EP2.  Anything like a USBFS status register I could look at to maybe provide a clue as to what's happening here?

As far as I know, a USB2 cable/device connected to a USB3 port should just behave as a USB2 port would.  The port is physically designed to only connect VUSB/D+/D-/GND when a 2.0 cable is plugged in so the issue tracking only with USB3 ports is really strange.

Any thoughts are appreciated!  Thanks!

0 Likes
3 Replies
KyTr_1955226
Level 6
Level 6
250 sign-ins 10 likes given 50 solutions authored

Some additional info on the data packets going out on EP2.

When connected to a USB 2 port:

USB2Cap.PNG

 

When connected to a USB 3 Port:

USB3Cap.PNG

 

Only differences of note that I see is the transaction # (makes sense) and the ADDR and CRC are different.  Is that expected?  A different addr between different connections of the same device?

0 Likes
Ekta_N
Moderator
Moderator
Moderator
750 replies posted First like given 250 solutions authored

Hello @KyTr_1955226 

Can you please verify if the your USBFS descriptor configuration is same as that of the example: https://github.com/Infineon/mtb-example-psoc6-usb-hid-generic ?

I have attached the descriptor file here as well.

Best Regards
Ekta

0 Likes

USBFS Descriptor XML file saved from PSoC Creator is attached (pasted into word, xml files not allowed).  I think that should contain all the descriptor information?

It's basically the Generic 64-byte HID Example with our VID/PID and Manufacturer/Product Strings

0 Likes