sometimes epStatus does not match with ep

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

cross mob
rossi
Level 3
Level 3
25 replies posted 50 sign-ins 10 questions asked

In my usb2.0 host firmware test, I found something weird.

These are some code snippets and the resulting logs.

 

 

 

 

static void
CyFxHostXferCb (uint8_t ep, CyU3PUsbHostEpStatus_t epStatus)
{
    CyU3PReturnStatus_t status = CY_U3P_SUCCESS;

    CyU3PDebugPrint (4, "CyFxHostXferCb ep=0x%x epStatus=0x%x\r\n",ep,epStatus);

    /* Queue the next request */
    if (ep != 0)
    {
        status = CyU3PUsbHostEpSetXfer (ep, CY_U3P_USB_HOST_EPXFER_NORMAL, 0);
        CyU3PDebugPrint (4, "CyFxHostXferCb CyU3PUsbHostEpSetXfer(0) status=0x%x\r\n",status);
    }
}

/* This function initializes the USB host stack. */
void
CyFxUsbHostStart ()
{
    CyU3PUsbHostConfig_t hostCfg;
    CyU3PReturnStatus_t status;

    hostCfg.ep0LowLevelControl = CyFalse;
    hostCfg.eventCb = CyFxHostEventCb;
    hostCfg.xferCb = CyFxHostXferCb;
    status = CyU3PUsbHostStart (&hostCfg);
    if (status != CY_U3P_SUCCESS)
    {
        return;
    }
}

 

 

 

 

 

 

 

...
CyFxHostXferCb CyU3PUsbHostEpSetXfer(0) status=0x0
CyFxHostXferCb ep=0x81 epStatus=0x40
CyFxHostXferCb CyU3PUsbHostEpSetXfer(0) status=0x0
CyFxHostXferCb ep=0x81 epStatus=0x40
CyFxHostXferCb CyU3PUsbHostEpSetXfer(0) status=0x0
CyFxHostXferCb ep=0x81 epStatus=0x40
CyFxHostXferCb CyU3PUsbHostEpSetXfer(0) status=0x0
CyFxHostXferCb ep=0x81 epStatus=0x40
CyFxHostXferCb CyU3PUsbHostEpSetXfer(0) status=0x0
CyFxHostXferCb ep=0x81 epStatus=0x40
CyFxHostXferCb CyU3PUsbHostEpSetXfer(0) status=0x0
CyFxHostXferCb ep=0x81 epStatus=0x141
CyFxHostXferCb CyU3PUsbHostEpSetXfer(0) status=0x0
CyFxHostXferCb ep=0x81 epStatus=0x141
CyFxHostXferCb CyU3PUsbHostEpSetXfer(0) status=0x0
CyFxHostXferCb ep=0x81 epStatus=0x141
CyFxHostXferCb CyU3PUsbHostEpSetXfer(0) status=0x0
CyFxHostXferCb ep=0x81 epStatus=0x141
CyFxHostXferCb CyU3PUsbHostEpSetXfer(0) status=0x0
CyFxHostXferCb ep=0x81 epStatus=0x141
CyFxHostXferCb CyU3PUsbHostEpSetXfer(0) status=0x0
CyFxHostXferCb ep=0x81 epStatus=0x141
CyFxHostXferCb CyU3PUsbHostEpSetXfer(0) status=0x0
CyFxHostXferCb ep=0x81 epStatus=0x141
CyFxHostXferCb CyU3PUsbHostEpSetXfer(0) status=0x0
CyFxHostXferCb ep=0x81 epStatus=0x141
CyFxHostXferCb CyU3PUsbHostEpSetXfer(0) status=0x0
CyFxHostXferCb ep=0x81 epStatus=0x40
CyFxHostXferCb CyU3PUsbHostEpSetXfer(0) status=0x0
...

 

 

 

 

According to the following table, the last 4digits(3:0) indicate ep number.

pastedImage_0.png

 

When we look at the logs,

as we know, ep=0x81 means EP_NUM=1

CyFxHostXferCb ep=0x81 epStatus=0x141 -> This makes sense because, EP_NUM of epStatus is "1"

But in the following case,

CyFxHostXferCb ep=0x81 epStatus=0x40 -> epStatus tells EP_NUM is "0" instead of "1", which does not match with ep=0x81.

 

How should I interpret this discrepancy?

 

Regards,

Rossi

0 Likes
1 Solution
Rashi_Vatsa
Moderator
Moderator
Moderator
5 likes given 500 solutions authored 1000 replies posted

Hello,

Please confirm if the behavior is same when CyU3PDebuPrint is not called in the interrupt callback

 

Regards,
Rashi

View solution in original post

0 Likes
1 Reply
Rashi_Vatsa
Moderator
Moderator
Moderator
5 likes given 500 solutions authored 1000 replies posted

Hello,

Please confirm if the behavior is same when CyU3PDebuPrint is not called in the interrupt callback

 

Regards,
Rashi
0 Likes